Jump to content

Take selected items and move them to a preset folder, Applescript question


Recommended Posts

I'm trying to write a workflow that takes the selected items in Alfred and moves them to a preset folder.

 

My applescript keeps giving me the error "Can’t get POSIX file"

 

Any suggestions would be appreciated.

set filelist to "{query}"
set oldDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to "\t"
set theArray to every text item of filelist
set AppleScript's text item delimiters to oldDelimiters

tell application "Finder"
	repeat with eachitem in theArray
		set a to POSIX file eachitem
		set b to POSIX file "Macintosh HD/Users/USERNAME/Desktop/Temp" as text
		move a to b
	end repeat
end tell

Link to comment

 

I'm trying to write a workflow that takes the selected items in Alfred and moves them to a preset folder.

 

My applescript keeps giving me the error "Can’t get POSIX file"

 

Any suggestions would be appreciated.

set filelist to "{query}"
set oldDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to "\t"
set theArray to every text item of filelist
set AppleScript's text item delimiters to oldDelimiters

tell application "Finder"
	repeat with eachitem in theArray
		set a to POSIX file eachitem
		set b to POSIX file "Macintosh HD/Users/USERNAME/Desktop/Temp" as text
		move a to b
	end repeat
end tell

 

Try this code:

set filelist to “{query}"
set text item delimiters to tab
set theArray to every text item of filelist
set text item delimiters to ""
repeat with eachitem in theArray
	set a to POSIX file (eachitem)
	set b to POSIX file ("/Users/USERNAME/Desktop/Temp")
	tell application "Finder" to move a to b
end repeat
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...