Jump to content

Bhishan

Member
  • Posts

    146
  • Joined

  • Last visited

Everything posted by Bhishan

  1. I was trying to run dock repositioning commands in Alfred using List filter. The link is given in github. I was can see the list names, but when I click them none of them works. How can we fix them ? Help will be truly appreciated.
  2. I have created an Alfred workflow to show the number of days until some events. We can add any number of events to our taste and also define some other commands such that if we click "FIFA" in this workflow it will show the 2018 Russia Worldcup Schedule. We can find the workflow in my github Days Until Events . Usage: Double-click the downloaded file and click on [x] to see the description how to use this. # Usage: Click on FIFA button to see the worldcup schedule (The time is EST USA). Note: you can download the schedule of your time-zone and use that image. Screenshot:
  3. How to use this workflow ? In Alfred 3, I tried "regex tr/that/this" It gives error: Could not open your RegexSequences.pl file.
  4. @vitor Apologies for that, I have updated the question. Is it possible to use {arg} to run the selected action from list action, in above workflow?
  5. Here is a simple workflow to show the number of days until some events. I was trying to apply some filter so that given command is run only for respective events. That being said, I want to quickview the given image only if I click FIFA button in the workflow shared on github.
  6. @deanishe Thanks for the reference. That's a great article, but unfortunately, there is no example workflow to execute the theory explained. Feature Request: If there are some simple example workflow it would be great and a lot of new users will benefit from them. I tried to follow exactly the instruction and printed given format in python, but to no avail: import sys output = """ {"alfredworkflow:" { "arg": "https://www.google.com", "variables": {"browser": "Google Chrome"}}} """ print(output.lstrip()) In bash script: echo $browser > ~/hello.txt It did not print the google chrome in ~/hello.txt. I have uploaded the workflow here
  7. @deanishe I would love to use single script But the problem is two values are combined into single variable and they can not be used separately. Here is the python script to print two numbers: from __future__ import with_statement, print_function, division import sys import os import datetime date_format = "%m/%d/%Y" # Using variables cmu = os.getenv('fifa') # Calulating days difference today_str = datetime.date.today().strftime(date_format) today = datetime.datetime.strptime(today_str, date_format) someday = datetime.datetime.strptime(cmu, date_format) days_diff = abs((someday - today).days) # print will give output print('Days Until FIFA:', days_diff) If I use: print(30,40) # Just for practice It will give {query} = 30,40 and How can we use 30 and 40 separately in File Action ?
  8. I have defined two environment variables and used them to get the variables. For example: environment variable: fifa = 6/14/2018 and python script gives dfifa = 30 environment variable: cmu = 6/16/2018 and python script gives dcmu = 32 Now, When we use {var:dfifa} and {var:dcmu} only one variable works. The workflow is shared in github. How can we fix the problem ? Thanks.
  9. Thanks a lot. This worked finally: # Read user given arguments mins=$(echo "$min_sec" | cut -d' ' -f1) secs=$(echo "$min_sec" | cut -d' ' -f2) duration=$( bc -l <<<"60*$mins + $secs" ) # duration in seconds # Input mp3 file name and output file name base="${infile%%.mp3}" output="${base}"_trim.mp3 # Example: /opt/local/bin/ffmpeg -ss 0 -t 120 -i in.mp3 out.mp3 # This will trim from 0 seconds to 120 seconds, i.e. two minutes. # # /opt/local/bin/ffmpeg -ss 0 -t $duration -i "$infile" "$output" # Practice # touch "$mins".txt # This will write a file in directory of this workflow.
  10. I have a very simple File Action workflow which reads the filename and also needs two user given inputs. The workflow I have work done so far is shared here. I was successful to get the name of the input file, but reading the arguments is giving a problem. I apologize in advance, this is a noob question, but it is taking me more than one hours and still no luck.
  11. @deanishe @vitor Big THANKS guys, Finally I fixed the problem with your help. I had just quoting problem for shell variables: Bad: $bash_variable # This does not escape characters Good: "${bash_variable}" # This escapes characters in variables itself
  12. @deanishe @vitor Getting aside from the actual youtube-dl command, the command needed is this: cd ~/Google\ Drive/Music/Downloaded touch "this file had space and @ # etc.webm" filename=$(ls *.webm) echo $filename >> output.txt # This works good touch $filename # This fails, creates multiple files for each space-separated name of the input file How can we get a shell escaped variable in Alfred by reading the filename in bash?
  13. @deanishe @vitor Thanks folks, now I can get two variable but again have the shell escaping problem. The workflow does not work still. The updated workflow with youtube-dl and ffmpeg commands is uploaded in github link . In bash script it can be done in very few lines: # initial x seconds trimmed mp3 song # mytrim 36 https://youtu.be/f1qz8vn3XbY?list=RDYuXLN23ZGQo&t=219 mytrim() { local downloaded_file /opt/local/bin/youtube-dl --extract-audio --embed-thumbnail --audio-format mp3 -o "%(title)s.%(ext)s" $2 downloaded_file=$(/opt/local/bin/youtube-dl --get-filename --extract-audio --embed-thumbnail --audio-format mp3 -o "%(title)s.%(ext)s" $2) /opt/local/bin/ffmpeg -ss $1 -i "${downloaded_file}" -acodec copy -y temp.mp3 mv temp.mp3 "${downloaded_file}" }
  14. @vitor My bad, that was just an example case how I want to use the variable, I have no problem with that code, I just need to get the value of the argument. For example, How can we write following things in the text file '~/Downloads/hello.txt' ? 25 https://www.youtube.com/watch?v=kJQP7kiw5Fk I have updated both the question here and the workflow in GitHub. My apologies for unnecessary complications.
  15. @vitor, Thanks for the response, I have given the link of workflow in the question. The link opens github page and we can download the zip file and look at the workflow.
  16. I am learning how to use the Alfred to make some interesting workflows. I was modifying a workflow so that it takes a user argument, and passes that variable to the last part of the workflow. Alfred command: trim 25 Last part of Alfred gives: the youtube link How can we get the user given argument : eg. 25 Required output in ~/Downloads/hello.txt: 25 https://www.youtube.com/watch?v=kJQP7kiw5Fk The link of the workflow is shared in github alfred two arguments . Its a noob question, but, I would appreciate your help. Thanks.
  17. Can we expand snippets only after hitting the delimiter keys such as space, tab, enter? For example, I want to assign: \\a expands to \alpha \\a2 expands to \alpha^2 Problem: Whenever I type \\a it expands to \alpha and can not type \\aa2 so that the second one works. This is possible in in another text expanding app called aText. There we can expand the snippet at the delimiter. If we type \\aa and hit space or tab or enter, it will expand the snippet and keep (or not keep) the delimiter, can we do same in Alfred?
×
×
  • Create New...