this code is complied but i must be out of it right now i can not get it to get the info for
i am sure i am just falling asleep at the wheel here
please help
--on open (mylist)
set thefolder to (choose folder)
set mylist to list folder thefolder without invisibles
set attach_me to {}
tell application "Finder"
repeat with i from 1 to (count mylist)
set thisitem to (thefolder & (item i of mylist))
set thisinfo to info for (thisitem)
set shortname to characters 1 thru 10 of the name of thisitem
if the name extension of thisitem is "pdf" then
open thisitem using application file "Macintosh HD1:Users:jbradfield:Library:Scripts:my scripts:PDF_Thumnail"
tell application "Adobe® Photoshop® 6.0.1" to activate
delay 10
set thejpg to (files of folder "CHEMICON:Marketing:Literature:Thumbnails:" whose name begins with shortname)
set thejpg to the end of attach_me
else if the name extension of thisitem is not "pdf" then
set thisitem to the end of attach_me
end if
end repeat
end tell
Joe,
The “info for” is found in Standard Additions’ dictionary and not in Finder’s. The Finder can get the properties of an item. So you could move the “info for” out of the “tell finder” block or use the “name” property of the item from the Finder’s Dictionary.
~Ross
here is my attempt to move the tell block
--tell application "Finder"
repeat with i from 1 to (count mylist)
set thisitem to (thefolder & (item i of mylist))
set thisinfo to info for (thisitem)
set shortname to characters 1 thru 10 of the name of thisitem
if the name extension of thisitem is "pdf" then
tell application "Finder"
open thisitem using application file "Macintosh HD1:Users:jbradfield:Library:Scripts:my scripts:PDF_Thumnail"
tell application "Adobe® Photoshop® 6.0.1" to activate
delay 10
set thejpg to (files of folder "CHEMICON:Marketing:Literature:Thumbnails:" whose name begins with shortname)
set thejpg to the end of attach_me
end tell
else if the name extension of thisitem is not "pdf" then
set thisitem to the end of attach_me
end if
end repeat
--end tell
but i still get an error
file alias …wasn’t found
any ideas
OK joe, I have re written some of your code. First you were not specifing a file reference, but only a string for the “info for” command. Also ater you set a variable to get the info for your file you have a list. You then have to reference that list when checking for the short name and extension. I hope that make sense. Take a look at the code as I have changed it and let us know if you get it.
repeat with i from 1 to (count mylist)
set thisitem to alias (thefolder & (item i of mylist) as string) -- gets you a refernce to the file
set thisinfo to info for (thisitem) -- a list of properties
set shortname to (characters 1 thru 10 of the name of thisinfo) as string -- coerces to a string instead of a list of individual characters
if the name extension of thisinfo is "pdf" then -- notice "of thisinfo"
tell application "Finder"
open thisitem using application file "Macintosh HD1:Users:jbradfield:Library:Scripts:my scripts:PDF_Thumnail"
tell application "Adobe® Photoshop® 6.0.1 to activate
delay 10
set thejpg to (files of folder "CHEMICON:Marketing:Literature:Thumbnails:" whose name begins with shortname)
copy thejpg to the end of attach_me
end tell
else if the name extension of thisinfo is not "pdf" then
set thisitem to the end of attach_me
end if
end repeat
~Ross