Jump to content

Search the Community

Showing results for tags 'Bash'.



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

  1. Provides both a File Action to run shell commands on selected files/directories and a Keyword to run them on the current directory. It will detect your default shell, and if it’s bash, zsh, tcsh, csh, or fish, it’ll load the appropriate startup files and your aliases. For the File Action, use Alfred to pick what you want to run a command on and choose Run command. Alfred’s main window will appear and you simply type the command you want. For the Keyword, type . followed by a command. A space between the period and the command is not necessary. This will run the command on the active Finder window (e.g. .touch this_file). You can also easily chain commands (.cd Desktop && rm that_file). For commands that would benefit from the files not being at the end (like cp and mv), you can use {} as a placeholder for the files. So if you select some files and want to copy them to ~/Desktop/ you’d type cp {} ~/Desktop/. To get the output of a command as Large Type, actioning it with ⌘↵ instead of ↵. Download | Source
  2. This is a workflow for easily downloading videos (and/or extracting audio) from various websites such as YouTube, Vimeo, DailyMotion and more... It uses youtube-dl as the core component. Main Features: Download video from URL. vd {video-url} Download and extract audio into an MP3 file. vd-audio {video-url} Display and download video metadata (json). vd-info {video-url} Update core component (youtube-dl). vd-update Display quick help in Large Type. vd-help Note: vd-update command currently only updates youtube-dl, not the workflow itself. Please see full details, updates (and source) of the project at GitHub. Download Video Downloader workflow. Here is a full visual list of what Video Downloader can do: And here is how the workflow nodes look like: Requirements: For the audio extraction (vd-audio) feature to work, you should install FFmpeg yourself manually (because of licensing issues). If you don't have it already; you can find details on how to install FFmpeg at the GitHub page. --- (While writing this, I found out about Vítor's workflow; which is also nice and uses youtube-dl. Well, I'm releasing this anyway for it's extra features like audio conversion, metadata info, etc..) Pls. drop a note if you like it... Thanks.
  3. Does anyone have an Applescript to run commands in the Alacritty terminal emulator instead of the default one? I've been trying to adapt iterm2 ones but I'm not well versed in Applescript and cannot get it to work.
  4. Hello everyone! I wanted to attempt to create a workflow that does the following: Open a specific Google Chrome profile, wether or not google chrome is already open or not. I have tried this just in a bash script and never got the results I wanted..... This is what I was working off of: open -a Google\ Chrome --args --"profile-directory"="Profile 1 also tried /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --profile-directory=Default This is where i posted my original question: http://superuser.com/questions/759535/open-google-chrome-specific-profile-from-command-line-mac/759644#759644 So has anyone done this before, or have any ideas on how to create this into an alfred workflow? Thank you!
  5. I just released a Screen Sharing workflow with automatic discovery of hosts that have remote desktop enabled. Such amazing things are now possible thanks to the "Script Filter" input! Download — stable version. The source code is available here: https://github.com/pstadler/alfred-screensharing
  6. This is a workflow to mount your network shares with automatic discovery. No configuration or bookmarks required! Download — stable version. Please report problems here. Your computer won't explode and your shares are safe, I promise. Troubles? Make sure that both, Apple Filing Protocol (afp) and Samba (short smb, QNAP calls it "Microsoft Network") are enabled on your NAS. Due to the nature of the protocols and the available tools on OSX, both of them are required in order to disover network shares in your network. Also note that already mounted shares are not listed in Alfred. Enable guest access to the NAS, not for a specific share, but for the system in general if things don't work. The source code is available here: https://github.com/pstadler/alfred-mount
  7. I feel like I must be too stupid to use Alfred and maybe I shouldn't even try to do this anymore. I just want to take the output of a bash command and post to OSX Notification; I honestly can't believe how so dramatically different (difficult/frustration/inane) trying to do this simple thing is compared with the amazing ease of use and simple to understand the rest of Alfred typically is. I will post my workflow as it is currently, but it should be noted this is perhaps the 37th attempt to figure it out: Workflow view attached, where contents of 'Terminal Command' are as follows: export LPR LPR=$(/usr/local/bin/xmda -l | grep {query}) echo $LPR Terminal Command xmda is simply a program (which works perfectly fine at bash prompt) that outputs a number of lines of text. Here I am simply filtering that output using grep, and again this works at a bash prompt without fail. I am using the full path, although that is not necessary at a bash prompt (however it works either way, this is not a path issue). Post Notification As the image shows, I have {query} in the Text field, conforming I believe anyway, to the ahem, unique manner in which Alfred requires {query} to be used as a "placeholder" variable of sorts, rather than simply allowing normal variable use. Neverminding the latter, I am confounded and feel like I am doing this right. I have searched and read numerous articles and this forum, but each bit of help I can find either seems to fail for me or doesn't come quite close enough to do exactly what I am trying to in this case —leaving me to wonder if there is something "off". I have tried to do something like this perhaps a dozen times in Alfred, each time going away insanely frustrated --I can get around in bash and understand basic programming reasonably well. I think that contributes to the way I feel and why I always end up walking away from each effort. here' s the part where I get schooled, and I stand humbly by with great appreciation for any help that can be provided by those more knowledgeable (and patient) than I! --Thank you for reading.
  8. Hey All, Looking for a solution on a very minor annoyance, I usually run a lot of shell commands from Alfred using the > prefix, which is great! Love it! However, when it executes the command it pops open terminal and runs the command and leaves another lingering window around which I find annoying. Does anyone know of a way to force Alfred to close the window it opens after the command is executed? Very rarely do I need the returned command's output. It's usually for firing off quick things like docker pulls, file moves, git commits and such. If I need to do this through an AppleScript I'm open to that as well, just wanted to find some way around my terminal windows popping up everywhere like mushrooms. Thanks!
  9. I'm trying create a workflow to utilize the MacOS Say command. With this command, I'd like to queue up several paragraphs for it to speak and highlight the spoken paragraph. I'm close, but I'm running into issue with the clipboard management. It was my understanding that the /bin/bash scripts can queue commands up in sequence. In which case the below code should execute like this; 1. Copy the query (which in my workflow is the selected text). 2. Open find in Safari 3. Paste the clipboard contents. 4. Say the selected text. It looks like the LAST copied text ends up being pasted, instead of in sequence. The say command adheres to the sequence properly. The other commands do not, what am I missing? screenshot of the workflow is attached. pbcopy < "{query}" osascript -e 'tell application "System Events" to keystroke "f" using command down' osascript -e 'tell application "System Events" to keystroke "v" using command down' say "{query}" -r 250
  10. Heyho guys and girls, I just finished porting my old v1 extension NotificationControl to a v2 style workflow. You can download it here. You can use the following keywords: Show the current status of Growl and NotificationCenter : stat Pause Growl and Notification Center : pause Resume Growl and Notification Center : resume Pause or resume Growl : growl Pause or resume Notification Center : notificationcenter Close all Growl notifications : close_growl Close all NotificationCenter notifications : close_nc Show Growl’s rollup : show Hide Growl’s rollup : hide Enable Growl’s incoming network : enable Disable Growl’s incoming network : disable/ Restart Growl : restart
  11. Hi there, I'm a newbie to Alfred and completey overwhelmed by the possibilities of its workflows. As such, I have a newbie question but google and the search engine of this forum could not help me. In a workflow I'm using the (Action => Run Script) element to call a bash script that resides in my home folder. This bash script returns 0 in case everything is fine and a different number else. I'm now interested to evaluate this result but don't quite manage to get this done. Do I have to pass the result of the script into some variable of Alfred after calling the script? (at the moment the Run Script element only comprises one line). The filter element looks like what I'm searching for but it is not quite working. Obviously the output from the script does not really end up in the filter.... Any suggestions would be greatly appreciated Have a nice Sunday! Nils
  12. Is it possible to easily run custom bash scripts with Alfred, but run them from my local machine, instead of typing them into Alfred? For example, if I have the following script: ➜ xdoc git:(master) ✗ pwd /Users/max/Dropbox/work/src/github.com/mbigras/xdoc ➜ xdoc git:(master) ✗ ls README.md xcats xdoc xdoc.mm ➜ xdoc git:(master) ✗ readlink xcats /Users/max/Dropbox/work/src/github.com/mbigras/xdoc/xcats ➜ xdoc git:(master) ✗ cat xcats #!/usr/bin/env bash echo inside xcats with args: $@ with the following workflow, I get the following error, please see attached images. So I'm wondering how can I pipe alfred output into my bash scripts without manually writing them inside the Alfred IDE? Thanks
  13. Hi, I want to set a custom bash (source "${HOME}/.zshrc") when running all the scripts in my workflow. There's any elegant way of doing this or I have to set it on the first line of each script?
  14. Hi! I have been a user of Alfred (+ Powerpack) for years, but only recently decided to invest more time into customizing it with the workflows I thought were helpful. As I am a software developer, I generally setup any new Mac OSX environment using a completely automated installer: https://github.com/kigster/pullulant I wanted to add to Pullulant a simple bash script for installing Alfred. I can install the software itself using Homebrew, and then I was hoping to download and install my favorite workflows. I have now spent over an hour searching online, and I am absolutely stunned to find out that Alfred, the supposedly tool for automating your OS-X life, is itself so difficult to automate!!! What I want is a single line command I can run in Terminal (or iTerm, i.e. bash), that tells Alfred to import the given workflow. Since Alfred insists on choosing a category for a workflow (which is completely useless in my opinion), I would imagine that this command would need to tell Alfred what category to assign it. Right now I am able to do this: open $(curl -s -L -O -w %{filename_effective} \ https://github.com/packal/repository/raw/master/com.alfredapp.mdeboer.atom/atom.alfredworkflow) And as you would expect, curl downloads the file, OSX then opens Alfred, which then stays open like a village fool waiting for me to choose a category for it, and I can't, for the love of life, my laptop or the universe, find a way to make this entire process non-interactive, so that I can run it in a goddamn loop and be done with it. Why!? Why is it so hard? LOL. Cry. LOL. Cry. Sorry, it's very late, and I am getting a bit delirious. I do not mean to offend anyone, I just hoped that I could find a solution without having to post a new question in the forum, because even after searching this entire forum for "install", "command line", "bash", "terminal", "non-interactive" I found nada. Your truly, Konstantin https://github.com/kigster
  15. 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";
  16. Trying to pass multiple paths from file action as args to a command in a bash script. Is there a way to do this?
  17. Can anyone suggest a way or sketch a workflow to be able to run shell scripts from alfred directly? Example: Say I have a example.sh in /home/folder/ I'd like to be able to run this from Alfred; i.e. the following sequence of events happen: 1. I type example. 2. example.sh shows up in the list of results. 3. I [hotkey] to the options menu of example. 4. I [hotkey] something (a workflow?) to execute the script (in /home/folder).
  18. G'day folks! I've recently dug into writing a workflow for Alfred which purpose is to control Hyperion (a service which supplies LED stripes with data). However, when I'm trying to ssh into the remote machine to fetch a list of all available colors (148 ones), it apparently takes too long. Now, I've read on the forum that Alfred has no such thing as timeout. But in that case, I would love if someone could explain why I can fetch the list of effects, where there are only 14 lines and not the list of colors (148). Is there anything I can do? Oh, and yeah: I've seen the setting "terminate script on subsequent input setting", but I cannot find it no more. I thought I could test without that setting, but I don't seem to find it anymore. Edit: found the setting. Whatever setting I had didn't matter. If I run the script in the terminal, the file with the list creates just fine. It's only an issue when using Alfred. Thankful for answers.
  19. My goal is to automate the process of updating a user's hosts file. (/etc/hosts/) I have a bash script that works fine if I run it from my home directory. User opens Alfred and types in the keyword "hostsup" (No arguments required) Alfred opens a Terminal window and runs a script that has been added to the Workflow folder The script displays some informative text for the user Then the scripts ask the user if they would like to continue On 'y', the terminal prompts the user for their password (Because the command uses sudo) The script outputs a completion message and instructs the user to close the Terminal window If I use "Keyword to Script", I can embed the script as part of the Workflow and run it, but it does not run interactively, so the user receives no prompts or messages. If I use "Keyword to Terminal Command", I can run a simple bash "one-liner", but I can't figure out how to call the script that I've included in the Workflow folder. Any help would be greatly appreciated.
  20. I was sitting there in iTerm thinking "wouldn't it be great if I could talk to Alfred directly from the terminal"? bash completion, etc. I'm not sure how to get this done; I was hoping for some guidance by the authors. Alfred's AppleScript library only exposes a few functions. If I wanted to use completion, I'd need a list of all of its keywords. However, if that list existed, I'm sure I could work something out. It'd be pretty awesome. Chris
  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. Hi! Today I want to give you some little workflow that shows your external and local IP addresses. Pressing Return will copy them. Download and enjoy! Cheers, Maciej Skrzypczak
  23. Hi, my first post is a little bit long, but I spent some days in Google before posting here, so I hope to get help. I am trying to create workflow using AppleScript that creates Mail message for me with some links in the footer of the mail body. The problem is that I can't insert links this way, because it places this html as Plain text instead of Rich text: set FooterText to "<a href=\"http://example.com\">Example link</a>" I was trying to find a way to convert html text to Rich text, and found that it can be done with "textutil" from a Terminal app. Running this command from Terminal app works fine: echo '<a href="http://example.com">Example link</a>'|textutil -inputencoding UTF-8 -format html -convert rtf -stdin -stdout|LC_CTYPE=UTF-8 pbcopy I can then open Mail app and paste "Example link" as a rich text, and this link is working. However I can't do the same using "do shell script" from Applescript (NSAppleScript). First I thought it is something to do with escaping characters, so I did a test with <b>bold</b>, but it didn't work, too. Then instead of using "do shell script" I tried "do script" by telling application "Terminal" same script that was working in Terminal app, but it doesn't work from AppleScript, too: on alfred_script(q) set myHtmlText to "<b>bold example</b>" tell application "Terminal" do script "echo " & quoted form of myHtmlText & |textutil -inputencoding UTF-8 -format html -convert rtf -stdin -stdout|LC_CTYPE=UTF-8 pbcopy" end tell end alfred_script Error msg says: "Expected end of line but found identifier." pointing to "|" before LC_CTYPE Any ideas why it is not working? Thanks in advance, Romans
  24. 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
  25. I'm trying to modify the AppendText2File workflow so that if the text to be appended has a single quote inside it the workflow doesn't break. Here's the relevant portion of the workflow: dt=`date` ## append to the original file echo "* "$dt" -- "{query} >> $original What do I do to strip out single quotes (or replace them with something bash/Alfred doesn't hate)?
×
×
  • Create New...