Re: Paths from my Mac, hidden, compiled into my script?
Re: Paths from my Mac, hidden, compiled into my script?
- Subject: Re: Paths from my Mac, hidden, compiled into my script?
- From: Håvard Graudo <email@hidden>
- Date: Tue, 26 Nov 2013 08:03:00 +0100
Den 22. nov. 2013 kl. 21.00 skrev koenig.yvan:
>
> Le 22/11/2013 à 20:51, Jerry Krinock <email@hidden> a écrit :
>
>> I codesigned (“code”-“signed”) an AppleScript application (.app), zipped and uploaded it to my server. The user downloaded it and reported to me that, at the point where it was supposed to create a directory on his desktop, it threw an error indicating that the directory “/Users/jk/Desktop/…” did not exist. I am “jk”, and that is *my* Desktop.
>>
>> So, of course, I searched the script to see if I had left a hard-coded path in there. No, I had not.
>>
>> Then I downloaded the script onto another Mac and, voila, reproduced the problem. So I opened up the script in AppleScript Editor on that other Mac, added some log statements, ran, but the problem did not recur. Furthermore it continued to work even after I removed the log statements and double-clicked the AppleScript .app in Finder.
>>
>> Breaking open the package and comparing it with a freshly-unzipped version of the download, I found that, in the edited app, the main.scpt file is about 20% smaller, and breaking the freshly-unzipped one open with a text editor, I find that the “/Users/jk/Desktop/…”, and other paths on my Mac, although they do not appear when viewing in AppleScript Editor, appear in there among the gibberish I see with the text editor. Further tests indicate that this seems unrelated to codesigning (the code signature).
>>
>> This looks like a long slog. Can anyone give me a head start? What would cause this local information to be compiled into my script? This is Mavericks.
>>
>> Thanks
>>
>> Jerry Krinock
>
> My understanding is that your script saved some global values.
> Try to encapsulate it in a on Run … end run block.
> If it uses explicit globals or properties, clean them before quitting the script.
>
You will have to clean them EVEN if they are not properties or explicitly declared globals. I am still on OS 10.6, but all of the above has always stored their values across runs.
If I run the blow TWICE, the dialog will tell my secret from the previos run:
---
on run
try
display dialog "your secret is: " & mysecret --> should always fail, right?
end try
set mysecret to text returned of (display dialog "What is your secret?" default answer "")
end run
---
_______________________________________________
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