Jump to content

Bhishan

Member
  • Content Count

    81
  • Joined

  • Last visited

About Bhishan

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I was trying to make an Alfred workflow to get the link of youtube open in any chrome tab. I have shared my workflow did so far, which only works for Safari, how to make it work for Chrome? The link of my alfred workflow is shared here. So far I have done this to get URL from Safari, but I am struggling how to get this in Chrome? on alfred_script(q) tell application "Safari" repeat with t in tabs of windows tell t if URL starts with "http://www.youtube.com/watch" or URL starts with "https://www.youtube.com/watch" then set vidurl to URL set AppleScript's text item delimiters to "&" set the item_list to every text item of vidurl set strip to text item 1 of vidurl set vidurl to the strip as string return vidurl exit repeat end if end tell end repeat end tell end alfred_script
  2. @vitor Thanks a lot. However, I also created workflow using python, following the idea of @deanishe. import sys import sqlite3 import os db= r"/Users/USERNAME/Library/Application Support/Alfred 3/Databases/snippets.alfdb" conn = sqlite3.connect(db) q = "SELECT snippet FROM snippets WHERE keyword='{} '".format(sys.argv[1]) c = conn.cursor() c.execute(q) ans = c.fetchone()[0] with open('snips.txt','w') as fo: fo.write(ans) os.system('qlmanage -p snips.txt')
  3. @deanishe Yes, Alfred's Large Type works fine. But, how to pipe the outputs of "snip hello" to the Large Type ?
  4. There are some ways to create and use the snippets in Alfred. 1. Using snip command . We can only see the command name, and copy the snippets but cant see the contents. 2. Using clipboard manager we can search and see the contents of snippets and copy it, but can not see the preview (eg. using shift key) Here, I would like to get help creating a workflow which will write the snippets to a file and quickview it. idea: command: qsnip hello effect: copies the snippet called hello and paste the contents "hello world" to a file called "mysnip.txt" in the directory of workflow. effect: qlmanage -p mysnip.txt Problem: I am unware how to save the snippet to the file "mysnip.txt" I have shared the minimal workflow here: https://github.com/bhishanpdl/Shared/blob/master/Alfred_questions/qsnip.alfredworkflow?raw=true
  5. @CJK Thanks for your help, but I got one small problem. I tried to get only the basename of the png file instead of the whole POSIX path, but it failed. My attempt: I added following at the bottom of the script. # copy basename of png to clipboard base=`basename "$name"` echo -n "$base" | pbcopy How can the workflow only give the base name of the png?
  6. I made a simple workflow to capture screencaputure, rename it, and move it to the current directory of the Finder. The workflow works for folders like "Downloads", "Dropbox/hello", but it fails when I want to write to "Google Drive". There is escaping problem. I tried changing $1 to "$1" in the bash script, but it did not worked. How the problem can be fixed? The workflow is shared here: https://github.com/bhishanpdl/Shared/blob/master/Alfred_questions/aa screenshot copy to current directory.alfredworkflow?raw=true
  7. I was trying to log the path of the current working directory of Finder window to a text file in Dropbox, the AppleScript used has no problem but when used in Alfred it gives me the empty log file. Workflow: https://github.com/bhishanpdl/Shared/blob/master/Alfred_questions/aa Last Working Directory.alfredworkflow?raw=true Used AppleScript: tell application "Finder" if exists Finder window 1 then set currentDir to target of Finder window 1 as alias else set currentDir to desktop as alias end if end tell log POSIX path of currentDir Error log from debugging: [2018-11-20 11:24:03][ERROR: action.script] /Users/poudel/Dropbox/Research/zz_LastWD/ **Question** How to write the current path of Finder along with date in a text file using Alfred?
  8. The link https://transfer.sh/gSsvH/Get-News.alfredworkflow is broken.
  9. Thanks a lot, I figured it out. -- cd to Downloads try set folderPath to POSIX file "{query}" on error set folderPath to (path to downloads folder as text) end try -- try to delete items in Downloads if any try tell application "Finder" set itemsToDelete to every item of folder folderPath delete itemsToDelete end tell end try -- empty trash tell application "Finder" empty trash end tell
  10. This might be a very simple question, but I could not find an easy way to assign a keyboard shortcut to run Alfred with another workflow command arguments: For example: In Alfred: " throw" command will throw all the contents from the Downloads folder to Trash Folder. (workflow: Trash Downloads axelpeigne.trashdownloads) In Alfred: "emptytrash" command will empty the Trash contents using Alfred built-in command. Is there a way to combine these two commands and assign keyboard shortcuts for them? Required: ctrl-shift-E should run alfred commands `throw` and then `emptytrash`. My attempt workflow is here. Pesudocode: ``` tell application "Alfred 3" to run command "throw" tell application "Alfred 3" to run command "emptytrash" ``` Then just prepend a HOT key trigger to this File Script. I just don't know the actual AppleScript commands. Thanks.
  11. @vitor Thanks, now I can move the Fentere in the desktop corners. I have one follow up question. When I set up hot key to open Finder file to open with Fenetre, it does takes the file to the menu of Fenetre, I manuall need to go to Fenetre and click the menubar. Can it be made single workflow a) puts the file to the menubar of Fenetre 2) then opens it in Fenetre? Thanks a lot!
  12. There is a mac app fenetre using which we can make any window and youtube videos at the frontmost app. However, the keyboard shortcuts there works only when the frontmost app is fenetre. How to make the keyboard control make universal using Alfred workflow? For example, <alt-cmd-right> moves the fenetre window to right side. But it only works only when that app is highlighted. I would like to make it universal. If it is very time consuming to get all the keyboard controls of fenetre, I would like only to get the movement controls. e.g. only <alt-cmd-right> moves fenetre window right. Thanks a lot. I have shared my preliminary workflow here.
  13. @vitor For some reasons Cmd ` did not worked for me. I just remapped it to be Alt Cmd ` and disabled original alt-cmd-` combo. Now it works. No need to write any workflows, it was a hidden built-in feature. Thanks a lot.
×
×
  • Create New...