Re: auto-update
Re: auto-update
- Subject: Re: auto-update
- From: Brett Conlon <email@hidden>
- Date: Thu, 2 Mar 2006 16:55:55 +1000
- Sensitivity:
Hi Jeremy,
(sorry, this didn't make it to the list
the first time)
I use the following handler in all of my server-based scripts. This frees
me from having to continually roll out new scripts to all the macs in the
studio whenever I make changes (great or small). Now my scripts take care
of themselves:
if CheckVersion() is true then
--do all other stuff here
end if
--CHECK RUNNING VERSION AGAINST SERVER VERSION
on CheckVersion()
tell application "Finder"
set ServerScript
to (first application file of folder "RESOURCES:Script
Resources" whose name starts with "AutoPrint to
PDF")
set ServerScriptDate
to modification date of ServerScript
set LocalScript
to path to me
set LocalScriptDate
to modification date of LocalScript
if ServerScriptDate
is greater than LocalScriptDate then
set LocalScriptFolder to LocalScript's folder
try
move LocalScript to trash
move ServerScript to LocalScriptFolder
display dialog "The script you
are running is old and has been moved to the trash. The new version has
been copied to your computer. Please try again." buttons {"OK"}
default button 1 with icon 0
on error
display dialog "Attempting to update
your old script failed. Please see the Technical Coordinator for assistance."
buttons {"OK"} default button 1 with icon 0
end try
return false
else
return true
end if
end tell
end CheckVersion
Many kind professionals on this list (especially kai) helped me chisel
it out.
Cheers,
Cojcolds
ps. for some strange reason, a few times now, I've found that when I've
updated my server script then gone to a studio Mac and ran the script (to
test the update) it hasn't immediately updated itself. The second time
I ran the script it then updated itself and produced the message. This
hadn't been a frequent enough issue yet to query the list but seeing that
we're talking about it now I thought I'd bring it up.
Jeremy Matthews <email@hidden>
Sent by: applescript-users-bounces+brett.conlon=email@hidden
26/02/06 01:00 AM
|
To
| Applescript Users <email@hidden>
|
cc
|
|
Subject
| auto-update |
|
Anyone out there have a tried-and-true "autoupdate"
function that
works well for self-updating an applescript app?
Thanks
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden