Re: Screwy Choose file action
Re: Screwy Choose file action
- Subject: Re: Screwy Choose file action
- From: Deivy Petrescu <email@hidden>
- Date: Sat, 26 Jul 2014 11:22:52 -0400
On Jul 26, 2014, at 09:45 , Robert Poland <email@hidden> wrote:
> Ted,
>
> My error seems to be in comparing the NAME of the OLD and the NEW, unchanged.
>
> So I’ll try to add the "modified date" the the comparing.
>
>
> On Jul 26, 2014, at 7:40:AM, Ted Wrigley <email@hidden> wrote:
>
>> Any variable set at the top level of a script will be retained across runs. Properties and globals are special because the former can set with initial values and called from external scripts, and both can be referenced within handlers and child scripts. So unless the thePicture variable is set with a new value it will retain the value from the previous run. The question is why the variable isn’t being set with a new value. That has nothing obvious to do with the choose file command (which works as expected in simple tests), so it must be something specific to your script.
>>
>> Don’t need to see all 97 lines, but I do need to see the context(s) that deal with setting this variable, enough so I can replicate the specific problem. Trim it down to a short example script that shows the problem, and post that.
>>
>> On Jul 26, 2014, at 6:04 AM, Robert Poland <email@hidden> wrote:
>>
>>> Ted,
>>>
>>> Rather than send a 97 line script, let me ask a question.
>>>
>>> “Obviously the script is storing the last-chosen image”; If the script (.app) has completed and quit how does it remember the last variables? And how can they be reset (nulled)?
>>>
>>> There are no Properties, Locals or Globals declared.
>>
>
> Robert Poland
> Fort Collins CO
>
Actually Ted is right.
you should have put parts of your script so that we could see the problem.
And he is right also about the “globally” of variables.
Any variable declared at the root script is global and saved across runs.
You do not need to declare it global in the root script only in handlers.
Run the script below uncommenting the second time around.
<script>
set j to 5
add2j(6)
--noadd2j(6)
on add2j(x)
global j
return x + j
end add2j
on noadd2j(x)
return x + j
end noadd2j
</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