Jump to content

Search the Community

Showing results for tags 'NSAppleScript'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Alfred 3
  • Make the Most of Alfred
    • Discussion & Help
    • Bug Reports
    • Alfred Feature Suggestions
    • Themes
  • Alfred Workflows
    • Submit your Workflows to Alfred Gallery
    • Share your Workflows
    • Workflow Help & Questions
    • Workflow Advanced Tips & Tricks
    • Workflow Automation Tasks
  • Alfred Themes
  • Alfred Remote for iOS
    • Alfred Remote Discussion & Help
    • Remote Connection Troubleshooting


  • Articles
    • Forum Integration
    • Frontpage
  • Pages
  • Miscellaneous
    • Databases
    • Templates
    • Media

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start




Website URL




Found 8 results

  1. What it does is fast change your system appearance to Dark/Light mode. osmode <option> Further details see DarkOrLight on GitHub. Download | Source
  2. This may not be a bug, but it's worth noting: When you use open location to open a URL from inside an NSAppleScript action, it must be in the tell application "System Events" context, otherwise it will fail silently (as of Alfred 2.0.3 on OS X 10.8.3). For instance, to open URL "http://boston.com", you need to use the following: tell application "System Events" to open location "http://boston.com" # fails without `tell application "System Events" to` Note: If an action's sole purpose is to open a URL with the default handler, it is better to use the dedicated Open URL action type instead, which avoids this problem.
  3. Hello. When I use Run Script in my workflows, working directory for script is the workflow directory. It is very convenient. But with NSApplescript working directory is / (root directory). It makes troubles for me. Is there a reliable way to get (into) workflow directory in NSApplescript? Yes, I can hard-code it, but (1) it's awfully long and (2) I'm not sure how Alfred generates its name (can it change in future? will it the same on the other installation?). Thanks for you replies.
  4. Hello! I found an AppleScript that allow to check and uncheck the "Use F1, F2 etc. as standard function keys" in the keyboard prefpane. I check the security preferences and Alfred is check in the accessibility tab. When I run it inside Script Editor it works but when running in alfred workflow editor I get errors. Could somebody help me ? Thanks Jad [INFO: alfred.workflow.trigger.hotkey] Processing output 'alfred.workflow.action.applescript' with arg '' [ERROR: alfred.workflow.action.applescript] { NSAppleScriptErrorAppName = "System Events"; NSAppleScriptErrorBriefMessage = "Can\U2019t get checkbox 1 of tab group 1 of window 1 of process \"System Preferences\". Invalid index."; NSAppleScriptErrorMessage = "System Events got an error: Can\U2019t get checkbox 1 of tab group 1 of window 1 of process \"System Preferences\". Invalid index."; NSAppleScriptErrorNumber = "-1719"; NSAppleScriptErrorRange = "NSRange: {90, 47}"; } Here is the small script in question: tell application "System Events" to tell process "System Preferences" click checkbox 1 of tab group 1 of window 1 end tell quit application "System Preferences"
  5. Hi guys, newbie here. I have trouble passing an argument (usually passed with {query}) to NSAppleScript and I have no idea what I'm doing wrong. I'm trying to make a script that'll grep for me with "grep keyword" in the current finder window folder. However, I'm not able to pass the keyword to NSAppleScript, I'll illustrate on an example: What I type in alfred: "grep test" What I get in Terminal: "grep -inr {query} '/Users/[username_stripped]/Downloads/'" I've tried playing around with it but nothing seems to work, {query} doesn't seem to be evaluated at all. Is this normal behaviour? I've tried googling for a couple of minutes, but no luck. .alfredworkflow: https://www.dropbox.com/s/i3v387z01esrqn4/grep%20finder.alfredworkflow?dl=0 on alfred_script(q) tell application "Finder" set pathList to (quoted form of POSIX path of (folder of the front window as alias)) end tell tell application "System Events" if not (exists (processes where name is "Terminal")) then do shell script "open -a Terminal " & pathList else tell application "Terminal" activate tell application "System Events" to tell process "Terminal.app" to keystroke "t" using command down do script ("grep -inr {query} " & pathList) in first window end tell end if end tell end alfred_script
  6. There are already multiple discussions on Alfred-run Applescript sometimes having a different behaviour than on other places, and in many cases, it seems like nothing can be done about it, since Alfred is not doing anything special with the scripts (which means it may be out of reach for the developers to solve). In this case, however, it’s a case of Alfred apparently having a different implementation in different places. It’s seems more of an oddity than a bug, but there’s no “oddities subforum”. Using the latest builds of both Alfred (2.0.6) and Mountain Lion (10.8.4). The code in question is on alfred_script(q) tell application "System Events" to set isRunning to (name of processes) contains "iTerm" tell application "iTerm" if not isRunning then set _term to (make new terminal) set _term to the first terminal tell _term to set _session to current session else set _term to the first terminal tell _term to set _session to (launch session "Default") end if tell _session to write text q activate end tell end alfred_script What this does is, taking a command as an argument, if iTerm is currently closed, it’ll open a window, and run the command; if it’s open, it’ll open a new tab on the current window, and run the command. If I set this on Run NSApplescript connected to Keyword, in a workflow, or run it from AppleScript Editor, it runs just as intended. However, if I set this as the Custom code for the Terminal / Shell option on the Features tab, it does not — if iTerm is closed, it opens it and a new tab, running the command on this second tab, and if iTerm is already open, it’ll behave as expected. Why is it working differently in these two places? What is it about the Terminal / Shell feature that makes it behave differently (and in a suboptimal manner)?
  7. In the workflow panel it's stated that the NSApplescript action runs on Alfred's main thread and that background Applescripts should be run with the Run Script command. What are the actual implications of that difference? In what situations would you use one over the other?
  8. I created a workflow that uses the keyword 'test' to launch a NSAppleScript process that displays Alfred with the text 'test ' & the entered query, thus allowing a loop. If I hold enter, the loop will continue for several seconds until it finally uses a fallback search (which did not have a query). When I open Alfred again, he looks like this: The workflow was merely a stress test for Alfred; I can't imagine any place this would be an actual issue. There was no Console output. Alfred v2.0 (141) on OS X 10.8.2. Replicated: yes
  • Create New...