i’m going crazy. i’m using extra suites to get a list of files i searched for. their path ist saved as a string in a list. i need this paths so i can’t use the “returning names”-option.
so i tried this
set fileList to (file search hd1 type “BS01” limiting to 1000) & (file search hd2 type “BS01” limiting to 1000)
set file1 to a reference to file (item 1 of fileList as string)
display dialog (name of (info for file1))
just for proofing that it works. the list isn’t empty so thats not the problem. but i can’t get the name from the file information. apple script stop showing this error:
can’t get name from {name:“testproject”;date:" "…}
doing all by myself wich means to give the same path extracted by the "item 1 of fileList as string directly into the “file1”-definition brings all to work.
is there a fault in my thinking ?
please help - i need a list of filenames of all files of a special kind at my station - and their paths in the background
first i searched for all files of a special kind (find file type “xyz” returning names) and got a list of filenames, choosed one and then again searched for this file (find file name=“abc” type “xyz”) to get its path.
it’s no smart solution but it works somehow.
if someone knows something better: i’m still open
martin
Is your code sample the entire script, or is it a snippet from a larger script?
If it’s a snippet, is this code enclosed in an application ‘tell’ block?
If so, you’re probably running into a namespace conflict where ‘name’ is a command or class within that app and AppleScript is passing the code to the app to handle.
If that’s the case, the fix is simple. just include the variable name in pipes (|name|). AppleScript interprets this as a variable name not an object class and might fix the problem:
thanks for that hint. it doesn`t work with the pipes but it was exactly the problem you mentioned. taking “set filename to name of (info for file1)” out of the tell-block makes it work.