Re: OK last question today... Promise!!! ;-D
Re: OK last question today... Promise!!! ;-D
- Subject: Re: OK last question today... Promise!!! ;-D
- From: kai <email@hidden>
- Date: Thu, 17 Nov 2005 07:07:20 +0000
On 17 Nov 2005, at 05:56, Brett Conlon wrote:
This works:
################################
property ServerScriptFolder : "RESOURCES:VIDEO/DVD
COVERS:TEMPLATES:PShop Actions"
property ServerScript : "RESOURCES:VIDEO/DVD COVERS:TEMPLATES:PShop
Actions:Create Packshots ALL 5.2.app"
tell application "Finder"
set ServerScriptDate to modification date of (info for
alias ServerScript)
display dialog "Date: " & ServerScriptDate
end tell
################################
But this doesn't:
################################
property ServerScriptFolder : "RESOURCES:VIDEO/DVD
COVERS:TEMPLATES:PShop Actions"
tell application "Finder"
set ServerScript to select (every item of folder
ServerScriptFolder whose name begins with "Create Packshots ALL")
set ServerScriptDate to modification date of (info for
alias ServerScript)
display dialog "Date: " & ServerScriptDate
end tell
################################
I get the log error:
tell application "Finder"
select every item of folder "RESOURCES:VIDEO/DVD
COVERS:TEMPLATES:PShop Actions" whose name starts with "Create
Packshots ALL"
application file "Create Packshots ALL 5.2.app" of
folder "PShop Actions" of folder "TEMPLATES" of folder "VIDEO/DVD
COVERS" of disk "RESOURCES"
info for alias (application file "Create Packshots ALL
5.2.app" of folder "PShop Actions" of folder "TEMPLATES" of folder
"VIDEO/DVD COVERS" of disk "RESOURCES")
"Finder got an error: File alias (application file
Create Packshots ALL 5.2.app) wasn't found."
I clearly don't understand aliases as I should. By the look of the
log it seems to be finding the file but can't get info. It
specifies it as an "application file" in the last line - which is
different from what the other log (from the working one) shows.
You need to compare apples with apples, Brett. In your first example,
ServerScript is a string. In the second one, it's a list - and one
containing Finder references at that. (Checking the result of a
script a line at a time can help identify this sort of thing.)
The 'info for' command is from the Standard Additions scripting
addition. It understands general references, like aliases - but not
Finder References (or lists).
Since you're using Finder anyway, you can dispense with 'info for',
because Finder knows about modification dates, too. (There's no need
to select the target for something like this.)
Oh yeah - and 'every item' is a bit vague. If you can, try to narrow
the test down to begin with, by asking for a folder, a file, a
document file, an application file, and so on...
So if you're trying to get the date of a single application file, you
could achieve the above aim in one hit - something like this:
-----------------------------
property ServerScriptFolder : "RESOURCES:VIDEO/DVD
COVERS:TEMPLATES:PShop Actions"
tell application "Finder" to display dialog "Date: " & ¬
modification date of (first application file of folder ¬
ServerScriptFolder whose name starts with "Create Packshots ALL")
-----------------------------
If you really want a list, then you could get a list of dates from
Finder...
-----------------------------
property ServerScriptFolder : "RESOURCES:VIDEO/DVD
COVERS:TEMPLATES:PShop Actions"
tell application "Finder" to set dateList to ¬
modification date of (application files of folder ¬
ServerScriptFolder whose name starts with "Create Packshots ALL")
-----------------------------
... and then loop through it to make your comparisons.
---
kai
_______________________________________________
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