Referring to a folder
Referring to a folder
- Subject: Referring to a folder
- From: Brian Mather <email@hidden>
- Date: Wed, 26 Nov 2003 11:32:15 -0500
Can someone please help me with the correct syntax to refer to a folder so I
can move files to it? I would like to hard code the destination folders in
the script below as opposed to using the choose folder approach that, when
the script below is modified to utilize, works fine.
My apologies for the length of this post, I took a stab at trying to slim
the script down (and actually did to a degree believe it or not) offering
only the pertinent bits, but abandoned that approach for fear that I might
just muddy the waters further (for myself or others who would otherwise be
able to offer help).
Problem is I receive this error:
Can't make <<class cfol>> (<<class cfol "large" of <<class cdis>> "Scratch"
of application "finder") of application "Finder" into a item.
Script is:
-- uses David Lloyd's Image Info 2.01 on OS 9.2.2
property theLib : 0
on open theFiles
tell application "Finder"
set failed_folder to folder "fail" of disk "Scratch"
set largefolder to folder "large" of disk "Scratch"
set smallfolder to folder "medium" of disk "Scratch"
end tell
loadLib_Classic()
repeat with i from 1 to count of items in theFiles
set theFile to item i of theFiles
tell theLib to set theInfo to imageInfo(theFile)
set fileName to Image_Name of theInfo
set theError to Image_Error of theInfo
if theError = false then
set imageMode to Image_Mode of theInfo
set imageHeight to Image_Height of theInfo
set imageWidth to Image_Width of theInfo
if imageMode is not in {"CMYK", "Grayscale", "Indexed"} then
if imageHeight >= imageWidth then
tell application "Finder"
if imageHeight >= 400 then move theFile to
folder largefolder
if imageHeight < 400 then move theFile to
folder smallfolder
end tell
end if
--same if/then routine for height < width
else
tell application "Finder"
move file theFile to folder failed_folder
end tell
end if
else
display dialog theError buttons {"Cancel", "Continue"}
default button 2 with icon 2
end if
end repeat
end open
on loadLib_Classic()
try
tell theLib to checkLib()
on error
try
set imageInfoFile to (path to scripting additions folder as string)
& "Image Info"
set theLib to (load script alias imageInfoFile)
on error
set imageInfoFile to (choose file with prompt "Where is RImage
Info?S" of type "osas") as string
set theLib to (load script alias imageInfoFile)
end try
end try
end loadLib_Classic
Thanks in advance for any replies.
Brian Mather
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.