> Message: 3
> Date: Thu, 28 Jul 2005 09:42:48 -0300
> From: Bernardo Hoehl <email@hidden>
> Subject: Relaunching application...
> To: AppleScript Studio Studio <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; format=flowed
>
> Hi List!
>
>
> I have this little application that on the first launch creates a few
> folders and files inside the user's application support folder.
>
> Well, the fact is that I once run for the first time, I have to close
> and open the application again, so that it loads a log file that I have
> just created.
>
> Can anyone give me a clue of how I could do this?
>
> I imagine I could use another app to do this. But I think there could
> be another simpler way of doing it.
I do something similar in an app -- on first launch, the app needs to set a
global pref, then it quits and re-launches. I tried several strategies
(some with major problems), and one worked great and reliably:
on startupCheck()
-- do some checks here
-- if checks require a relaunch then do the following
set relaunchPath to "'" & the path of the main bundle &
"/Contents/MacOS/myExecName" & "'"
do shell script (relaunchPath & " &> /dev/null &")
quit
end startupCheck
By pointing to the actual "executable" (which I am generically labeling
myExecName here) in the app bundle, and "executing" it in the shell script
command, I am able to launch a new instance of the app before quitting the
old one. As far as I know, this is the only way to have two instances of an
app going from a single app installed on the disk. All the other typical
"launch" commands I tried were just making the current instance of the app
active. So in this case, I set my prefs, launch a new instance of the app,
and then quit the old one. It all happens fast and seamlessly.
Craig
--
Dr. Craig Hunter
NASA Langley Research Center
Configuration Aerodynamics Branch
email@hidden
(757) 864-3020
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden
This email sent to email@hidden