• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why doesn't this simple script work?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why doesn't this simple script work?


  • Subject: Re: Why doesn't this simple script work?
  • From: "Neal A. Crocker" <email@hidden>
  • Date: Wed, 8 Aug 2001 14:29:11 -0700

There appear to be at least two problems (one of which won't be caught until the other is fixed), both in the following section of code:

if folder of the item_info is true then
if (alias of the item_info is false) and (the file type of
the item_info is "EPSF") then
move this_item to folder "Ad Report Folder:"
end if
end if


1) Inside a "Finder" tell block, the expression "folder of x" has a different meaning than outside of one. The meaning you intended is the one you get OUTSIDE of a "Finder" tell block. Unfortunately, this section of code is inside a "Finder" tell block. Thus, ther error message:

--> Can't get folder of {name:"IP09.15N.1ST.EPSF", creation date:date
"Wednesday, August 8, 2001 3:47:47 pm", modification date:date "Wednesday,
August 8, 2001 3:47:49 pm", icon position:{-1, -1}, visible:true,
size:5.78659E+5, folder:false, alias:false, locked:false, busy
status:false, file creator:"XPR3", file type:"EPSF", short version:"", long
version:""}.

The brackets and everything inside it comprise a record which is the value of "item_info". This record has a "folder" field which is what you trying to access. This gets misinterpreted inside a "Finder" tell block.

This problem can be solved by insuring the above section of code is outside of any tell block (thus avoiding any other potential terminology conflicts) and modifying the line:

move this_item to folder "Ad Report Folder:"

to read:

tell application "Finder" to move item this_item to folder ("Ad Report Folder:" as alias)


2) Once you solve problem 1, you have to deal with what appears to be self-contradictory logic in the above section of code (I think). To the best of my knowledge, the expression "file type of the item_info is "EPSF""cannot be true if the expression "folder of the item_info is true" is true because "this_item" cannot be both a folder and a file. Thus, "this_item" will never be moved to folder "Ad Report Folder:".


Hope this helps.

Neal


Subject: Why doesn't this simple script work?
To: email@hidden
From: email@hidden
Date: Wed, 8 Aug 2001 17:49:01 +0100

When this script encounters a file:


tell application "Finder"
activate
set this_folder to "Daily Pairer 1:DailyDone:"
set these_items to list folder this_folder without invisibles
repeat with i from 1 to the count of these_items
set this_item to alias ((this_folder as text) & (item i of
these_items as text))
set the item_info to info for file (this_item)
if folder of the item_info is true then
if (alias of the item_info is false) and (the file type of
the item_info is "EPSF") then
move this_item to folder "Ad Report Folder:"
end if
end if
end repeat
end tell

I get the error

--> Can't get folder of {name:"IP09.15N.1ST.EPSF", creation date:date
"Wednesday, August 8, 2001 3:47:47 pm", modification date:date "Wednesday,
August 8, 2001 3:47:49 pm", icon position:{-1, -1}, visible:true,
size:5.78659E+5, folder:false, alias:false, locked:false, busy
status:false, file creator:"XPR3", file type:"EPSF", short version:"", long
version:""}.


...which doesn't make sense because it's right there- folder:false. Can
anyone shed some light on this for me?


  • Prev by Date: Re: How do you check the equivalency of references?
  • Next by Date: Compiling Classic osaxen in OS X
  • Previous by thread: Re: Why doesn't this simple script work?
  • Next by thread: Outlook Express scripting question
  • Index(es):
    • Date
    • Thread