Re: Very Irritating Open Handler
Re: Very Irritating Open Handler
- Subject: Re: Very Irritating Open Handler
- From: Tommy Bollman <email@hidden>
- Date: Fri, 01 Apr 2011 02:01:12 +0200
Hello Luther.
What is going on is way more complex than you think. You have to find the part of Matt Neubergs book "AppleScript the Definitive Guide" where Berkowitz is referenced, it is around a discussion of the open and run handler. Berkowitz nailed it.
You see, the error statement triggers the run handler ... So you are really jumping into the run handler in the middle of your open handler.
I guess something similiar will happne if you can't open a webloc file with the open handler.
Control is passed over to the run handler/implicit runhandler, and nothing more happens if you havent taken the measures described in Matt Neuburgs book.
Den 31. mars 2011 kl. 22.51 skrev Stan Cleveland:
> On Mar 31, 2011, at 12:54 PM, Luther Fuller wrote:
>
>> More ...
>>
>> The applications Smile, AppleScript Editor and Terminal all exhibit this behavior:
>>
>> I open a window, then drag & drop a .webloc file named "How SSL Works.webloc" (for example) from my desktop onto the window. The result is the text
>> "http://www.definityhealth.com/marketing/how_ssl_works.html"
>> (but it's not enclosed in quotes)
>>
>> In order to get an alias to this file, I have to type (not drag & drop) ...
>>
>> set fileAlias to alias "OS_X:Users:lutherfuller:Desktop:How SSL Works.webloc"
>>
>> which is a valid alias in AppleScript.
>
>
> Hi Luther,
>
> As an experiment (running 10.6.6), I saved an app with the following code
> on open theFiles
> display dialog theFiles as text
> end open
> then dragged three files on it: a PDF, an Excel doc, and a webloc file.
>
> The dialog box appeared, but only the PDF and Excel docs were shown in the dialog. The webloc file was not included in theFiles list. (And, coincidentally, the webloc file was NOT opened in Safari!) So even though this kept the webloc from opening, there's still no access to the file itself. Clearly, the 'on open' handler does not treat webloc files as regular files.
>
> When I dragged three webloc files on the same script, one of them (but not all) opened in Safari. And, as you pointed out, the script essentially dies at that point. I can't figure out what dictates which webloc opens, but it's not the alphabetical order of either their filenames or URLs nor the chronological order of either their creation or modification dates.
>
> It's all very strange!
>
> Stan C.
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
Best regards
Tommy Bollman
--------------------------------------------------------------------------------------------------
Mollison's Bureaucracy Hypothesis:
If an idea can survive a bureaucratic review
and be implemented it wasn't worth doing.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden