jemostrom Posted August 8, 2014 Share Posted August 8, 2014 I'm new to workflows so apply the usual excuses I want to make a simple workflow where I can select a number of files on the desktop and then press a shortcut to get them into Alfred where I then can launch the actual workflow. I've used a file action which then passes the result to an applescript - since I'm trying to get this to work it looks like this on alfred_script(fileList) display dialog ("Hello " & the number of items in fileList) display dialog (fileList as text) repeat with currentFile in fileList display dialog ("Loop " & currentFile) end repeat end alfred_script I got a bit of a surprise when I selected one file and the script said it was 57 items in there ... but it turned out that the fileList is a string not a list as I thought. Can I in some way get fileList to be a list? Link to comment
jdfwarrior Posted August 8, 2014 Share Posted August 8, 2014 I'm new to workflows so apply the usual excuses I want to make a simple workflow where I can select a number of files on the desktop and then press a shortcut to get them into Alfred where I then can launch the actual workflow. I've used a file action which then passes the result to an applescript - since I'm trying to get this to work it looks like this on alfred_script(fileList) display dialog ("Hello " & the number of items in fileList) display dialog (fileList as text) repeat with currentFile in fileList display dialog ("Loop " & currentFile) end repeat end alfred_script I got a bit of a surprise when I selected one file and the script said it was 57 items in there ... but it turned out that the fileList is a string not a list as I thought. Can I in some way get fileList to be a list? Alfred does indeed pass the list of selected files into workflows as a tab delimited string of paths. You could then just split them by setting the text delimiter to a tab and grabbing all pieces. set input to "{query}" set AppleScript's text item delimiters to " " set input to every text item of input return item 1 of input Something like this.. except you would repeat over input. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now