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 138 results

  1. I have a very basic question about how script filters work that I haven’t been able to find a direct answer to on this forum or on Alfred’s support page. To be fair, there’s a ton of fantastic information on both, but I simply haven’t found one dumbs its explanation down enough for me to follow it. I've been using Alfred for quite some time, but have never been able to understand much about script filters. In short, I was wondering how to get items from an AppleScript list to show up as JSON formatted items in a script filter’s output (so that I can select one of them, and have it operate like the argument in a subsequent object)? For simplicity, let’s say I have an AppleScript that generates the following list: {"Red", "Green", "Blue”} But, in practice, that list will be dynamically produced and longer. In other words, I can't get away with just manually listing each item in the script filter (like in Alfred's jsonformat workflow example: Getting Started/Script Filter). Based on this example, how do I get the script filter’s output to operate like the following? Item 1 Title: Red SubTitle: Same Words Red Argument: Red Item 2 Title: Green SubTitle: Same Words Green Argument: Green Item 3 Title: Blue SubTitle: Same Words Blue Argument: Blue To illustrate, here’s what the output might look like when created with a list filter: *** @deanishe, I tried following your helpful advice and added a json.scpt file from another workflow that also used this approach. However, I couldn’t quite figure it out. Is there any way that I could talk you - or anyone else - into walking me through this, using the following example? 🙏 Based on the example above, I’ve created a very basic workflow to help illustrate things (for myself and others): Download Workflow. The workflow contains: (1) a script filter and (2) a list filter. The script filter has been stripped down to a single line of code that sets a variable to the afore mentioned list above (set theList to {"Red", "Green", "Blue"}) (AppleScript). In other words, I removed all of my failed attempts, and have only included this line in the AppleScript as a starting point (I understand there’s more to be done here). As for the list filter, it was included to illustrate how I’d like the script filter to perform (i.e., its output). I understand that if the string/list was fixed, that I could always just use it (instead of a script filter). Again, this was added strictly for illustrative purposes. To keep things simple, both filters simply copy their output to the clipboard. So, if you select the “Green” item from Alfred’s output, it would copy the word “Green” to the clipboard. In practice, this would be connected to another object that would do something else with the variable. But this struck me as an easiest way to test things. Can someone help walk me through how to set up the script filter so that it operates like the list filter (using an applescript list of variables)? Thanks in advance for any help you can lend! I really appreciate it.
  2. 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
  3. 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 understand — applescript is a pain, and since each browser implements these functions however they want, finding the best way to do it with each one can be difficult, so here’s the code for most of them. The code for this may seem massive, but it is not. 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 -- Brave tell application "Brave Browser" to return title of active tab of front window tell application "Brave Browser" 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") or (frontApp = "Brave Browser") 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() // Brave Application('Brave Browser').windows[0].activeTab.name() Application('Brave Browser').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', 'Brave Browser'].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 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.
  4. 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.
  5. Search and insert the built in or user created clippings from Alfred 3 in a flash! Download at: http://www.packal.org/workflow/script-debugger-insert-clippings
  6. With the risk of reinventing the wheel, I created a Alfred workflow that move the selected items to a group from a list of predefined (and definable in the config!) groups. The options are: - setting a hotkey (optional) - setting the trigger command (default: dtm (as in devonthink move)) - create your own list of groups sorted in most used or fixed Try it, improve on it and let me know. If there are any questions just post a comment! Download: https://www.dropbox.com/s/8mv5bcwzj8qsach/DEVONthink move item.alfredworkflow?dl=0
  7. iMessage Workflow V3 My workflow has been easily surpassed by others, please use theirs ---------> http://www.alfredfor...red/?hl=unicall However, I'm updating this workflow to Alfred 3 for posterity's sake. Sorry for taking so long guys... Archive Change log: 2/12/2017 - Because of a specific error, I've updated this app. Alongside the minor bug, thanks to Amos Manneschmidt's workflow "Call or SMS contact", I learned how to use OSX's built in Contact app to feed out contacts. Furthermore, I updated this app to be compatible with Alfred 3. 4/30/13 - Non-Latin languages are now supported! I have verified Korean, Chinese, and Japanese. If it works for your language, please tell me! 11/27/13 - My extension prioritizes numbers that have been used before. This should allow Alfred to choose the correct number associated with a contact MUCH more accurately. Works only with phone numbers, not email addresses; A notification is now displayed when contacts are not updated successfully (mostly a response to Exceptions thrown when trying to update) 11/21/13 - Emoticons should now work; Alfred now opens up iMessage if its closed ------------------------------------------------------------------------------------------------------------------------------------------------ If using the OLD way: Setup: Run command 'IMU' before you start using the workflow Find Contacts and Send Messages: Keyword: "im" 1b. Send a message to the aforementioned contact 2. Reply to most recent iMessage or Group Message (Thanks to David Ferguson's Workflow) Keyword: ".." Download Link: https://github.com/NolanChan/iMessageWorkflow/raw/master/iMessage.alfredworkflow Please post up bugs in the comments below!
  8. I am using the 'Play song' from iTunes as a workflow. The debugger shows" I know this is an issue with Mojave and the new 'sandbox' security bubble they put around interacting with the OS; I just don't know how to give it access. Alfred is already enabled in the seurity section. Any thoughts?
  9. I'm wondering if I can run AppleScript/terminal commands automatically in Alfred workflow. is that possible? any ideas?
  10. To make a long story short, I updated a workflow. It has a long action that is done by an Alfred Script object in AppleScript. In certain cases, I want to do some of the work via a python script rather than in AppleScript. To do this I added the following which checks a variable already set and if so tries to run a python script I put in the workflow folder. (The argument passed is encapsulated in quotes) --check if online and if so, use Python. if contents of online is "online" then --run script to put passage onto the clipboard do shell script "python ./get_verse.py \"" + passageRef + "\"" --paste the passage into the current app keystroke "v" using command down else The réponse I'm getting back in Alfred debugging is: [2019-01-16 15:18:30][ERROR: action.script] /Users/samuel/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Scripts/27C48708-2D1A-4008-BCBF-CCABCD6247DC:801:811: execution error: Can’t make "python ./get_verse.py \"" into type number. (-1700) This tells me it's not executing the python script. I'm sure there's something simple here I'm missing but cannot figure out what it is.
  11. 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?
  12. 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.
  13. 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
  14. 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?
  15. 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?
  16. 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?
  17. 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,
  18. 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
  19. 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.
  20. I am using run script in workflow steps. Is there a way to tell the external applescript to write to Alfred's debugger console ?
  21. 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
  22. 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.
  23. 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!
  24. 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
  25. 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?
×
×
  • Create New...