Specifying a file using only part of its name.
Specifying a file using only part of its name.
- Subject: Specifying a file using only part of its name.
- From: Brett Conlon <email@hidden>
- Date: Mon, 7 Nov 2005 13:17:18 +1000
Hi all,
The below script is extracted from my
larger script. It checks on our Server to see if there is a newer version
than the script they are running.
It simply does this by using the assigned
property value to check to see if the file exists. If there is a filename
change (most likely, say, from v1.0 to 1.5 or 2.0 etc) then it opens the
folder that contains the script and produces the prompt warning the user
to get the updated version.
property
GetVersion : "RESOURCES:VIDEO/DVD COVERS:TEMPLATES:PShop Actions:Create
Packshots ALL 1.0.app"
property
OpenFolder : "RESOURCES:VIDEO/DVD COVERS:TEMPLATES:PShop Actions"
on
run
if
CheckVersion() is
true then
--do stuff
end
if
end
run
--CHECK
RUNNING VERSION AGAINST SERVER VERSION
on
CheckVersion()
tell
application "Finder"
if
file GetVersion exists then
return
true
else
open folder OpenFolder
display dialog "There is a newer version of this script."
& return & "Please replace your script with the newer version
from the opened folder." buttons {"OK"} default button 1
with icon 0
return
false
end
if
end
tell
end
CheckVersion
I'd like to improve it by either having
the new version copied over to their desktop or at least have the newer
script highlighted in the opened window.
I was going to adapt the below script
I saw someone sent to this list recently but I realised that I'd have to
target a file with a name I can't always guarantee, eg. property value
for current script is "Create Packshots ALL 1.0.app" but the
newer version on the server might be 1.5 or 2.0 etc.
tell application "Finder"
set a to alias "RESOURCES:VIDEO/DVD
COVERS:TEMPLATES:PShop Actions:Create Packshots ALL 1.0.app"
make new finder window to a
end tell
How do I target part of a file name,
eg. "Create Packshots ALL", ignoring the rest of the file name
to either have it selected in the opened window or copied to their desktop?
Is there a more appropriate way to be
version checking, eg. comparing modified dates etc.?
Your help is most appreciated!
Regards,
Cojcolds
_______________________________________________
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