Jump to content

Search the Community

Showing results for tags 'run 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

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

  1. Short version Is there an equivalent to terminal's compgen autocomplete in runscript? Long version I work in an office with a shared NAS drive. All our clients take a very specific folder structure. It's kind of a pain in the ass to jump to a particular clients folder as we multi-task a lot. All our client folders start with the first four letters of the client name as a client code. So Super Dooper Client would be SUPE_Super Dooper Client - which is cool for autocompletion as it always knows where to go, since no two are the same (by chance to be fair, we've had to use acronyms for a couple, but we can remember those) I've written this script in terminal to jump to the right folder, but it leaves me with an annoying terminal window open. I don't want to quit terminal completely, just close the active window. I can't see how to do that (I've tried quit and exit, neither worked) - but I did see I should probably use a Run Script. Problem is I can't get the compgen autocomplete to work. Here's the code: src="{query}" //first go the right folder - an automatically mounted AFP drive cd /Volumes/Files/Clients/; //now automatically complete the file name from the 4 letter code I've typed in as the a query //this is the bit that doesn't work in a run script folder=$(compgen -d {query}_); //set the target folder target="/Volumes/Files/Clients/$folder" // go to it cd "$target" //open it open . thanks!
  2. The Run Script action, particularly relevant to osascript, appears to return the result of the script as text that is terminated with a line break character. This causes problems when the script returns a file path, which gets fed into the subsequent node of the workflow that is expecting to receive a file path that points to an existing file, but instead receives a file path that points to a non-existent file because of the extra character in its name. https://transfer.sh/LEmG3/Bug Report.alfredworkflow The workflow demonstrates the phenomenon. It simply displays an osascript output surrounded by quotes to visualise the string in its entirety. The code used in the `osascript` is: on run return "~/Downloads" end run This might not technically be a bug, per se, as I'm guessing the Run Script actions all execute a script by way of a shell command, and therefore it may be that the osascript command itself is returning this output rather than something Alfred is doing. That said, when I run the following command in Terminal: osascript -e 'return "~/Downloads"' | wc -l it reports that the output does only contain a single line.
  3. Hello, I'm trying to create a simple workflow that saves to disk the image that is in the clipboard. I found pngpaste a library to do just that. Now I created the workflow with a keyword trigger named pasteimage and an action "Run Script" query=$1 pngpaste $query I get this error: Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Scripts/546DD210-2D7D-4CED-AA58-DAB4B0F6EE89:3: command not found: pngpaste How can I run this command from Run Script? Thank you
  4. Hey All! Long time listener, first time caller. QUESTIONS Is there a way to set an Alfred variable from within a Run Script (bin/bash) command? For reference I'm calling a python script (i.e., python my_script "{query}") If not, how can I store the output of the Python script when it is a complex data type like a dictionary? CONTEXT I'm trying to write a workflow that utilizes an API, grabs some values, and then opens a URL. The user will enter an ID, the python Run Script will retrieve information about this via the API call, and then using the returned data I would like to open a web URL. Currently the python script is creating a dictionary of useful data and storing like so: useful_dict_info = {"key1" : "value1", "key2": "value2"} I think return from the Run Script by using print: # some code to create useful_dict_info print useful_dict_info What I would like to do is either store key1 and key2 as Alfred workflow variables from within the script OR parse the output from Run Script and store them as Alfred workflow variables. Thoughts? P.S. I'm a huge fan of Alfred and thanks for all the work you've put into it so far. It saves me minutes, if not hours, each day and I keep adding more and more workflows!
  5. Hi I think this should be a very simple task. 1. I have a folder: eg ~/manuals/ where I store all the different notes and manuals I write for my self. All the files ends with .man 2. I often need to check the contents of these files. eg. the usage of mask with python, etc The workflow I want is like below: 1. I want to use the keyword ??, and run sth like "?? mask" 2. and then I want to run a command line: grep -A 4 mask ~/manuals/*.man 3. I want the result to be returned to alfred and shown in the window However, I could not figure out the return part and never see the returned post notification. Could anyone help me? Thanks very much!!!
  6. Hello, I am trying to run a terminal command "terminus site:list" but keep getting error when trying to use the Run Script action. I've read in other articles it's because the terminal doesn't load the user profile but I can not figure out how to set the $PATH variable in the workflow to make this command accessible. I installed Terminus using composer so I created an alias in my .bash_profile that is "alias composer='php ~/composer.phar'" . I've also listed the rest of my .bash_profile below for reference. How do I get this to work with Run Script? How do I get terminal to load the $PATH variable? export PATH="/usr/local/mysql/bin:~/.composer/vendor/bin:$PATH" alias composer='php ~/composer.phar' Reference Articles: Thanks, Rich
  7. Hi, I am trying to create a workflow that would append some text content I select on Google Chrome. Here are the steps: I select some content on a website (no copy to the clipboard, just a selection) I hit a keyboard shortcut Alfred runs a command that would add the selected text in a specific file. I created a workflow with a "hotkey" and a "run script" actions. It is not working the way I want as every time I use workflow it appends the selection and the command (.i.e: "echo "{query}" >> ~User/Downloads/test.txttextselectedongooglechrome") I guess I have missed something in the "run script" action as I do not really understand the difference between "input as argv" and "input as query". Thank you.
  8. So I have a workflow set up with a script filter triggering a "run script" action. The (/bin/bash) script action is set to escape backquotes / dollar signs, run instances sequentially and contains this: echo entered alfred.workflow.action.script >&2 ./process_command.sh {query} When the script action gets executed, the Debug pane (set to log all information) shows this: [iNFO: alfred.workflow.input.scriptfilter] Processing output 'alfred.workflow.action.script' with arg 'restore sa ' At first, I thought I just screwed something up, so i set up a hotkey trigger to go directly into the same script action, but it still only yields this: [iNFO: alfred.workflow.trigger.hotkey] Processing output 'alfred.workflow.action.script' with arg 'restore sa' The weird thing is that it used to work just fine. The only thing on my system that's changed in that time is that I installed the newly released public beta update for El Capitan - 10.11.1 Beta (15B38b). I have randomly gotten it to work again after first experiencing this issue (not sure how) but it broke again soon after. In case it helps, here's a link to the GitHub repo containing my code: https://github.com/TimeDelta/session_archiver
  9. It would be great to see "javascript" in the list of languages for "Run script" under action and output in the workflows, so that we can have these executed with nodejs.
  10. Currently there are some issues with Run Script when using /usr/bin/php, /usr/bin/perl, /usr/bin/python, etc... Those processes are launched from the shell using certain environment variables (such as LANG=C or another non-unicode supporting environment) which disable features or environments we may need to run our scripts correctly. Currently the only solution to this would be to use /bin/bash or /bin/zsh and set things ourselves and then launch our script from there. Doing so means we sacrifice the convenience of having scripts right in the workflow visual themselves AND we can no longer take in the query conveniently. We must now take in the query through bash for example, which is quite tricky (an experienced programmer may be ok, but just try taking in something like She said, "He said, 'this is fantastic!' ", and you'll see things are much worse than what is apparent). To save us from this mess, we could have a vertical dual pane Run Script, where the top pane is a bash or zsh, and the bottom one of the script languages. Users can then easily set any setup variables they need to make things run smoothly. Thanks kindly, Matthew
  11. Bug reproduced at both home and work. Configs : @home: OSX: 10.7 Alfred: v2.0.1 build 173 @work: OSX: 10.6 Alfred: v2.0.1 build 173 Origin This topic Step to reproduce NB: I did a brand new workflow to be sure it was clean of any extra hidden space or carriage return. Basically it looks like this: A keyword object with arg to pass the {query} Run Script object uses /bin/bash and simply does an echo "foobar" Output 1 displays the {query} Output 2 displays display the text in the text field (e.g. foobar) Output 3 displays the {query} passed by the script. When i trigger the workflow with "foobar" as an argument, this is what i got : As you can see the {query} passed by the script has an extra space at the bottom. As harmless as it seems, it's not Can't properly use the {query} in a bash script because of this. Do you confirm?
×
×
  • Create New...