Jump to content

Search the Community

Showing results for tags 'script'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Blogs

There are no results to display.

Categories

There are no results to display.

Calendars

There are no results to display.

Forums

  • Alfred 3
  • Make the Most of Alfred
    • Discussion & Help
    • Bug Reports
    • Alfred Feature Suggestions
    • Themes
  • Alfred Workflows
    • 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

Categories

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

Categories

  • New Features
  • Other

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Twitter


Location


Interests

  1. I want to make a simple script filter that is triggered on my keyword "vs" and searches a specific folder ONLY and also EXCLUDES folders that match a certain path. - It should ONLY search in "/Developer/Repositories/" - It should only show folders in results, not files - It should exclude any or folders that have "node_modules" in the path - The result I select should be opened in "Visual Studio Code.app" For example, if I type "vs project", it should find "/Developer/Repositories/project" but exclude "/Developer/Repositories/other/node_modules/project" I was able to get all of this except the exclusion rule working by using a file filter with the keyword "vs" and even open in "Visual Studio Code.app". I cannot figure out how to exclude files with "node_modules" in their path Here's what I have so far Here is the script which I found on GitHub (https://github.com/alexchantastic/alfred-open-with-vscode-workflow/tree/master) It opens the result in "Visual Studio Code.app" on run set theQuery to "{query}" set finderSelection to "" set theTarget to "" set defaultTarget to (path to home folder as alias) -- comment line above and uncomment line below to open desktop instead of user home when there's no selection or open folder in the Finder: -- set defaultTarget to (path to desktop folder as alias) if theQuery is "p" then tell application "Finder" set finderSelection to (get selection) if length of finderSelection is greater than 0 then set theTarget to finderSelection else try set theTarget to (folder of the front window as alias) on error set theTarget to defaultTarget end try end if tell application "Visual Studio Code" open theTarget as alias end tell end tell else try set targets to {} set oldDelimiters to text item delimiters set text item delimiters to tab set qArray to every text item of theQuery set text item delimiters to oldDelimiters repeat with atarget in qArray if atarget starts with "~" then set userHome to POSIX path of (path to home folder) if userHome ends with "/" then set userHome to characters 1 thru -2 of userHome as string end if try set atarget to userHome & characters 2 thru -1 of atarget as string on error set atarget to userHome end try end if set targetAlias to ((POSIX file atarget) as alias) set targets to targets & targetAlias end repeat set theTarget to targets tell application "Visual Studio Code" open theTarget end tell on error return (atarget as string) & " is not a valid file or folder path." end try end if return theQuery end run
  2. It would be useful to be able to do a javascript script on a number or clipboard when you type a snippet. For example "Encode" would give me : function () { return Math.floor({clipboard:0} +1145 * 16 / 4145) } and what it returns it will paste as a snippet. Alternatively maybe allow GET requests to do these things.
  3. Sorry for the very basic question, I am testing the script just by entering the following command in the Run Script window: networksetup -setairportnetwork en0 SSID "password" When I run it, I get: ERROR: Keyword to Script\[Run Script\] /bin/bash: -c: line 0: unexpected EOF while looking for matching \`"'/bin/bash: -c: line 1: syntax error: unexpected end of file Any help will be appreciated, I get the same message un Automator, I tested the command in Terminal and worked fine. Thanks
  4. Would be a great help when it comes to debugging. Something like this:
  5. Hi, I try to build a workflow which helps me creating Jira tickets. To do so, I want to start with a list filter – activated by a keyword. The list filter contains entries where the argument value is the same as a snippet keyword. Using a snippet trigger doesn't serve my purpose as I want to select a snippet from the Alfred snippets. How can I achieve my goal? 🤔 Thanks in advance Sören
  6. Hey, this has been addressed a few times but being something of a simpleton that's making it up as he goes along I haven't been able to find an answer that I understand. I'm trying to create a workflow that will run a python command that deletes all messages from bots in a Slack channel. To do this I've installed 'slack-cleaner' through Python, and it works fine within Terminal. The problem is that when I try to run that in a script in an Alfred workflow, it says "line 1: slack-cleaner: command not found". I looked through a few posts on here and found a response from @deanishe that suggested I need to install the slack-cleaner library into my workflow. So, I right-clicked the workflow, opened in terminal and used the command he suggested in this other thread which was pip3 install --target . slack-cleaner. That seemed to work as I was then able to see the library in my workflow, but it still says it can't find the slack-cleaner command when I run it. I am very mildly knowledgeable, verging on idiocy so it's very likely I have no idea what I'm doing and haven't understood the suggestions correctly, but any advice would be greatly appreciated. Thanks! If it helps, the code I'm trying to run is below, with essential info redacted. slack-cleaner --token <TOKEN> --message --group <GROUPNAME> --bot --perform --as_user
  7. So I recently installed a community workspace for Alfred and I see it's passing a query to a Python script - which brings me to my question. Where can I see the source of this script?
  8. Hi all, I'm trying to run a node.js script with Alfred, using this workaround: http://remy.bach.me.uk/blog/2014/03/writing-alfred-workflows-in-node/ It seems to work to get scripts to run without modules, but when I try to use the npm 'fast-csv' module, running the Alfred workflow with my script gives me the error "Cannot find the module 'fast-csv'". I've installed 'fast-csv' globally, so I'm not sure what else to try. (The script runs correctly when using the terminal.) Any ideas? Thanks
  9. Hi, have a file action to convert gifs to mp4 using ffmpeg: ffmpeg -f gif -i {query} -pix_fmt yuv420p -c:v libx264 -movflags +faststart -filter:v crop='floor(in_w/2)*2:floor(in_h/2)*2' ~/Desktop/converted_file.mp4 This works perfectly with the terminal command but I want it to run it as a script so it doesn't opens a terminal window. Do I have to change anything? The way it it's not working. Thanks in advance for your help!
  10. Is there any way to open the clipboard.alfdb in any terminal program so that I can remove sensitive data and replace it with something like "PASSWORDREMOVED" without corrupting the data file? Is it in any certain data format? Like if it was SQLite I could make the changes through there I know you can do function-backspace to remove entries from the clipboard, however, i just want to remove the sensitive data not the whole line from the clipboard. Thank you, Jared https://jared.nyc https://devopschat.co
  11. 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.
  12. I am in need of a script or scripting to parse an onslaught of email data in Gmail and organized in a google sheets file which the column headers are titled in conjunction with the need data from the emails. This is how the data is relayed to me which I need a script to extract the indicated fields below into a new cell within their respected columns in Google sheets. If anyone can help I would greatly appreciate it, sure make my day a lot easier. Thank you. It was much easier to just screenshot the key I created to map out what I really need and what everything looks like on my end. (See screenshots below) The pertinent email will be subject titled: Fwd: Debt Settlement. Screenshot Screenshot2 Again thank you to anyone who can help me with this.
  13. Hi, I'm trying to pass some variables in a workflow. The set-up of the workflow is as follows: Where the script is from datetime import date from datetime import timedelta import json today = date.today() offset = (today.weekday() - 2) % 7 last_wednesday = today - timedelta(days=offset) d = {'alfredworkflow': {'variables': {'last_wednesday': last_wednesday.strftime('%Y-%m-%d') } } } print json.dumps(d) And the copy to clipboard part is: SET @startdate = {var:last_wednesday}; SELECT ... The issue is the {var:last_wednesday} part is coming up empty and I don't understand why as I've modelled this after another functioning workflow. When pasting I only get SET @startdate = ; Does anyone know where the error is?
  14. Hi, I made a simple an apple script to open a specific folder triggered by a hotkey, but it's not working and I can't find why. It works if I use the Script Editor from Mac OS but when I paste it inside the "Run NSAppleScript" window on Alfred it doesn't. Script: on alfred_script(q) property the_path : "/Users/UserXXX/Downloads" set the_folder to (POSIX file the_path) as alias tell application "Finder" activate if front Finder window exists then set target of front Finder window to the_folder else open the_folder end if end tell end alfred_script
  15. Currently, if I output the following: {"items": [ { "title": "Foo", "arg": "unicorn" } ]} I have to handle the `unicorn` arg in a connected output action in the workflow. It would be useful to be able to dynamically handle it without needing to create an output action. This can be useful for very dynamic results and creating reusable modules that create output with different actions. I propose adding a `script` property to the JSON format that when specified makes it not pass the output to any connected output action (like `valid: false`) and instead executes the `script` and passes `arg` to it. {"items": [ { "title": "Foo", "arg": "unicorn", "script": "run-foo.sh" } ]} This would make script filters a lot more powerful.
  16. Good morning, I'm currently trying to create a simple Script Filter Alfred 3 Workflow using Python. I found an earlier example which demonstrated how to pass XML results to a Python workflow: xmloutput = """ <?xml version="1.0" encoding="utf-8" ?> <items> <item arg="testitem"> <title>FooBar</title> <subtitle>foo bar is a test item</subtitle> <icon>icon.png</icon> </item> </items> """ print(xmloutput) My question is, what is the syntax for doing the same with the new JSON data structure? regards, Andrew
  17. I have a workflow that is listening for spotify ads (so i can mute them). I have a while loop listening. When it finds an ad (a track with < 35 second duration), it sends a notification - but not an alfred style post notification; just the default applescript-like notification. Here's the code: Note: osascript -e "display notification \"Muting ad for $sleepDuration seconds\" with title \"Mute Spotify Ads\"" This is what I'd like to replace with an alfred Post Notification. vol=`osascript -e 'tell application "Spotify" to sound volume as integer'`; while : do state=`osascript -e 'tell application "Spotify" to player state as string'`; sleepDuration=1 if [ $state = "playing" ]; then duration=`osascript -e 'tell application "Spotify" to duration of current track as string'`; duration=$(echo "$duration / 1000" | bc); if [ $duration -le 35 ]; then position=`osascript -e 'tell application "Spotify" to player position as string'`; position=$(echo "$position" | bc); sleepDuration=$(echo "$duration - $position" | bc); osascript -e "tell application \"Spotify\" to set sound volume to 1"; if [ $sleepDuration -le 0 ]; then sleepDuration=1; else osascript -e "display notification \"Muting ad for $sleepDuration seconds\" with title \"Mute Spotify Ads\"" sleep $sleepDuration; osascript -e "tell application \"Spotify\" to set sound volume to $vol"; sleepDuration=1; fi else osascript -e "tell application \"Spotify\" to set sound volume to $vol"; sleepDuration=1; fi sleep $sleepDuration; else break; fi done osascript -e "tell application \"Spotify\" to set sound volume to $vol";
  18. Hi there! I've created a workflow that I want to share with my team, the workflow includes a Python script, which in turn has a dependency on a 3rd party library (the wonderful Requests[1]). Are there any best practices around sharing this workflow with my team, whilst easing friction around the third party dependency? For example, currently I'm advocating dropping down to the command line and installing the Python dependency globally, ideally I'd like to avoid this, if at all possible. Appreciate any pointers. Kind regards! Steve [1] http://docs.python-requests.org/
  19. Hello! First post to this forum! I just created my first workflow, which I'd like to share with my team. Problem is, my workflow includes a script which references a private API key, which I would rather not share with the team. Is there any way I can share the workflow, without exposing the script's API key? For instance, by replacing the API key in the script with a reference to an environment variable instead? Appreciate the assistance. Many thanks! Steve
  20. Newbie question, and maybe I'm missing something, but does Alfred not filter the results of a script filter based on arguments? I have a fully functioning filter, but it seems odd that Alfred doesn't filter the results based on the value of the argument. For example, if I have a script filter with the keyword "Press", requiring an argument, and the items "one","two","three", I'd expect that typing "Press o" would limit the results to "Press one", where typing: "Press t" would limit the results to "Press two" and "Press three" I've tried both populating and omitting the uid field, to no effect, though I do understand that this field is primarily for "learning". Am I doing something wrong, or is this expected behavior?
  21. Hi everyone! For long, I've been launching VirtualBox's virtual machines with the following script, bin/bash being the language selected: VBoxManage startvm "vm_name" In a recent update, it seems that VirtualBox moved the necessary "files" (I don't really know/understand what happens in the background) from /usr/bin to /usr/local/bin. See this topic: https://forums.virtualbox.org/viewtopic.php?f=8&t=68825. People there pointed that it might be related to recent security restrictions in OS X (Yosemite, El Capitan). From the Terminal, when I first point to /usr/local/bin, the previous piece of code works perfectly. So my question is, how can I point to that special directory from a Run script window of a workflow? Ultimately, should Alfred be updated to offer /usr/local/bin in the Language list? Thanks for your help!
  22. Quite a lot of the scripts I run in Alfred involve handling multiple files (i.e. {query} is a list of tab-separated files). Without some relatively complex code (bash doesn't make it easy) that obfuscates the purpose of the script, they all break with files containing apostrophes. It would be very useful if there were an option to escape single quotes, like you can with double quotes.
  23. This workflow accesses a Bible program (Accordance) and searches it for the 'selected verse reference' then pastes the result. It works fine. Instead of a hotkey, I want to be able to type a keyword such as 'find' then a verse reference and have the reference run through the script. Tried some of the more obvious approaches, but it just won't work for me. Current configuration is ----- >>>Selection in OSX- Hotkey >>>Run Script- global theResult global moduleName global input global citationFormat set moduleName to "MLV 2016" --NOTE: Change this to change what version you paste, i.e. ASV, but keep in mind it must be available in Accordance. set input to (the clipboard) set citationFormat to "true" getScriptureText(moduleName, input, citationFormat) on getScriptureText(moduleName, input, citationFormat) tell application "Accordance" to set theResult to «event AccdTxRf» {moduleName, input, citationFormat} tell application "System Events" set visible of process "Accordance" to false end tell end getScriptureText tell application "System Events" set the clipboard to theResult end tell >>>Copy to Clipboard - {clipboard} - Paste to frontmost
  24. I have this simple shell script which adds today’s date when I run it: set the_date to do shell script "date \"+%y-%m-%d\"" My probem is being new and ignorant regarding workflows I do not know how to compose a workflow that will trigger this script. Can anyone help please? Cheers.
  25. Hi all, I'm sure there's an easy answer to this, but could someone explain to me why a simple Keyword to Script workflow, consisting of a keyword foo and the following one-line bash script (where mate is the TextMate shell utility and bar is the absolute path to a text file) sudo mate bar does absolutely nothing, even though it works fine when I run it in Terminal,. This workflow used to work, but it hasn't for the past couple of months (I think, because I don't use it very often). It's not a huge deal, but I'd like to understand what's broken it. It's not because it's run with sudo, because mate bar does nothing (where bar is in my home directory in this case), and neither is it a problem with mate, because vi bar doesn't work either. All my other Keyword to Script workflows are working fine, including a test one I just created with rm bar as the script. Any ideas as to why I can't invoke text editors in workflows? Thanks! fort
×
×
  • Create New...