Re: Droplet that crash
Re: Droplet that crash
- Subject: Re: Droplet that crash
- From: Tim Bumgarner <email@hidden>
- Date: Tue, 10 Feb 2004 21:15:45 -0500
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.
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.