• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Droplet that crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Droplet that crash


  • Subject: Re: Droplet that crash
  • From: Iwan Buetti <email@hidden>
  • Date: Wed, 11 Feb 2004 09:15:09 +0100

:-(
The droplet always crash. Sorry, i was incomplete: you have to copy-paste the script below in Application.applescript (Xcode), build and drop a file (not double-click) over the compiled script. The script will launch, execute and crash. But if you add a line with a "display dialog" the app will not crash (see below).

Thnx

Il giorno 11/feb/04, alle 03:15, Tim Bumgarner ha scritto:

Hi Iwan,

Add a 'return true' at the end of your on idle handler. This is a known bug, which has been fixed and will be included in the next release.

Tim Bumgarner
AppleScript Engineering

On Feb 10, 2004, at 5:55 PM, Iwan Buetti wrote:

Why this droplet crashes?
Made with Xcode.

It's more than 2 month that i've tried to have a solution... :-(

Application.applescript:

on idle
(* Add any idle time processing here. *)
end idle

on open names
(* Add your script to process the names here. *)

repeat with i from 1 to the count of names
set this_item to item i of names
set the item_info to info for this_item
if (folder of the item_info is false) then
if (alias of the item_info is false) then
process_item(this_item, item_info)
else
display dialog "You can not drag aliases." buttons {"Exit"} default button "Exit"
end if
else
display dialog "You can not drag folders." buttons {"Exit"} default button "Exit"
end if
end repeat
quit
end open

on process_item(this_item, item_info)
set thePath to this_item as text
set thePath to POSIX path of thePath

set theName to the name of the item_info as text
set theShortName to trim_line(theName, ".mov", 1)
set thePathOfFolder to trim_line(thePath, theName, 1)
set thePathOfFolder to trim_line(thePathOfFolder, "/", 1)
-- IF YOU INSERT HERE A "DISPLAY DIALOG" THE DROPLET WILL NOT CRASH!!!!
end process_item

on trim_line(this_text, trim_chars, trim_indicator) -- from apple.com
-- 0 = beginning, 1 = end, 2 = both
set x to the length of the trim_chars
-- TRIM BEGINNING
if the trim_indicator is in {0, 2} then
repeat while this_text begins with the trim_chars
try
set this_text to characters (x + 1) thru -1 of this_text as string
on error
-- the text contains nothing but the trim characters
return ""
end try
end repeat
end if
-- TRIM ENDING
if the trim_indicator is in {1, 2} then
repeat while this_text ends with the trim_chars
try
set this_text to characters 1 thru -(x + 1) of this_text as string
on error
-- the text contains nothing but the trim characters
return ""
end try
end repeat
end if
return this_text
end trim_line
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Droplet that crash (From: Iwan Buetti <email@hidden>)
 >Re: Droplet that crash (From: Tim Bumgarner <email@hidden>)

  • Prev by Date: Re: Carriage return hassles in Entourage Update
  • Next by Date: Re: Running a tell block without application opening (visually)
  • Previous by thread: Re: Droplet that crash
  • Next by thread: Re: Droplet that crash
  • Index(es):
    • Date
    • Thread