Hey all
This question is half n00b and half expert, if you can answer it that would be great.
My app is made in ASStudio and has an updater/register application (made in script editor becos doesnt work in ASS) in the packaged contents.
I need a way to get my ASS application to open my packaged application (n00b, but i cant get it to work)
I DONT want end users to be able to open the update application just by browsing through my other applications packaged files, so is there a way i could do something like:
--(in my ASS app...)
tell application "client_update"
runas_mainApp
end tell
--(in my Updater...)
on runas_mainApp
the updater code here
end on
(so that if the updater isnât activated by my main app it will not do anything)
Since my last question was almost totally ignored, i hope you can please help me this time
Hi Captain.
why does it not work in ASS?
i do not know, syntax perhaps? But i need the updater to be a separate application anyway.
Have you had any luck?
One spontaneous idea is to set a boolean flag in the user defaults of the main app.
The updater app reads the flag and works only if itâs true.
After that the main app resets the flag
The name of the flag could be something that doesnât point the end user to its meaning
PS: But it would be easier (and safer) to debug the code to run in ASS
im a n00b remember! what is a boolean flag? and have you found anyways to open the application, i cant.
open alias (path to as string & ":Re....
ok
this is for initialisation of the flag in the main app, put the call register_Preferences() in the awake from nib routine or
what do you have at startup
on register_Preferences()
tell user defaults
make new default entry at end of default entries with properties {name:"whateveryouwant", contents:0}
register
end tell
end register_Preferences
this is the routine to write the value:
on write_Update_flag(n)
tell user defaults to set contents of default entry "whateveryouwant" to n -- 0 or 1
end write_Update_flag
Then you can run the updater with
write_Update_flag(1)
run application "myupdater"
write_Update_flag(0)
the updater app must have a line to check the flag
set flag to do shell script "defaults read com.captainhams.myapp whateveryouwant" as boolean
if flag is false then quit
com.captainhams.myapp is the plist file of your main app (without the extension)
I hope my description is understandable
Hi,
Try this to launch your app. Replace âYourApp.appâ with the name of the application you want to launch, including the file extension (.app). Your app should be in the Contents/Resources folder of your package for this.
set appPath to POSIX path of (path to me as string) & "Contents/Resources/YourApp.app"
do shell script "open " & appPath
thanks, but i just get an error in my updater âcom.cns.dashtopâ is not a valid identifyer
thanks anyway
That should be defaults read
.
Of course, stupid me!!
Thanks Bruce, I fixed it above