• 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: error -1700
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error -1700


  • Subject: Re: error -1700
  • From: "koenig.yvan" <email@hidden>
  • Date: Sun, 11 Nov 2012 16:09:24 +0100


Le 11/11/2012 à 15:19, Robert Poland <email@hidden> a écrit :


On Nov 11, 2012, at 1:52 AM, "koenig.yvan" <email@hidden> wrote:


Le 11/11/2012 à 00:06, Robert Poland <email@hidden> a écrit :


(1) As always, I recall that info for is deprecated.

That's why I switched to "file information"

I guessed that but you replaced a deprecated function by one which doesn't exist.

Standard Additions dictionary is clear :
info for v : Return information for a file or folder
info for file : an alias or file reference to the file or folder
[size boolean] : Return the size of the file or folder? (default is true)
→ file information : a record containing the information for the specified file or folder
This command is deprecated; use ‘tell application "System Events" to get the properties of …’.
file information n : Reply record for the ‘info for’ command
file information is not a function which we may trigger, it's just the designation of the record returned by info for.



(2) I don't understand why you use a loop to work only upon the second item of the list of names returned by list folder

The "2" was for testing, "i" would normally be used.

OK, now it's clear


(3) Why are you asking list folder to return the name of invisible items as you are skipping this invisible item later ?

(4) To get the pathname of an item we must use path of, not path to which is dedicated by Standard Additions to a well defined list of items.

Recommended change from list.

I don't understand what you wrote.


(5) I don't know which tool is targetted by "file information".

I discovered this error and include it in "Finder"
Thanks for reminding me to move it to "System Events".

As I wrote above, "file information" is not a function, it's the designation of the record returned by info for.
I made the same error several times. The late one was with a feature of TextWrangler ;-(


It's not the Finder , Standard Additions or System Events.

(6) I After correction, path of the_item fails because the_item is a name, noth a reference to a file/folder.

Makes sense.

Here is you script after required changes :

Here's the script after my changes :

tell application "Finder"
activate
set winTarget to target of front window as text
end tell

tell application "System Events"
set the_items to path of disk items of folder winTarget -- by default, System Events see invisibles
repeat with i from 1 to number of items in the the_items
set the_item to item i of the_items
name of disk item the_item
display dialog "" & "the_item = " & the_item & return & return & "this_info = " & result
end repeat
end tell



As you have no real use for the index i, it may be enhanced:

tell application "Finder"
activate
set winTarget to target of front window as text
end tell

tell application "System Events"
set the_items to path of disk items of folder winTarget -- by default, System Events see invisibles
repeat with the_item in the the_items
name of disk item the_item
display dialog "" & "the_item = " & the_item & return & return & "this_info = " & result
end repeat
end tell

As you saw, I took an habit (I don't know if it’s a good one) : when it's possible, un don't use custom variable names but use the property  'result' :

result

When a statement is executed, AppleScript stores the resulting value, if any, in the predefined property result. The value remains there until another statement is executed that generates a value. Until a statement that yields a result is executed, the value of result is undefined. You can examine the result in Script Editor by looking in the Result pane of the script window. 

Yvan KOENIG (VALLAURIS, France) dimanche 11 novembre 2012 16:00:37


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: error -1700
      • From: Robert Poland <email@hidden>
References: 
 >error -1700 (From: Robert Poland <email@hidden>)
 >Re: error -1700 (From: "koenig.yvan" <email@hidden>)
 >Re: error -1700 (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Out of Control Aliases?
  • Next by Date: Re: error -1700
  • Previous by thread: Re: error -1700
  • Next by thread: Re: error -1700
  • Index(es):
    • Date
    • Thread