Jump to content

waldrumpus

Member
  • Posts

    4
  • Joined

  • Last visited

Posts posted by waldrumpus

  1. 6 hours ago, nikivi said:

     

    I always wondered why would one run AppleScript on the main thread if `Run Script action with Language = /usr/bin/osascript (AS) instead` exists?

     

    In my case it's because this is my first Alfred workflow and I'm just getting into things 😅

     

    I was in fact working on writing a shell script that would execute the AppleScript when deanishe's reply arrived. The fact that the "Run Script" action has a setting for running osascript, and concurrently to boot, is of course fantastic.

  2. 9 hours ago, deanishe said:

     

    It's very strange that it takes so long. Communicating with applications via AppleScript is certainly slow, but normally no more than two seconds, not 30+.

     

    I timed some consecutive executions; it takes 37 seconds on average until the Reminders app becomes responsive again and Alfred presents the notification at the end of the workflow. If I run the same script from the Script Editor, it takes about 3 seconds.

     

    I assume the delay is located in the Reminders app, but I have no idea how to diagnose this further.

  3. 2 hours ago, deanishe said:

    Run NSAppleScript is executed on Alfred's main thread, which is why it's blocking.

     

    That's the kind of thing I was hoping for. Excellent solution!

     

    I configured it like this, with the "running instances: concurrently" being an important setting.

     

    image.thumb.png.922ebb2a935240195ec7342dd29c2629.png

     

    It still takes a large amount of time for the reminder to appear, but since Alfred remains responsive, I can continue to work immediately, and even fire off the next "buy ..." command, which is what's important to me.

  4. I've created a workflow that adds a reminder to a pre-determined list in Reminders. E.g. if I type "buy Apples" into Alfred, it adds the item "Apples" to the list called "shopping list" in Reminders. The workflow uses an AppleScript to create the reminder.

     

    The workflow looks like this: "Keyword > Run AppleScript > Post Notification"

     

    This is the AppleScript:

    on alfred_script(q)
    	tell application "Reminders"
    		tell list "Einkauf"
    			set newremin to make new reminder
    			set name of newremin to q
    		end tell
    	end tell
    end alfred_script

    If I run this script by itself in the Script Editor, it takes 2 to 3 seconds to execute. However, if I run the workflow, it takes about 40 seconds before the Notification at the end appears. During this time neither Alfred nor Reminders will respond.

     

    Is there a way to speed up this process? Maybe there's a better way to execute scripts from within a workflow? It could be that the fault is entirely on Reminders' side; in which case I'd love to know if a workaround exists.

×
×
  • Create New...