Jump to content

bikeNik

Member
  • Posts

    47
  • Joined

  • Last visited

Posts posted by bikeNik

  1. On 10/21/2019 at 3:58 PM, CuteCat said:

    Downloaded latest update and ankiconnect but im getting a message saying waiting-for-refresh. Nothing happens when I use the refresh under settings, would appreciate some advice!

     

    @CuteCat

     

    For my WF I changed the next section in python files (__init__.py) in AnkiConnect add-on: 

     

        @api()
        def loadProfile(self, name):
            if name not in self.window().pm.profiles():
                # return False
                return self.window().pm.profiles()
            if not self.window().isVisible():
                self.window().pm.load(name)
                self.window().loadProfile()
                self.window().profileDiag.closeWithoutQuitting()
            else:
                cur_profile = self.window().pm.name
                if cur_profile != name:
                    self.window().unloadProfileAndShowProfileManager()
                    self.loadProfile(name)
            # return True
            return self.window().pm.profiles()

    I changed lines in comments - ("return False" & "return True")

  2. was updated:

    - moved the database to /Users/…/Library/Application Support/Alfred/Workflow Data/org.bikenik.anki

    - update for Alfred 4

     

    (please, save (backup) your data which in the workflow folder (json files) before updating)

  3. youtube-bookmarks + dashboard [Safari]

    main-window main-window

     

    Install

    $ npm install --global alfred-youtube-bookmarks

    or as youtube-bookmarks.alfredworkflow and then in the directory of Workflow run npm install to install node modules.

    Requires Node.js 7.6+ and the Alfred Powerpack.

    for use youtube API you need to create a project in Google Developers Console. It was explained in this article. For this workflow required 'Google Client ID' and 'Google Client Secret'.

    Bookmarks work without Google Authorisation.

    Usage

    In Alfred, type yt, Enter, and your query.
    It will be work with Safari & Chrome only.

    Bookmarks

    • To create bookmark needs to have opened Safari's/Chrome's window with youtube's video player active tab.
    • Adding multiple tags is implemented through comma.
    • type some shortcut (⌥⌘B - for example) to create bookmark
    • type some shortcut (⌥⌘S - for example) to show and go through the bookmark in the current playing video.
    • fn+↵ to delete one or several bookmarks (in specific filters will be deleted all bookmarks in the current filter)
    • hit  To open preview window by any bookmark.

    Setting for Chrome

    View => Developer => check "Allow Javascript for Apple Evenst"

     

  4. 14 minutes ago, deanishe said:

    I suppose you could also have your script expand escapes, so you could enter \n for a newline.

     

     

    mm.. I don't think so. The point is, I need to see this new line in Alfred's query box with Large-Type (⌘L). And it won't convenient to edit the current field. So I think to make the trigger snippet like (>>n) which contains line break - would be better. I'm just pasting empty line break.

  5. Update: Added Markdown-it  library for use markdown. This awesome library works with Syntax highlighting (highlighjs.org)

    To quick add some markdown highlighting code into Anki field via Alfred:

    ```js
    function $initHighlight(block, cls) {
      try {
        if (cls.search(/\bno\-highlight\b/) != -1)
          return process(block, true, 0x0F) +
                 ` class="${cls}"`;
      } catch (e) {
        /* handle exception */
      }
      for (var i = 0 / 2; i < classes.length; i++) {
        if (checkCondition(classes[i]) === undefined)
          console.log('undefined');
      }
    }
    
    export  $initHighlight;
    ```

    I use a little lifehack with Alfred's snippet trigger (which has line breaks). Cause I suppose Alfred doesn't allow to carry a new line of in his input's field. 

  6. Ok. One more attempt to make the workflow for Anki cards generating. Or rather filling into Anki fields the content via Alfred. For me this way much handy than native Anki app. Obviously, it's not a full replacement for all cases. Something like Anki-Express.

     

    Anki: Powerful, intelligent flash cards.

     

    anki card generator: Create New Cards into any Decks with any "Note Type".

    image.png.e2f05bfd698f9178a80b5bbec933f3d5.png

     

    image.png.f23cc748d630e12803f60667e34e7bd1.png

     

     

    Install

    $ npm install --global alfred-anki

    or as anki.alfredworkflow

     

     

    Requires: Node.js 7.6+, Alfred Powerpack, Anki intelligent flashcards, AnkiConnect plugin for Anki

    Also you can consider DrLulz/Anki-Templates

    Usage

    On the card fields:

    • hit ⌃ + ↩ to remember last input after created card.
    • hit ⌃ + ↩ one more time to toggle switch this option
    • hit ⌥ + ↩ to reset text from all fields
    • hit (shift) to preview parsed fields of the card
    • for line break type '\n' (with space or without), also should be handy to use 'Alfred's snippets'.
    • to add an image from clipboard use Alfred snippet >>img needs install pngpaste
    • check out another Alfred's snippets

     


    • To use your own icons for your Model's fields just you should call the png files the same as fields [name-of-field].png and put it into icons folder of this Workflow directory. Recommended use two instances of each icon where second icon (with some mark) will be called as [name-of-field]_marked.png for "remember last import" option.

     

    ToDo

    •   Add sound to the field. (needs something universal)
    •   Add to the card and move the local image file to the foldercollection.media via Alfred Snippet

     

    p.s. It would be great to hear some more feature ideas to improve workflows like this.

     

  7. 35 minutes ago, Chris62 said:

    I'm really unsure if this is the right track.

     

    I'm using Udemy (and other video-player application) with "Alfred remote" and with any the tactile interaction should be much handier, I think. Good idea.

  8. @ppl4world

    My solution is very trivial but it's required that meet with your expectations if I understood you correctly.

    If you want to create a video meeting?

     

    https://plus.google.com/hangouts/_

     

    Workflow:

    Workflow (drive.google.com)

     

    Required:

    make login in your Google account in Chrome browser to (create cookies)

     

    Optional:

    the configuration of WF - optional: setting the variable "delayForRequire" depending on your network speed: by default - 3 sec.

     

    Collection of some useful links (by the results of searching this solution):

    Zappier: Google Hangouts Chat Integrations [upcoming]

    doc: Zapier for Alfred: Run Automated Workflows From Your Mac Keyboard

    medium: OAuth2 and Google OAuth Playground

    some blog: Creating Google Hangouts With Apps via URL

     

    --------------------------

    bikenik's PayPal

  9. 39 minutes ago, deanishe said:

    it's possible Alfred will start running your Script Filter again before it starts the other one

    I'm acting empirically: And in my example, the data of time change only one time in 30 seconds. So at least, I do know about it to a certain. 

    concurrently-test.gif.1c73014babc53561ca67287aa07a3b15.gif

     

    Well, I see. it's very valuable information for me. I'll read about it.
    Now I know exactly I don't know enough about background processes. Thanks again!

  10. 17 hours ago, deanishe said:

    Most of my workflows have Script Filters that launch longer-running background jobs to fetch data or check for updates. If you're interested this is the API I wrote for doing that, and here's the demo workflow showing how to use it.

     

    I'm not good enough in NodeJs (apparently) to start learning "GO" language at this moment. But your API ("awgo") is on the first thing that I'll to take for learning GO language. Thanks for the suggestion! 

     

    This decision (Nodejs) which I'm taking is: 

    if (!alfy.cache.get('start-PID')) {
    	alfy.cache.set('start-PID', process.pid, {maxAge: 30000}) // 30 sec.
    }
    
    const run = async () => {
    	if (alfy.cache.get('start-PID') === process.pid) { // prevent launch for 30 seconds
    		await runApplescript(`
    		tell application "Alfred 3"
    			run trigger ¬
    				"concurrentlyUpdate" in workflow ¬
    				"org.bikenik.concurrently"
    		end tell
    		`);
    	}
    	alfy.output([{
    		title: refreshDate.title,
    		subtitle: refreshDate.subtitle,
    		icon: {path: './time-icon.png'},
    		arg: refreshDate.subtitle
    	}]);
    }
    run()

    So I limit to running this script at least for 30 seconds. 
    Did you do something similar in your script? As I see ... 

    I'm going to continue to seek another solution.

  11. Seems I resolved this challenge with the trigger [External]
    who would have thought : )

    463208672_Screenshot2018-12-04at16_38_12.png.2103ca2bbe0c2229e30ca1d3d256fcaa.png

    In Script Filter I invoked AppleScript command:

    ./node_modules/.bin/run-node index.js '$1'
    osascript -e "tell application \"Alfred 3\" to run trigger \"concurrentlyUdate\" in workflow \"org.bikenik.concurrently\""

    370653249_Screenshot2018-12-04at16_34_56.png.11af7b0fa884ba887d49936a650b47c8.png

     

    Thanks for the support!!

     

    p.s. But I'm not sure how many times this AppleScript command will be invoked? Only once, when I type [keyword]?

  12. 1 hour ago, deanishe said:

    What exactly are you trying to achieve?

     

    I want to write JSON file by the network request (this process takes about 5 seconds)  asynchronously with another ONE script sent with the result to a Script Filter. 
    In my workflow example, the file "update-concurrently.js" generates JSON file with current time data (like a network request with 5 seconds delay). I want to invoke this file asynchronously (concurrently) with [Script Filter] (where I invoke "index.js" file) 
    I would like to get the result of the possibility of this operation.

     

    Many thanks, @deanishe I'll try with your suggestions. with STDOUT and STDERR. I'll figure something out...

     

    ---------------- UPDATE -----------

    const items = {
    	items: [{
    		title: refreshDate.title,
    		subtitle: refreshDate.subtitle,
    		icon: {path: './time-icon.png'},
    		arg: refreshDate.subtitle
    	}]
    }
    
    const run = async () => {
    	await process.stdout.write(JSON.stringify(items)) // to show old data of time from JSON file in Alfred "Script Filter"
    	setTimeout(runUpdate, 5000); // delay 5 seconds for gerenerate JSON file with current data of time.
    }
    
    run()

    got the same 5 seconds latency.

×
×
  • Create New...