Re: Script Menu in 10.6.2
Re: Script Menu in 10.6.2
- Subject: Re: Script Menu in 10.6.2
- From: Deivy Petrescu <email@hidden>
- Date: Sat, 06 Feb 2010 17:34:48 -0500
On 04/02/2010, at 17:37 , Shane Stanley wrote:
> On 5/2/10 4:52 AM, "Deivy Marck Petrescu" <email@hidden> wrote:
>
>> I fell this is a bug.
>
> I think my comment about the Finder getting confused suggests I tend to
> agree. I was just trying to explain what change might have precipitated it,
> and therefore how to avoid the problem.
>
>> Your statement "The 10.6 release notes cover this issue." would be correct if
>> the behavior was consistent across the board.
>
> I was just suggesting that the notes are worth reading to understand why
> there might be an issue.
>
>> It turns out that if you run the script in ASE or as an app it works as
>> expected (or not!) and if run from SM then it behaves differently.
>> In my dictionary, I call this a bug.
>
> And that's why I suggest people read the release notes. They specifically
> explain how the bahavior *can* be different with different apps. Read the
> bit about requiring authentication if the "sender and target processes have
> different user or group owner ids." I don't know if that's the problem in
> this case, but it does suggest that calling something to do with a scripting
> addition command a bug just because it behaves differently in different apps
> is not a valid call.
>
>> If you run it as an app in SM then it also runs correctly.
>
> But in that case SM is not running it, it's just launching it.
>>
>> If the op does not report it I will.
>
> By all means, go ahead. I was just trying to shed some light on how to avoid
> this sort of problem.
>
> --
> Shane Stanley <email@hidden>
> AppleScript Pro, April 2010, Florida <http://www.applescriptpro.com>
Shane,
My apologies if I misunderstood you.
Actually this script perked my curiosity and I played with it.
There are some very surprising things going on.
Here is the original script that **does not ** work in SM (or work rather poorly).
1. <script that does not work>
tell application "Finder"
set ListOfFiles to name of files of folder (path to documents folder)
end tell
set ChosenFile to (choose from list ListOfFiles with prompt "Select a File and press Choose" OK button name "Choose")
</script that does not work>
Now this script works:
2. <script that does work>
set k to (path to documents folder)
tell application "Finder"
set ListOfFiles to name of files of folder (path to documents folder)
end tell
set ChosenFile to (choose from list ListOfFiles with prompt "Select a File and press Choose" OK button name "Choose")
</script that does work>
Note that k is defined but not used.
This script also works:
3. <another script that does work>
tell application "Finder"
set ListOfFiles to name of files of folder (path to documents folder)
set ChosenFile to (choose from list ListOfFiles with prompt "Select a File and press Choose" OK button name "Choose")
end tell
</another script that does work>
I can't explain, but mostly it seems is a question of focus.
The dialog does not come in focus on the first script until you release the application displaying it (I assume System Events).
Until one clicks on another app and comes back to the dialog, it will not give you the focus.
If in script 3 one substitutes Finder by System Events then both in SE and on SM the dialog comes in but has to be activated to come to focus.
That is one has to add
activate
between the third and fourth line.
So, the problem might be SE not the Finders.
Actually trying the following script in ASEditor gives me some problem with focus.
<problematic script >
tell application "Finder" to set ListOfFiles to name of files of (path to documents folder)
tell application "System Events" to activate
set ChosenFile to (choose from list ListOfFiles with prompt "Select a File and press Choose" OK button name "Choose")
</problematic script >
Deivy Petrescu
email@hidden
_______________________________________________
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