Jump to content


  • Content Count

  • Joined

  • Last visited

  1. Hi, I'd like to do the following in snippets: {random:You are amazing, thank you, Thank you} i..e "You are amazing, thank you" OR "Thank you" one of the two should be pasted. But how do I escape the comma?
  2. Hi, I want to remove certain entries from my command history. I am okay if I have to remove all command history if I have to. I can't see any way to do this in the app. I am using Alfred 3.3.2 Build 818. Is there a way around this? Thanks
  3. I agree with you. It's not really a solution. But I had to figure out how to do that. To save others time I shared that script. If someone wants to use it can use it. Thanks again
  4. A simple code to get the url of whatever browser the user is in. Note firefox code is hacky at its best. tell application "System Events" set myApp to name of first application process whose frontmost is true if myApp is "Google Chrome" then tell application "Google Chrome" to return URL of active tab of front window else if myApp is "Opera" then tell application "Opera" to return URL of front document else if myApp is "Safari" then tell application "Safari" to return URL of front document else if myApp is "Firefox" then tell application "System Events" keystroke "l" using command down keystroke "c" using command down end tell delay 0.5 return the clipboard else return end if end tell
  5. I created the list first: boom temp Then I added a value like this: boom temp key this is a long string. Now when I do boom temp can't see any values there.
  6. Thanks David. I figured out how to call simple applescripts from Python: from subprocess import Popen, PIPE def run_this_scpt(scpt, args=[]): p = Popen(['osascript', '-'] + args, stdin=PIPE, stdout=PIPE, stderr=PIPE) stdout, stderr = p.communicate(scpt) return stdout #Example of how to run it. run_this_scpt("""tell application "System Events" to keystroke "m" using {command down}""") #Example of how to run with args. run_this_scpt(''' on run {x, y} return x + y end run''', ['2', '2'])
  7. Nope. My bad. Above seems to work for Simulator only when Simulator is not focused for some reason. This works: tell application "System Events" tell process "iPhone Simulator" activate tell menu bar 1 tell menu bar item "Edit" tell menu "Edit" click menu item "Paste Text" end tell end tell end tell end tell end tell
  8. This script does a better job. I had issues with the above. on menu_click(mList) local appName, topMenu, r -- Validate our input if mList's length < 3 then error "Menu list is not long enough" -- Set these variables for clarity and brevity later on set {appName, topMenu} to (items 1 through 2 of mList) set r to (items 3 through (mList's length) of mList) -- This overly-long line calls the menu_recurse function with -- two arguments: r, and a reference to the top-level menu tell application "System Events" to my menu_click_recurse(r, ((process appName)'s ¬ (menu bar 1)'s (menu bar item topMenu)'s (menu topMenu))) end menu_click on menu_click_recurse(mList, parentObject) local f, r -- `f` = first item, `r` = rest of items set f to item 1 of mList if mList's length > 1 then set r to (items 2 through (mList's length) of mList) -- either actually click the menu item, or recurse again tell application "System Events" if mList's length is 1 then click parentObject's menu item f else my menu_click_recurse(r, (parentObject's (menu item f)'s (menu f))) end if end tell end menu_click_recurse tell application "iPhone Simulator" to activate menu_click({"iPhone Simulator", "Edit", "Paste Text"}) The menu selection script is taken from here
  • Create New...