October 9, 20169 yr I have a simple Applescript that works in Script Editor tell application "Keyboard Maestro Engine" do script "Search the Web" end tell I add this same script (with escape chars) to my RESOURCES::A_SCRIPT field inside FM. The RESOURCES table is not connected to the other tables in the graph. "tell application \"Keyboard Maestro Engine\" do script \"Search the Web\" end tell" I've tried this with this field being defined as a Global Storage Field or not. Similar problems with both. I have an FM Script called EXECUTE: Perform Applescript (RESOURCES::A_SCRIPT) When I run this FM Script I get an error message: "Error: -2741" / "Expected EOL but found Command Name" I've have tried rebooting my Mac. Any ideas?
October 9, 20169 yr If you're using a text field to hold your ApppleScript, then you shouldn't need to escape anything. Just copy-paste the script as is from Script Editor into the field. Do not add quotes, either. Edited October 9, 20169 yr by comment
October 9, 20169 yr Author Doesn't work. I just copied the exact same (working) script from Script Editor into the FM Global Storage Text Field (no escape chars or double quotes). Not accepted. "Specified Field not found" when "Tell Application" is highlighted. Edited October 9, 20169 yr by fm8443
October 9, 20169 yr We are having a communication problem here. There is no way you can get such error when pasting into a text field. You are obviously pasting into a calculation window, but I cannot tell in what context.
October 9, 20169 yr Author Yes - its a calculation window that delivers a text result. Not following how to put this code into a Text field without quotes? Edited October 9, 20169 yr by fm8443
October 9, 20169 yr Author OK I've added this to the FM Script (Native Applescript panel): tell application "Keyboard Maestro Engine" do script "Search the Web" end tell It now works. But how do I remove this code into a FM RESOURCES::A_SCRIPT field and then have it work similarly? (I want to do this to build up to a more complex Applescript with parameters from FM.) I've turned RESOURCES::A_SCRIPT field into a Text field and tried pasting the text of the Applescript into the DATA panel (or the CALC panel) of the Auto-Enter screen. tell application "Keyboard Maestro Engine" do script "Search the Web" end tell I then reference this from the FM Script. Still get the "Error: -2741"
October 9, 20169 yr 1 minute ago, fm8443 said: (I want to do this to build up to a more complex Applescript with parameters from FM.) An example would be useful. In general, you have two choices: 1. Paste the AppleScript into the global field, then select the Calculated AppleScript option and enter a calculation that modifies the text in the global text field to what you want; or: 2. Do the entire calculation within the Perform AppleScript step; this is the only option that requires you to escape the AppleScript - and the escaped version would look like this: "tell application \"Keyboard Maestro Engine\" ¶do script \"Search the Web\" ¶end tell " Of course, this is just the beginning, before you insert the parameters.
October 9, 20169 yr Author 7 minutes ago, comment said: 1. Paste the AppleScript into the global field, then select the Calculated AppleScript option and enter a calculation that modifies the text in the global text field to what you want; Doesn't work for me. Get error as above. Do you men that I should paste the text of the Applescript into the DATA panel of the Auto-Enter screen of my RESOURCES::A_SCRIPT ? tell application "Keyboard Maestro Engine" do script "Search the Web" end tell And then reference this from my FM Script as this? Perform Applescript (RESOURCES::A_SCRIPT) I still get the "Error: -2741"
October 9, 20169 yr 11 minutes ago, fm8443 said: Do you men that I should paste the text of the Applescript into the DATA panel of the Auto-Enter screen of my RESOURCES::A_SCRIPT ? No. You should paste it into the field itself. Place the field onto a layout, enter Browse mode, click into the field and paste. Do not specify any auto-enter options for the field. Edited October 9, 20169 yr by comment
October 9, 20169 yr Author 16 minutes ago, comment said: No. You should paste it into the field itself. Place the field onto a layout, enter Browse mode, click into the field and paste. OK done this on a new global text field. Created clean new FM script as well. Getting error -2741 "Expected EOL but found command name" Also tried your #2 (escape chars etc) and I get no error message/no results!
October 10, 20169 yr Sorry, I don't know for sure what you did. Understand also that I don't have Keyboard Maestro, so I don't know what the expected result is here. I suggest you take a look at this simple demo and see if you can take it from there. SimpleAS.fp7
October 10, 20169 yr Author Thanks for the file. It works as expected. It also works when I copy in my Applescript. The weird thing is that 12 hours later MY script now works with no error message as I repeatedly got last night. I made no changes to it at all! Didn't reboot Mac or restart FM or KM or Safari. My setup looks exactly the same as yours except I run the FM Script from the FM menu (not from a button). Thanks again.
October 10, 20169 yr 14 minutes ago, fm8443 said: The weird thing is that 12 hours later MY script now works with no error message as I repeatedly got last night. I made no changes to it at all! Maybe you have the first computer ever with the caprice feature... Note that once you have finalized your AppleScript, you should move it from the global field and make it a self-contained calculation within the Perform AppleScroipt[] script step. Otherwise you will lose it if you clone your file.
October 10, 20169 yr 1 hour ago, comment said: Maybe you have the first computer ever with the caprice feature... ? As in Clint Dempsey?
October 10, 20169 yr I had Googled 'Caprice feature' to try to understand your reference. All I found was for a Chevy Caprice ( car ) and this: http://www.washingtonpost.com/wp-dyn/content/article/2006/06/04/AR2006060400806.html Clint Dempsey tries different things and some things work so I thought that might be your reference. :-)
October 10, 20169 yr Hmm ... they have "Caprice Is a Feature Of Dempsey's Game" as the headline - but the word caprice is nowhere in the text, so it's hard to tell what they mean. I meant simply that the computer could be acting "weird" because it's capricious. Which is just another way of suggesting that PIBKAC.
Create an account or sign in to comment