Jump to content

Bhishan

Member
  • Posts

    146
  • Joined

  • Last visited

Everything posted by Bhishan

  1. 1. I forgot to post the error code and instead pasted the screenshot, with apologies, I have included the error log for the command of `qlmanage -p a.sh` $ /usr/bin/qlmanage -p a.sh Testing Quick Look preview with files: a.sh 2019-05-11 12:43:43.026 qlmanage[2234:143427] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x933f, name = 'com.apple.coredrag' See /usr/include/servers/bootstrap_defs.h for the error codes. Segmentation fault: 11 2. the error log says look at `/usr/include/servers/bootstrap_defs.h` but there is no directory called 'include' inside '/usr' and hence no file `bootstrap_defs.h`. 3. `qlmanage -p -d1 a.sh` full error log: Process: qlmanage [3157] Path: /usr/bin/qlmanage Identifier: qlmanage Version: 775.5 Code Type: X86-64 (Native) Parent Process: bash [2174] Responsible: qlmanage [3157] User ID: 501 Date/Time: 2019-05-11 14:47:34.063 -0400 OS Version: Mac OS X 10.14.4 (18E226) Report Version: 12 Bridge OS Version: 3.0 (14Y677) Anonymous UUID: 7DE74171-844A-93C0-0F1A-0107803E2F17 Sleep/Wake UUID: 85F49D0C-EF83-49C5-9B22-6AA6573AB534 Time Awake Since Boot: 14000 seconds Time Since Wake: 3900 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000020 Exception Note: EXC_CORPSE_NOTIFY Termination Signal: Segmentation fault: 11 Termination Reason: Namespace SIGNAL, Code 0xb Terminating Process: exc handler [3157] VM Regions Near 0x20: --> __TEXT 000000010169e000-00000001016f7000 [ 356K] r-x/rwx SM=COW /System/Library/Frameworks/QuickLook.framework/Versions/A/Resources/quicklookd.app/Contents/MacOS/qlmanage Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 com.apple.WebKit 0x00007fff4e63d472 WebKit::ChildProcessProxy::state() const + 4 1 com.apple.WebKit 0x00007fff4e77389e WebKit::NetworkProcessProxy::removeSession(PAL::SessionID) + 26 External Modification Summary: Calls made by other processes targeting this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by all processes on this machine: task_for_pid: 8703 thread_create: 0 thread_set_state: 0 VM Region Summary: ReadOnly portion of Libraries: Total=516.6M resident=0K(0%) swapped_out_or_unallocated=516.6M(100%) Writable regions: Total=1.1G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=1.1G(100%) VIRTUAL REGION REGION TYPE SIZE COUNT (non-coalesced) =========== ======= ======= Accelerate framework 256K 2 Activity Tracing 256K 1 CG image 1028K 1 CoreGraphics 8K 1 CoreUI image file 224K 6 Dispatch continuations 8192K 1 Foundation 4K 1 JS JIT generated code 1.0G 3 Kernel Alloc Once 8K 1 MALLOC 52.7M 28 MALLOC guard page 32K 8 SQLite page cache 64K 1 STACK GUARD 56.0M 6 Stack 10.5M 6 VM_ALLOCATE 140K 8 WebKit Malloc 4216K 5 __DATA 43.1M 366 __FONT_DATA 4K 1 __GLSLBUILTINS 5176K 1 __LINKEDIT 221.6M 6 __TEXT 295.0M 368 __UNICODE 564K 1 mapped file 45.4M 16 shared memory 676K 11 =========== ======= ======= TOTAL 1.7G 849 Model: MacBookPro14,2, BootROM 190.0.0.0.0, 2 processors, Intel Core i7, 3.5 GHz, 16 GB, SMC 2.44f1 Graphics: kHW_IntelIrisGraphics650Item, Intel Iris Plus Graphics 650, spdisplays_builtin Memory Module: BANK 0/DIMM0, 8 GB, LPDDR3, 2133 MHz, 0x802C, 0x4D5435324C31473332443450472D30393320 Memory Module: BANK 1/DIMM0, 8 GB, LPDDR3, 2133 MHz, 0x802C, 0x4D5435324C31473332443450472D30393320 AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x171), Broadcom BCM43xx 1.0 (7.77.61.2 AirPortDriverBrcmNIC-1305.8) Bluetooth: Version 6.0.11f4, 3 services, 27 devices, 1 incoming serial ports Network Service: Wi-Fi, AirPort, en0 USB Device: USB 3.0 Bus USB Device: USB2.0 Hub USB Device: USB 2.0 Hub USB Device: Keyboard Hub USB Device: Apple Optical USB Mouse USB Device: Apple Keyboard USB Device: USB 2.0 BILLBOARD USB Device: iBridge USB Device: USB3.0 Hub Thunderbolt Bus: MacBook Pro, Apple Inc., 39.2 Thunderbolt Bus: MacBook Pro, Apple Inc., 39.2 4. Also, since qlmanage is not working, an alternative might also be using applescript and avoiding qlmanage altogether.
  2. # Given solution works in office compute but does not work in my laptop Office computer: macos Yosemite, clean nothing quickview qlgenerators installed Laptop: macos mojave and some quickview qlgenerators installed (eg. QLColorcode) - /usr/bin/qlmanage -p a.pdf # it works despite some warnings - /usr/bin/qlmanage -p a.sh # it does not work (qlmanage fails) - NOTE: hitting space on a.sh works on finder - NOTE: hitting cmd-y on a.sh works on finder That is why I was looking a way using "APPLESCRIPT". I am hardly familiar with AppleScript, but I feel I was pretty close to the solution in the third part of the applescript workflow in my question.
  3. I am attempting to create a workflow that pastes the contents of clipboard to a file and opens that file using QuickView. The simpleset approacth would be `qlmange -p myfile.ext`, but for some reasons my computer is not working `qlmanage -p ` command and I have to use `applescript`. Here is link of my workflow: https://github.com/bhishanpdl/Shared/blob/master/Alfred_questions/aa Clipboard QuickView.alfredworkflow?raw=true Here is outlook of my workflow: # part1: Keyword # part 2: Bash # if argument exist if [[ $# -gt 0 ]] ; then OUT="a.$1" fi # if arg doesnot exist if [[ $# -eq 0 ]]; then OUT="a.py" fi pbpaste > ~/Dropbox/$OUT echo -n "~/Dropbox/$OUT" # part3: Applescritpt property folderPath : "/Users/poudel/Dropbox" on run {} tell application "Finder" activate set myFolder to folder (folderPath as POSIX file) set myFile to first item of myFolder -- set myFile to quoted form of (item 1 of argv) select myFile tell application "System Events" to keystroke "y" using command down end tell end run **Question** 1. In part3 I want to avoid hard coding "/Users/poudel/Dropbox" to "~/Dropbox" so that I can use the workflow in the office computer and my own laptop both. 2. The workflow is not working currently, I am struggling to select the file by its name. Help with workflow is appreciated.
  4. I believe it would be an astonishing feature if there is an option to press "shift" key at snippet so that it stays in floating window so that we can see the codes/notes/any snippet and work altogether. Ideas of implementation: - Using QuickView - Using Helium app which supports floating browser Bonus: It would be even nicer if the codes are syntax highlighted (reading shebang of snippet) Hope we can see this feature in some of the upcoming versions of Alfred.
  5. +1 I would also like to see this feature in upcoming version.
  6. @deanishe I have uploaded the workflow here: https://github.com/bhishanpdl/Shared/blob/master/Alfred_questions/aa Clipboard to Snippet - COPY.alfredworkflow?raw=true I am looking a way to create dynamic trigger using argument from the alfred workflow.
  7. @deanishe Where are the snippets stored? May be If I create a directory "TemporarySnippets" in that folder and create a text file/json file/ whatever and call the snippet trigger afterwards?
  8. I tried this: try to create dynamic trigger from the alfred workflow but, it did not work: - snn hello ==> creates hello.txt and var:arg is set to "hello" - tried to use that varible to make trigger object, but failed. It creates hello.txt but u;hello does not work.
  9. @deanishe I guess I got what you mean: workflow: Keyword sni ==> get argument name to "arg1" ==> Snippet and use "arg1" as trigger name. I will try this method. If I could not manage to get it done, will seek further suggestion.
  10. **Update** I could not create Snippet triggers, but found alternative route using Alfred Keyword. "sni hello" will create "hello.txt" from the clipboard. "sno hello" will read that "hello.txt" and paste to the frontmost application. This works great, but I am only missing "u;hello" and "u;hi" etc where I can simply type, instead of hitting keys.
  11. Because, lets say i have a code snippet from pandas groupby in python: gp1 = => daily = flights.groupby(['year','month','day'],as_index=False) and another snippet as gp2 = => daily = flights.groupby(['year','month','day'],as_index=True) It would be easier to type u;gp1 and u;gp2 than go to clipobard manager and search for clipboard history.
  12. It would be extremely useful if we can create snippets on-the-fly from the clipboard contents. For example: "snip tmp" will create a snippet called "u;tmp" from the clipboard content. So that when typing "u;tmp" will expand that snippet automatically. For only one snippet I can do this: =========================== Alt shift t ==> copy the clipboard to tmp.txt u;tmpp ==> autoexpand the text after reading from tmp.txt from that workflow directory. But, this works only for one snippet. It would be nicer if it can be done more dynamically. The suggestion is much appreciated. I have provided MWE in the github shared file: https://github.com/bhishanpdl/Shared/blob/master/Alfred_questions/aa Clipboard Copy.alfredworkflow?raw=true
  13. Nevermind, I can confirm it works, I was just confused by dropbox log in request.
  14. @Jasondm007 I was also trying to achieve the same. I found your link useful but the link is broken, may be you can share it in github or bitbucket so that it will remain infinitely! Thanks.
  15. I was trying to write an Alfred workflow to replace a single letter/number (or substring) from the copied text. Here is what I have done: query=$1 old_new=($query) old=${old_new[0]} new=${old_new[1]} copied=$(pbpaste) changed=${copied/$old/$new} echo -n $changed Here is the link to my workflow in github: https://github.com/bhishanpdl/Shared/blob/master/Alfred_questions/replace.alfredworkflow?raw=true But, this workflow is not working for MULTI-LINE . How to fix the workflow? Example test ========== s = 'hello' print(s[0]) After running the command "replace 0 1" I would like to have: s = 'hello' print(s[1])
  16. 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
  17. @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')
  18. @deanishe Yes, Alfred's Large Type works fine. But, how to pipe the outputs of "snip hello" to the Large Type ?
  19. 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
  20. @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?
  21. 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
  22. 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?
  23. The link https://transfer.sh/gSsvH/Get-News.alfredworkflow is broken.
  24. 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
×
×
  • Create New...