Jump to content

Search the Community

Showing results for tags 'script'.



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

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


Website URL


Jabber


Location


Interests

Found 43 results

  1. 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?
  2. 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
  3. 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!
  4. 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
  5. 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.
  6. 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.
  7. 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?
  8. 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
  9. 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.
  10. 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
  11. 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";
  12. 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/
  13. 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
  14. 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?
  15. 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!
  16. 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.
  17. 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
  18. 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.
  19. 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
  20. Hi, I need a workflow that searches folders located on NAS starting from a list of predefined folders. I need also to limit searches to 1 folder depth on NAS for speed and accurate search result. Example: I want to tell Alfred to look only inside this set of folders: /volumes/data/folder1 /volumes/data/folder2 /volumes/data/folder3 and limit the folder depth to 1 so only folders inside the folder list are searched. Using the 'find' command it would be: find /volumes/data/folder1 -maxdepth 1 find /volumes/data/folder2 -maxdepth 1 find /volumes/data/folder3 -maxdepth 1 Note: NAS is not indexed.
  21. Here is my problem. I modify a lot of strings cases these last days (ie Lower case to uppercase "my_file" to "MY_FILE"). After some research, I found I could use these TextExpander perl scripts (here) to solve the problem. But I believed Alfred could make it faster, better, smoother. What I want to do is select the name of my file, hit a hotkey, see the name of my file converted to uppercase/lowercase/sentence case... I tried to create a workflow with a "Selection in OSX" and a "Run Script" command. But it doesn't work. I should say, I couldn't make it work... I thought copying these perl script in a run script action would be enough. Here are the for Perl scripts I am referring to : 1°) Paste clipboard to lower Case #!/usr/bin/perl -w #Initialise use strict; my($text); #Get the text from the clipboard $text =`pbpaste`; #Output the text as lowercase print "\L$text"; 2°) Paste clipboard to Upper Case #!/usr/bin/perl -w #Initialise use strict; my($text); #Get the text from the clipboard $text =`pbpaste`; #Output the text as uppercase print "\U$text"; 3°) Paste clipboard to Sentence Case #!/usr/bin/perl -w #Initialise use strict; my($text); #Get the text from the clipboard $text =`pbpaste`; #Convert the text to lower case $text ="\L$text"; #Convert the first character of each sentence to upper case $text =~ s/(^\w|\.\s+\w)/\U$1\E/g; #Output the text print $text; 4°) Paste clipboard to Title/Proper Case #!/usr/bin/perl -w #Initialise use strict; my($text); #Get the text from the clipboard $text =`pbpaste`; #Convert the text to lower case $text ="\L$text"; #Convert the first character of each word to upper case $text =~ s/ ((^\w)|(\s\w))/\U$1/xg; #Output the text print $text; I might be stuck in the escaping settings as I do not really understand what escaping mean in the context of an Alfred workflow.
  22. I've run into a problem when trying to execute a Python script in Alfred. The script is basically running a subprocess using a program located at /opt/random/bin/. When I run the script, I get the following debug. [ERROR: alfred.workflow.action.script] Code 127: /bin/bash: /opt/random/bin/tool "/Users/ritashugisha/Downloads/file.txt" "/Users/ritashugisha/Downloads/new.txt": No such file or directory So I looked at the $PATH that Alfred was using... bump = open('/Users/ritashugisha/Desktop/path.txt', 'w') proc = subprocess.Popen(['echo $PATH'], stdout = subprocess.PIPE, shell = True) (proc, proc_e) = proc.communicate() bump.write(str(proc)) bump.close() and found the following: /usr/bin:/bin:/usr/sbin:/sbin This doesn't include what I need it to include. So do you have any ideas for tricks to get around this? Or am I approaching this the wrong way? Thanks for any help you provide!
  23. Hey guys, quick question. Is there any easy way to use an image from a URL as the icon for a script filter? I've been downloading about 50 compressed thumbnails everytime I use a script I've been writing. (extremely slow) Do you guys know of any easier way to get images from a URL as a script filter icon? Thanks
  24. I'm new to the update of alfred 2 and I'm having some problems when creating a workflow. i would like to run the following script: cd /application/language/nl_BE/LC_MESSAGES/ grep -v '^#: ' common.po > common.po.tmp && mv common.po.tmp common.po It works perfectly when I choose 'Actions -> run script' but nothing happens while when I use 'Actions -> terminal command' it works.
  25. I am working on a workflow which should execute a shell script command for of the documents (*.xml files) currently selected in the Finder. I did some experiments around it, but could not get it to work yet. Any pointers, e.g. what workflow elements I will need? I am currently thinking along the lines of first calling an applescript which gives me the selected files, then filtering out only the xml files and lastly calling a shell script for each of the files or alternatively calling the script once but passing along an array of xml files. What do you guys think? Thanks for any suggestions / sample workflows.
×
×
  • Create New...