• 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 (2)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Droplet that crash (2)


  • Subject: Re: Droplet that crash (2)
  • From: Iwan Buetti <email@hidden>
  • Date: Thu, 12 Feb 2004 18:38:31 +0100

Il giorno 12/feb/04, alle 18:01, Paul Berkowitz ha scritto:

> Are you making an application with a user interface (windows, buttons,
> etc.)? Or just a regular droplet? Have you tried making it in Script
> Editor?

No, because i need to include in the package some Unix executable.

>
> Your process_item(this_item, item_info) handler should end with a
> 'return'
> statement. And if you actually want it to return the result of the text
> parsing then you'd have to both
>
> return thePathOfFolder
>
>
> and also call the handler this way:
>
> set thePathOfFolder to process_item(this_item, item_info)
>
> You don't seem to be doing anything with this info anyway. Even if you
> don't
> want to do anything with it, then at least add a
>
> return
>
> to the end of the handler.
>

It crash always, with a simple "return".
But this is a suggestion for the SOLUTION. :-)
I've tried to add a "return true" after the "quit" command, and now is
working!

Thank you! (and sorry for my bad english...)

> And why do you have a 'quit' command at the end of the 'on open'
> handler if
> you also have an idle handler? It doesn't make any sense to me. If you
> remove the idle handler and the quit command you'll probably be OK.

The "quit" command is OK, the idle handler too.

>
>
> --
> Paul Berkowitz
>
>
>> From: Iwan Buetti <email@hidden>
>> Date: Thu, 12 Feb 2004 12:42:28 +0100
>> To: <email@hidden>,
>> <email@hidden>
>> Subject: Droplet that crash (2)
>>
>> Why this droplet crashes?
>>
>> you have to copy-paste the script below in Application.applescript
>> (Xcode), build and drop a .mov file (not double-click) over the
>> compiled app. The script will launch, execute and crash. But if you
>> add
>> a line with a "display dialog" the app will not crash (see below).
>>
>>
>> It's more than 2 month that i've tried to have a solution... :-(
>> Please, help me.
>>
>> Thnx
>>
>> =====================================================================
>> Application.applescript:
>> =====================================================================
>>
>>
>> on idle
>> (* Add any idle time processing here. *)
>> return true
>> 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!!!! WHY???
>> 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-studio mailing list | email@hidden
>> Help/Unsubscribe/Archives:
>> http://www.lists.apple.com/mailman/listinfo/applescript-studio
>> 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.

  • Prev by Date: Re: Deleting characters
  • Next by Date: Re: Finding out is an Application is running
  • Previous by thread: Re: Droplet that crash (2)
  • Next by thread: Resolution to Close Windows - Samba Bug Workaround.
  • Index(es):
    • Date
    • Thread