I don’t understand what I’m doing wrong here. I am just trying to set the contents of a folder. It keeps telling me it “can’t get every file of the folder”
set myFolder to ((path to home folder as string) & "Test") as alias
set these_items to files of myFolder
repeat with i from 1 to the count of these_items
set this_item to item i of myFolder
Only the Finder (and System Events) knows, what a file of an alias is, AppleScript doesn’t
set myFolder to ((path to home folder as string) & "Test") as alias
tell application "Finder"
set these_items to files of myFolder
repeat with i from 1 to the count of these_items
set this_item to item i of myFolder
.
end tell
I think I’m doing this wrong and shouldn’t use Finder to set these_items? I am then trying to execute this:
set myFolder to ((path to home folder as string) & "Test") as alias
tell application "Finder"
set these_items to files of myFolder
repeat with i from 1 to the count of these_items
set this_item to item i of myFolder
checkStableSize(this_item)
end repeat
end tell
And keep getting “Finder can’t continue” on the checkStableSize command.
In an application tell block it’s vice versa:
The Finder has no idea, what a handler is, but AppleScript knows
You must use either
checkStableSize(this_item) of me
or
my checkStableSize(this_item)
Hmm. Now I get an error message I completely don’t understand:
Can’t make «class docf» “Movie.mp4” of «class cfol» “Test” of «class cfol» “vtaccess” of «class cfol» “Users” of «class sdsk» of application “Finder” into the expected type.
What does that even mean???
your handler expects an alias not a file specifier
solution:
my checkStableSize(this_item as alias)
or within the handler
on process_item(this_item)
set {name:Nm, name extension:Ex} to info for this_item as alias
.