I am passing a list from Applescript to Keyboard Maestro and need to set variables based on this list.
I am using the %TriggerValue% to set a variable at the beginning of a macro. I will call this variable ‘AppleScriptList’. As an example the list might have two items such as:
Acme Company
/Volumes/ServerName/Folder A/Acme Archive.pdf
How can I assign ‘Acme Company’ to a variable called ‘Company’ and the variable ‘Path’ to the 2nd line of the AppleScriptList?
Sorry if it was not as clear as I thought it was when posting. Here is what is taking place.
I use a program called Hazel to watch a folder for new pdfs. Based on what Hazel finds in the PDFs it runs an applescript that runs a Keyboard Maestro macro. When applescript runs the macro it passes along two lines of text as set in the HazelList applescript variable.
-- theFile is what Hazel passes to this script
-- inputAttributes is a list of other items Hazel is passing to this script
set newFilePath to (the POSIX path of theFile) as text
set HazelList to inputAttributes & return & theFile as text
tell application "Keyboard Maestro Engine"
do script "94453F78-F5C4-4F3A-B79A-866D24087810" with parameter HazelList
end tell
Here is what is being passed to the Keyboard Maestro macro via HazelList:
Acme Company
/Volumes/ServerName/Folder A/Acme Archive.pdf
The image below shows how I am setting the variable HazelList in the first step in Keyboard Maestro based on the passed parameter. My problem is trying to then set two separate variables in Keyboard Maestro based on the first and second line of the variable HazelList.
I want the variable COMPANY to be set to Acme Company
I want the variable FILEPATH to be set to /Volumes/ServerName/Folder A/Acme Archive.pdf