Jump to content

Search the Community

Showing results for tags 'applescript'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Alfred 3
  • Make the Most of Alfred
    • Discussion & Help
    • Bug Reports
    • Alfred Feature Suggestions
    • Themes
  • Alfred Workflows
    • Share your Workflows
    • Workflow Help & Questions
  • Alfred v2 Themes
  • Alfred Remote for iOS
    • Alfred Remote Discussion & Help
    • Remote Connection Troubleshooting

Categories

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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Twitter


Website URL


Jabber


Location


Interests

Found 132 results

  1. Hi forum. I recently purchased the Alfred PowerPack and am looking forward to leveraging its power. I've added a few custom workflows that are triggered by hotkeys which run some NSAppleScripts. I'd like to do the same for a few more, but triggered automatically at a specific time each week (e.g. "every Friday @ 6pm"). I don't see a workflow object that is triggered by date or time. Is this possible in Alfred?
  2. 2015-09-17: Major update to version 2 Alfred AppScripts Workflow List, search and run/open AppleScripts for the active application. Download The workflow can be downloaded from GitHub or Packal. The source code is also available on GitHub. Usage .as [<query>] — Show/search list of AppleScripts for the active application ↩ — Run the selected script. ⌘+↩ — Open the selected script in Script Editor. ⌥+↩ — Reveal the selected script in Finder. appscripts [<query>] — Show workflow configuration. Help – Open this file in your browser. (No) Update Available — Whether or not the workflow can be updated. Action the item to update or force an update check. Search Directories Recursively – Whether the script directories should be searched recursively. Use with some caution. Edit Script Directories — Open the configuration file in your default editor. The file contains a detailed description of how it works. Reset to Defaults — Delete configuration and cache files. Where are these scripts? The workflow comes with a default set of directories. These are defined in a settings file that you can edit yourself. Use the Edit Script Directories option in the configuration (keyword appscripts) to open the file in your editor. These are the default directories. {app_name} will be replaced with the name of the currently active application, e.g. BBEdit or OmniFocus, and {bundle_id} with the application's bundle ID, e.g. com.barebones.bbedit or com.omnigroup.OmniFocus2: ~/Library/Scripts/Applications/{app_name} ~/Library/Scripts/Applications/{bundle_id} ~/Library/Application Scripts/{app_name} ~/Library/Application Scripts/{bundle_id} ~/Library/Application Support/{app_name}/Scripts ~/Library/Application Support/{bundle_id}/Scripts ~/Library/Containers/{bundle_id}/Data/Library/Application Support/{app_name}/Scripts Any .scpt, .applescript or *.scptd (script bundle) files found within the above directories will be shown. If you add a directory path that doesn't contain {app_name} or {bundle_id}, it will match every application and the scripts will always be shown. See the settings file (AppScript Directories.txt) for more information. Licence, thanks The workflow code and the bundled Alfred-Workflow and docopt libraries are all licensed under the MIT Licence. The workflow icon was kindly donated by @Jono.
  3. Custom Terminal AppleScripts to Integrate iTerm and Alfred iTerm version 3 beta: The iTerm 3 beta version is the same version we have had for quite some time, which is also known as 2.9. Therefore the v2.9 branch of the script will work just fine with the v3 (aka 2.9) beta and v3 when it is released (any major changes to iTerm's applescript not withstanding). In a blog post released recently (19th August 2015) Vero (Alfred's Mum ) has announced that as of the next version of Alfred, these custom terminal scripts will be the available mechanism for integrating Alfred and iTerm: "With the upcoming release of Alfred 2.7.2, the default iTerm integration has been replaced by the "Custom" scripts option. This allows for a more up-to-date and more flexible way to handle the iTerm integration, using scripts created by one of our fantastic users, Stuart Ryan." I would like to thank Vítor for helping to clean up the applescripts and submitting some great pull requests . There are two versions of the script available: iTerm 2 Branch (tested up to 2.1.1) - view the v2.1 script on Github - updated December 14, 2015 iTerm 2.9 Branch (tested up to 2.9.20150626) - view the v2.9 script on Github - Updated December 14, 2015 Each of these can be inserted into Alfred by following these steps: Load the Alfred control panel Click the Features Button/Tab Click on the "Terminal/Shell" menu on the left hand side Select "Custom" under application, and replace the text in the new box that appears with the code as per the version of iTerm you are running. Alternatively, check out the official YouTube video on how to set them up: iTerm 2.1 Branch Custom Terminal Script Features: The 2.1 branch script is very basic and just corrects the opening of iTerm and creating a new session properly. Change Log: V0.4 Release - Vítor's submitted pull request for simplifying the check for if iTerm is already running. - December 14, 2015 (apologies for the delay in merging) V0.3 Release - Added version number and Vítor has done some great work standardising the scripts. No functionality changes in this release - August 14, 2015 Remove Trailing Whitespace (Vítor Galvão) - August 10, 2015 Initial Release - July 31, 2015 iTerm 2.9 Branch Custom Terminal Script Features: The 2.9 Branch goes a bit further to utilise some of the new features of iTerm 2.9 (which is in beta at the moment and can be downloaded if you are feeling adventurous from the iTerm download page). The script has been designed to achieve the following: Open the correct iTerm binary under /Applications/iTerm.app regardless of if another iterm/iTerm binary exists on the system Always create a new tab/session, unless iTerm is not running, in which case use the default session. If the user has selected to not create a default session on iTerm startup, detect and create a default session. Change Log V0.6 Release - Vítor's submitted pull request for simplifying the check for if iTerm is already running. - December 14, 2015 (apologies for the delay in merging) V0.5 Release - Added version number and Vítor has done some great work standardising the scripts. No functionality changes in this release - August 14, 2015 Removed bug introduced in last update (quotes around parameter) - August 12, 2015 Fix Whitespace (Vítor Galvão) + Fixed Search for iTerm/iTerm 2 Running (Stuart Ryan) - August 10, 2015 Updated to Fix Multiple iTerm Binaries - August 6, 2015 Initial Release - July 31, 2015 Donations If you love the scripts, and get use out of them every day, if you would like to donate as a thank you to buy me more caffeine giving Diet Coke, some Cake, or to put towards a shiny new gadget you can donate to me via Paypal. Future Updates: As new versions come out of the 2.9 branch I will keep the scripts up to date, if anyone finds issues with the 2.1 branch please let me know and I will test things out. If there are any changes to the scripts, I will post an update in this thread to let everyone know. If you would like to look at/contribute to the official repository please check it out on Github --> https://github.com/stuartcryan/custom-iterm-applescripts-for-alfred. As always, I welcome ideas/thoughts/feedback etc. Cheers, Stuart
  4. Hey I'm trying to make an AppleScript to be run from Alfred, that should quickly set a specified speaker as audio output device if it is currently connected (in example below "My Awesome Speaker"), and otherwise don't do anything. I have gotten most of the functionality down (toggling between speaker/internal speaker), but I'm having a problem in the instance that the speaker isn't connected. When this is the case, the script has already clicked on the audioMenu, making the dropdown be there until a mouse click. I thought I could make it go away by branching with an "if else" and then if the speaker isn't connected, then just clicking the audioMenu again (because I've seen similar behaviour (with succes) for other menu bar scripts). But if I instead do this, the audio dropdown will still be staying until a click has been made, and then the script clicks the audio icon again making it doubly annoying. on alfred_script(q) set speakerName to "My Awesome Speaker" set internalSpeakers to "Internal Speakers" activate application "SystemUIServer" tell application "System Events" tell process "SystemUIServer" -- Working CONNECT Script. Goes through the following: -- Clicks on Audio Menu (OSX Top Menu Bar) -- Clicks your speaker if not connected -- Else if connected, then disconnects by clicking Internal Speakers set audioMenu to menu bar item 4 of menu bar 1 tell audioMenu click if exists menu item speakerName of menu 1 then set speakerMenuItem to menu item speakerName of menu 1 if value of attribute "AXMenuItemMarkChar" of speakerMenuItem is "✓" then click menu item internalSpeakers of menu 1 return "Disconnecting from " & speakerName & "..." else click speakerMenuItem return "Connecting to " & speakerName & "..." end if else -- Doesn't work for now. Just clicks it again after you deselect menu, making it double annoying --click audioMenu return "Doesn't look like you're connected to " & speakerName & "..." end if end tell end tell end tell end alfred_script How can I fix this, so the dropdown actually goes away if speaker is not connected?
  5. cubb

    Bluetooth Toggle

    Does just what it says on the tin: toggles Bluetooth on or off depending on the current state. It's built to work with OS X Yosemite and Yosemite alone. To use, just type bt and press enter. If Bluetooth is on, it will be turned off. If Bluetooth is off, it will be turned on. The original AppleScript was written by fartheraway in response to a question on StackExchange. I just packaged it and gave it a simple icon that will work equally well on dark and light themes. Known shortcomings: - Current state (on or off) not shown - New state not shown/notified Download “Bluetooth Toggle” workflow (via CloudApp) Packal
  6. Hi, I have a simple workflow I’m to toggle the new Mac OS Mojave Dark Mode on and off. Create a new workflow with a keyword trigger e.g. “dark”. Set up an action to run an Apple Script: tell application “System Events” tell appearance preferences set dark mode to not dark mode end tell end tell end alfred_script However, what I’d like to do is customise the script to also toggle Aldred's appearance from "Alfred macOS" to "Alfred macOs Dark" if dark mode is enabled and then switch back to "Alfred macOS" when disabled. And if anyone knows how I'd love to customise the script to toggle from the dynamic Mojave desktop to the dark version as well. Any ideas on how I could do this?
  7. Update: The MWE workflow can be found here. tldr; Needed help using appplescrip to edit string, I know how to do in python. (The required workflow is working help needed to make it better.) I was writing an Alfred Workflow to render ipython notebooks `.ipynb` files nicely using nbviewer of github. For that we need to use the website: https://nbviewer.jupyter.org For example to render a ipynb file: https://github.com/bhishanpdl/pdl_practice/blob/master/a.ipynb We need to open https://nbviewer.jupyter.org and paste the above notebook url there. i.e. From: https://github.com/bhishanpdl/pdl_practice/blob/master/a.ipynb To: https://nbviewer.jupyter.org/github/bhishanpdl/pdl_practice/blob/master/a.ipynb Then, we just need to open the new url in safari. ---------- I did following: - applescrip to find frontmost tab url and copy to clipboard - edit the url using python - again use applescript to open edited url This seems to be bit of too much of a work. Is there way it can be done in only one applescript. The only thing I don't know is how to edit the string in applescript. I am only comfortable working with python and use it for most of the work. The codes used are following: # First applescript tell application "Safari" ignoring case set theURL to URL of front document set the clipboard to theURL end ignoring end tell # Second python script to edit url import sys query = sys.argv[1] query = 'https://nbviewer.jupyter.org/github'+ query.split(r'github.com')[1] sys.stdout.write(query) """ From: https://github.com/bhishanpdl/pdl_practice/blob/master/a.ipynb To : https://nbviewer.jupyter.org/github/bhishanpdl/pdl_practice/blob/master/a.ipynb """ # Last applescript to open url on alfred_script(q) set theURL to the clipboard tell application "Safari" open location theURL activate end tell end alfred_script How can all these codes can be written in only one applescript?
  8. I am trying to write an workflow that will do following things in github page: - go to the bottom of the page - click commit button The main thing is whenever we are editing a file in github online to commit the chages we have to go to the bottom of the page and click "Commit changes" button. The github does not have that button on the top of the webpage and also does not have keyboard shortcut to do that. Commiting and Pushing edited files from a terminal is pretty simple a simple bash function in `bash_profile` will do that easily, but while working on online pages, we need to scroll down each time if we need to commit the changes. It will not save a heavy amount of time but if it is possible, the Alfred workflow to do it worth it. Thanks.
  9. Good Morning Alfred App Dev's, I look up MAC addresses hundreds of times a week at work. Can anyone help/create me a workflow where I can quickly lookup the Mac address to see what manufacture router a customer has. Kind Regards,
  10. Hey, I've been trying to convert this launchbar script into an Alfred Workflow. The script is meant to take the current selection of Alfred, and activate the window behind, open the "Go To Folder" dialogue, paste in the path and press enter. I got it working in the AppleScript Editor, but for some reason I can't get it to perform on through Alfred. It even opens up the "Go To Folder" dialogue but stops there each time. Do you guys have any ideas? on alfred_script(q) set filePath to POSIX file of q tell application "System Events" set theApplication to application processes whose frontmost is true set target to item 1 of theApplication set target to a reference to front window of target set target to a reference to front sheet of target delay 0.5 tell target to keystroke "g" using {command down, shift down} -- Activate goto field tell target try set value of text field 1 to filePath delay 0.5 key code 36 -- simulate pressing the Enter key end try end tell end tell end alfred_script
  11. I'm just getting started with creating my own workflows and I have a couple questions I haven't found the answers for yet after a bunch of searching, reading and testing. A quick note to begin with, I'm writing this partially as an exercise to improve me proficiency with AppleScript, as frequently painful as it is. It does seem like a good workflow to use it for since its functionality is almost entirely reading information from and sending commands to the iTunes AppleScript Dictionary. JXA is a little further down the to-learn list. 1. What is the proper way (if there is one) to get Alfred's workflow environment variables into an AppleScript file? Right now I'm using the Script Filter to issue the Bash command osascript *file*, I can append a variable to it like "alfred_workflow_data" and read it as an argv or use (do shell script "pwd") to get the workflow path but I haven't found a way to access all of the variables directly. I'm open to ultimately running it as a usr/bin/osascript if that's the best solution, but it's nice to just run the script from my code editor rather than copying and pasting it every time I want to test a change. I have read the pinned post on using environment variables but I'm not sure how to apply it in this context. 2. It looks like the best practice is to use alfred_workflow_data and alfred_workflow_cache where possible but is it appropriate to use the workflow folder for things like included icons or should I be creating a data directory, copying the files there and then using that location when setting icons in a Script Filter? Given that there doesn't appear to be a provided environment variable for the workflow folder path I wasn't sure if that was to discourage using that in the workflow or because it's trivial to determine that path another way. 3. I have a couple of different icons I'm using for different workflow components so I don't want them all to inherit the workflow icon but I also use some of the same icons for multiple trigger objects. If I assign them the same icon I get duplicate *iud*.png files, is there a way to set the path for the icon programmatically so I can set a single image to multiple objects? 4. Along similar lines, does Alfred allow you to use any vector formats for icons? It doesn't seem to accept SVG and it converts vector PDFs to PNG images but I know that some of Alfred's internal workflows use vector code for icons so I thought it was worth asking. If not, is 512px the appropriate resolution? I've seen 128px referenced in older threads but that seems pretty small for uses like icons in the iOS remote app for devices like retina iPads. 5. Finally, is there a good way to assign multiple keywords to the same action? I'd like to trigger my script filter with both itunes and love and I had hoped that using a Keyword object as the input to a script filter would do it but while it still lets me trigger the action object I've linked the script filter to the script filter functionality doesn't work. I've also tried adding an Arg and Vars utility to overwrite the query to the keyword for the Script Filter but I get the same result. I can just duplicate the Script Filter with a different keyword but am trying not to repeat an identical function if I don't need to. Thanks for any help, I really appreciate you taking the time to read over this. The workflow in its current state can be found on GitHub. Alfred 3.6.2 [921] macOS 10.13.5 (17F77) I've customized a lot of my macOS environment but I don't think anything that would affect AppleScript and likely not anything that would affect running osascript commands from /bin/bash.
  12. I am using run script in workflow steps. Is there a way to tell the external applescript to write to Alfred's debugger console ?
  13. I’ve been seeing a lot of workflows that need to interact with a browser via AppleScript (usually to get a page’s url), but most of them seem to settle on a single browser (usually Safari), which is a shame. I can certainly understand — applescript is a pain, and since each browser implements this functions however they want, finding the best way to do it with each one can be difficult, so here’s the code for some of them. The code for this might seem massive, but is actually short. Read the comments to understand when to use what. You can find the latest version of this as a gist. -- AppleScript -- -- This example is meant as a simple starting point to show how to get the information in the simplest available way. -- Keep in mind that when asking for a `return` after another, only the first one will be output. -- This method is as good as its JXA counterpart. -- Google Chrome tell application "Google Chrome" to return title of active tab of front window tell application "Google Chrome" to return URL of active tab of front window -- Google Chrome Canary tell application "Google Chrome Canary" to return title of active tab of front window tell application "Google Chrome Canary" to return URL of active tab of front window -- Chromium tell application "Chromium" to return title of active tab of front window tell application "Chromium" to return URL of active tab of front window -- Opera tell application "Opera" to return title of active tab of front window tell application "Opera" to return URL of active tab of front window -- Vivaldi tell application "Vivaldi" to return title of active tab of front window tell application "Vivaldi" to return URL of active tab of front window -- Safari tell application "Safari" to return name of front document tell application "Safari" to return URL of front document -- Safari Technology Preview tell application "Safari Technology Preview" to return name of front document tell application "Safari Technology Preview" to return URL of front document -- Webkit tell application "Webkit" to return name of front document tell application "Webkit" to return URL of front document -- This example will return both the title and URL for the frontmost tab of the active browser, separated by a newline. -- Keep in mind that to be able to use a variable in `tell application` — via `using terms from` — we’re basically requiring that referenced browser to be available on the system. -- That means that to use this on "Google Chrome Canary" or "Chromium", "Google Chrome" needs to be installed. Same for other browsers. -- This method also does not exit with a non-zero exit status when the frontmost application is not a supported browser. -- For the aforementioned reasons, this method is inferior to its JXA counterpart. tell application "System Events" to set frontApp to name of first process whose frontmost is true if (frontApp = "Google Chrome") or (frontApp = "Google Chrome Canary") or (frontApp = "Chromium") or (frontApp = "Opera") or (frontApp = "Vivaldi") then using terms from application "Google Chrome" tell application frontApp to set currentTabTitle to title of active tab of front window tell application frontApp to set currentTabUrl to URL of active tab of front window end using terms from else if (frontApp = "Safari") or (frontApp = "Safari Technology Preview") or (frontApp = "Webkit") then using terms from application "Safari" tell application frontApp to set currentTabTitle to name of front document tell application frontApp to set currentTabUrl to URL of front document end using terms from else return "You need a supported browser as your frontmost app" end if return currentTabUrl & "\n" & currentTabTitle // JavaScript for Automation (JXA) // // This example is meant as a simple starting point to show how to get the information in the simplest available way. // Keep in mind that when asking for a value after another, only the last one one will be output. // This method is as good as its AppleScript counterpart. // Google Chrome Application('Google Chrome').windows[0].activeTab.name() Application('Google Chrome').windows[0].activeTab.url() // Google Chrome Canary Application('Google Chrome Canary').windows[0].activeTab.name() Application('Google Chrome Canary').windows[0].activeTab.url() // Chromium Application('Chromium').windows[0].activeTab.name() Application('Chromium').windows[0].activeTab.url() // Opera Application('Opera').windows[0].activeTab.name() Application('Opera').windows[0].activeTab.url() // Vivaldi Application('Vivaldi').windows[0].activeTab.name() Application('Vivaldi').windows[0].activeTab.url() // Safari Application('Safari').documents[0].name() Application('Safari').documents[0].url() // Safari Technology Preview Application('Safari Technology Preview').documents[0].name() Application('Safari Technology Preview').documents[0].url() // Webkit Application('Webkit').documents[0].name() Application('Webkit').documents[0].url() // This example will return both the title and URL for the frontmost tab of the active browser, separated by a newline. // This method is superior to its AppleScript counterpart. It does not need a "main" browser available on the system to reuse the command on similar ones and throws a proper error code on failure. const frontmost_app_name = Application('System Events').applicationProcesses.where({ frontmost: true }).name()[0] const frontmost_app = Application(frontmost_app_name) if (['Google Chrome','Google Chrome Canary','Chromium','Opera','Vivaldi'].indexOf(frontmost_app_name) > -1) { var current_tab_title = frontmost_app.windows[0].activeTab.name() var current_tab_url = frontmost_app.windows[0].activeTab.url() } else if (['Safari','Safari Technology Preview','Webkit'].indexOf(frontmost_app_name) > -1) { var current_tab_title = frontmost_app.documents[0].name() var current_tab_url = frontmost_app.documents[0].url() } else { throw new Error('You need a supported browser as your frontmost app') } console.log(current_tab_url + '\n' + current_tab_title) Other browsers Camino Used to be present (see revisions) but the browser itself was discontinued. Firefox Absent since although it’s possible to get the window’s title, it’s not possible to get its URL (it used to be, before version 3.6). It’s possible via hacky ways that consist of sending keystrokes, but those can be unreliable. This bug is being tracked in Bugzilla.
  14. Here's what I'm trying to do: I frequently capture information and store it in Ulysses for research on writing projects. I typically copy/paste it into Ulysses in the appropriate group. I created a workflow to automate this via Alfred. The workflow takes the contents of the clipboard and passes it to an Openurl to use Ulysses x-callback-url to add a new sheet. So far, so good. Frequently I copy/paste content that is online, and I want to keep the url of the content for later research. In order to automate this as much as possible, I used clipboard history. I copy the url, then copy the content, then insert it into Ulysses. In order to automate this completely, I modified my workflow so that it checks the chipboard history and if {clipboard:1} is a url, it combines that url with the content on the current clipboard and then passes it to Ulysses. I used an AppleScript to do this by storing the clipboard and previous item from clipboard history into a variable, loading those variables in AppleScript and then creating a new string. Here's the problem: when I do this something is wrong with the encoding of the string and I get strange characters in it. For example, apostrophes become Äô. Text passed through the workflow fine until I added this AppleScript. I don't know if the problem is when the AppleScript loads the variables using system attribute or if the problem is when it returns the string. I've included the AppleScript below to show what is does. Does anyone know how to get the AppleScript to encode the text properly? I tried using Run NSApplescript instead. It seems to properly encode the text, but the problem is that I cannot find a way to pass the clipboard contents since it doesn't read workflow variables and as far as I know, can't access the clipboard history. If an NSApplescript action could access the clipboard that would be an ideal solution. on run argv set theQuery to item 1 of argv set cbCurrent to (system attribute "cb_current") set cbPast to (system attribute "cb_past") set httpPrefix to "http" set newQuery to theQuery if cbPast starts with httpPrefix then set newQuery to theQuery & "\n" & "%% Source: " & cbPast & "\n" & cbCurrent else set newQuery to theQuery & "\n" & cbCurrent end if return newQuery end run
  15. I have an AppleScript Script(?) that accepts registration requests by opening up an e-mail and clicking around in a browser. I'd love for this to be able to run without my personal computers requiring an internet connection. Would I be able to set up an Alfred workflow with Zapier to run this script on a cloud computer when gmail receives the registration request? Thanks.
  16. Thanks in advance for the help! I'm trying to pass two (or multiple) variables to AppleScript. For example, “keyword query1 query2” and then get both arguments into AppleScript. Or something like “keyword query1^query2” and then split them. I feel like I’m almost there, but missing something… I guess I should add that I’m using Alfred 3.5.1 with Powerpack. I read this article: but my dumb brain couldn’t figure it out… Any help would be greatly appreciated. My use case for this particular workflow is AppleScipt, but I'd be interested in knowing how to do the same thing with a bash script or something like that. Thanks!
  17. Just an updated version of Marc Abramowitz's Append to nvALT journal extension to work for Alfred v2. Marc's description... More on nvALT → http://brettterpstra.com/projects/nvalt/ Download extension here → http://jrhd.me/MDZN
  18. I want to use Alfred notification for displaying data that I got using AppleScript. So the workflow basically gathers an information using an AppleScript, returns that information back to Alfred wich should display a notification and then the AppleScript should continue or another AppleScript should start, which should get the variables of the first AppleScript. The reason for this is that I cannot figure out how to use custom icons in notifications within AppleScript. I wanted to use Alfred for this, since I can configure notifications how I want. So the goal is to return information from an AppleScript back to Alfred, Alfred is displaying those information and continues the AppleScript. Is this possible?
  19. I've been using the apple reminders app to keep track of a lot of tidbits of info organized into a handful of lists (e.g., Recommendations, To-do, Jokes), and it would be awesome to have a way of skipping straight to a specific list by typing into Alfred, rather than opening reminders, then clicking on the list (hardly difficult I know, but Alfred has me spoiled on speed everywhere else). Thanks for your time - Alex
  20. Apologies for what is a pretty basic question for most people in this forum, but does anybody know how to click a menu item that contains quotation marks? More specifically, in the Mail app, I would like to take one of my mailboxes offline (as opposed to taking them all offline). However, the menu items include quotation marks around the name of each mailbox. For example, from the menu's hierarchy, the menu might look something like the following: Mailbox Online Status Take "GMAIL" Offline Take "AOL" Offline Take "Hotmail" Offline Take "Prodigy" Offline Under this setup, what should my applescript look like if I wanted to click the GMAIL option? I've tried the following code below, but it doesn't work. if application "Mail" is running then activate application "Mail" tell application "System Events" tell process "Mail" click menu item "Take \"GMAIL\" Offline" of menu 1 of menu item "Online Status" of menu 1 of menu bar item "Mailbox" of menu bar 1 end tell end tell else display notification "To take a mailbox offline, Mail must be open." with title "Mail - Not Open" end if I suspect I screwed up how to deal with quotation marks in the string, but I can't seem to figure it out. I've tried adding more slashes and moving them around, but I haven't had any luck. I'm a newbie, so thanks for any help you can lend!!
  21. I have an AppleScript that allows the user to select a file from Finder. I want to pass that file to another script so that I can do some processing with it. So far, I haven't been able to complete this, though. This is what I have so far: AppleScript: on alfred_script(q) set apk to choose file with prompt "Select an APK to install:" of type {"apk"} return apk end alfred_script After this script runs, a bash script is started that just tries to print out the variable: query="{query}" echo -n $query This does not work, though. Can anyone tell me what to do to get the file passed from the AppleScript to the bash script? Thanks!
  22. bridgestew

    Question from a n00b

    This is my first attempt at creating a workflow for myself. It combines elements of two existing AppleScripts in order to provide me what I am after. The scripts run fine for me straight out of OmniFocus or from the Script Editor. Trying to use them with Alfred and it doesn't work. I don't know why and I have been scouring teh Googlez for quite some time trying to see if I can figure it out to no avail. If I paste the tasks2boss script in Alfred directly nothing happens. Could it be because this script is calling another script from within it? If I try to use this script as an external script and run the workflow, I get the following error I have set the permissions for both script files to 755. That's really all I knew to do. If there is something more that needs to happen, I don't know where to look. I have the script files in a Github repo located here, if that is useful: https://github.com/bridgestew/workflow-scripts I suspect it is bad scripting on my part. Like I said, I"m new at this stuff. Any help or pointers appreciated. Thanks!
  23. I want to update a directory on my Raspberry PI and I want to use scp for this. I've got a keyword which initiates a Run NSAppleScript action. This applescript launches Terminal and it should enter a command. But it won't open Terminal. on alfred_script(q) tell application "Terminal" do script "scp -r /path/to/folder pi@192.178.168.20:/var/www" activate end tell end alfred_script This Applescript action works flawlessly when used with a normal ssh command like "ssh user@server.com". But it does not work with scp. Any ideas?
  24. Hi guys, I wrote a little AppleScript that copies and pastes a text selection to the Alfred bar with a certain prefix: see below. The thing is, when I select text, and run the .scpt file from the Alfred bar (i.e. I look up the file and press enter) it works fine, but when I try to link this script to an Alfred keyword or hotkey, it stops working. I tried these three methods: I simply copied the content of the .scpt file into an Alfred workflow (actions --> RunNSAppleScript). Doesn't work. I wrote a bash script calling the .scpt file and attached it to the action "run script". Doesn't work. I used the action "open file" and attached the .scpt file to it. Doesn't work. It's not that these three methods don't do anything. In fact weird things happen. The text selection expands to adjacent words for example. Or I hear the "beep" of the mac "alert sound". I also sometimes seems as if the delay of 0.5 does not work. Its' not such a big deal. I can run the script by simply launching it by searching the file in the Alfred bar, but I'm still generally curious what is going on here. Any ideas?
  25. Hi guys, wondering if anyone has a clue about what changed with applescripts and accessibility in macOS Sierra. Since upgrading to Sierra, it seems all of my workflows that use applescript no longer work. This is not exclusive to Alfred; I have tried running multiple scripts in Script Editor, and Script Editor ends up hanging on run. In Alfred 3, no information shows in debug. Calling a workflow will just cause Alfred to stop responding. Console does not show any Event errors in Alfred or Script Editor. I haven't been able to find similar issues with other people in google searches or in this forum. I have received some OS messages that I think may be involved as I've tried to run applescripts in both Alfred 3 and Script Editor (shown below). They seem to come up sporadically, and after a delay of running a script. I know it has been necessary to add SystemUIServer.app to Accessibility in System Preferences > Security & Privacy in past versions of Alfred and OS X in order to run certain workflows with applescripts. Since upgrading to Sierra, I am seeing a similar requirement. Adding /System/Library/CoreServices/SystemUIServer.app to Accessibility and checking it does not fix the issue. Any clues to what may be going on is much appreciated :). EDIT: I think it has something to do with "System Events." It looks like applecripts work until they come to tell application "System Events" I have tried adding /System/Library/CoreServices/System Events.app to Accessibility, a shot in the dark; that didn't help either.
×