Jump to content

ctwise

Member
  • Posts

    307
  • Joined

  • Last visited

  • Days Won

    23

Posts posted by ctwise

  1. Thanks for the answer ctwise but I'm not sure I understand that. Where do I attach this keyword? There's no URL in this workflow.

     

    Create a new workflow. Add a keyword input. Use whatever keyword you like, e.g., 'focus'. Give it a title, e.g., 'Toggle Focus'. Add an Open URL action. Use the URL 'focus://toggle'. Connect the input to the action. You're done. Now when you invoke Alfred, entering the keyword will toggle Focus.

  2.  

    I'm using a small todo app called Focus. What I need is a workflow to make a new todo without opening the app. I'm using a modified workflow (I modified it from the new calender event) but that opens the app. To continue working I would like a workflow that does not open the app but makes a new entry in the background like what happens when I use the Evernote workflow. Can anyone help me with a script to do that. The script I use now looks like this:

     

    set newAppt to "{query}" as string

     
    tell application "Focus" to activate
     
    tell application "System Events"
    keystroke "n" using {command down}
    keystroke newAppt
    keystroke return
    end tell

     

     

    Luckily, it's trivial, just attach a keyword to the Open URL action with the URL 'focus://toggle'.

  3. I'm writing a simple script that takes

     

    1. the currently highlighted text,

    2. the clipboard text, 

     

    And creates a new piece of text with both.  

     

    Sadly it doesn't work because it looks like Alfred totally kills the clipboard text.

     

    I have a workflow with

     

    1. a hotkey with "pass through to workflow" and Argument set to "Selection in OS X"

    2. A script.  

    X=`pbpaste`
    echo "[{query}](`pbpaste`)`echo $X`" | pbcopy
    

    Basically, "X" is always set to "{query}".  It looks like Alfred totally kills the clipboard text when an argument is sent.

     

    Can someone please verify this is a bug?

     

    PS I'm looking for a way to highlight "foo" while "http://bar" is in the clipboard, and it generates markdown: [foo](http://bar)

     

    As far as I am aware, it's not a bug. The only way for Alfred to get the current selection in another app is to trigger a pasteboard copy. I believe what you're really after is script access to the Alfred clipboard history.

  4. I think a {selection} token, used like {query}, would be a better solution. Internally, Alfred captures the selected text on opening and passes the text of the cached selection to instances of {selection}.

    Then the original clipboard should be preserved to prevent confusion for other apps that depend on the clipboard (like MenuClip). Alfred has had to deal with other apps that hijack the clipboard; it seems silly to do implement a similar behavior into Alfred himself…

    Please correct me if I'm misunderstanding the technical details

     

    There's a big problem with that - large amounts of text.

  5. See this conversation - http://www.alfredforum.com/topic/5137-services-and-workflows/

     

    It would be extremely useful if Alfred automatically copied any selected text to the pasteboard when it was invoked, and, when Alfred closes, clean up the pasteboard if it hasn't otherwise changed. For example, if the pasteboard looked like this:

     

        "Some old text on the pasteboard"

     

    But the user selected the text:

     

        "I want this text auto-copied"

     

    Then the "I want this text auto-copied" would be sitting on the pasteboard when Alfred was invoked, before workflows executed.

     

    When Alfred closes, if the auto-copied text was still sitting on the pasteboard, Alfred should restore the original text to the pasteboard, adjusting pasteboard history as appropriate. The intent being that workflows can get access to selected text when Alfred is invoked or ignore it if they're not interested and not be surprised by the pasteboard containing something when they didn't explicitly invoked copy.

     

    At the moment this behavior requires creating a hot-key and requesting that the selection in OS/X should be passed through. See http://www.packal.org/workflow/funnel for an example of a workflow that uses this feature to implement text filters on selected text.

     

    But, if the requested feature were implemented then funnel/filter-like workflows could be broken up into individual workflows that acted on text selections instead of requiring a different hot-key for each separate workflow.

  6.  

    • Ability to copy an item or piece of text and to pass it to another application or service/workflow. How would I do it in alfred? Is there a placeholder for the most recent content of a clipboard and a way to use services on it?

     

     

    You can get half-way there. The problem is that Alfred doesn't automatically trigger a copy when it is invoked and then restore the old pasteboard when it closes. Because of that, you don't have access to the app that had focus when Alfred was triggered and you can't copy text. Now that I've written that, I realize it should be a feature request.

     

    There's a way around this but it requires using a hot-key. If you create a hot-key in a workflow, you can choose to pass-through 'Selection in OS/X'. Then the text you selected is copied to the pasteboard for use by the next step in a workflow. This is only half of what you're asking for, because the selection is only usable in that specific workflow. Take a look at the Funnel workflow (http://www.packal.org/workflow/funnel) to see a workflow that uses that feature to pump selected text through a user-configurable set of filters, e.g., lowercase, uppercase, remove blank lines, base64 encode/decode, etc.

  7. This is content of the menu dump file and I am using Mavericks os. 

     

     /Library/Application\ Support/Alfred\ 2/Alfred.alfredpreferences/workflows/user.workflow.7ACA3ED0-0BB3-4F53-BD3E-74DA8D92977F/menudump ; exit;

    The menu structure wasn't readable. Make sure that 'Enable access for assistive devices' is checked in OS/X Settings.logout

     

    Ok. :-)

     

    Do you have Accessibility turned on for Alfred? The scripts run as Alfred. 

  8. Hi, This is the awesome workflow which is most lovable feature in Ubuntu https://www.youtube.com/watch?v=w_WW-DHqR3c and missed it so badly in Mavericks and you made my day.

     

    The only problem which I have now is it does not show the menus for the chrome browser ? what should be done in order to fix that ? 

     

    I have installed the latest version from packal

     

    I'm guessing it's the difference between OS/X menu handling and Unity (or whatever Ubuntu is using in that video). Many apps in OS/X do funky things with the menus and entries don't get updated or registered with OS/X. For example, an undo command may say 'Undo <action>', but OS/X has it listed as just plain 'Undo'.

     

    That said, Chrome menu entries show up just fine on my system.

  9. A few things:

     

    1. Alfred isn't running scripts from the command-line. There is no shell environment present, only the GUI environment. So your executable paths aren't present. Even when you run a bash script, bash is being started and stopped with the GUI environment as a non-login shell.

     

    2. Any scripts you run using a relative path, e.g., 'start.rb', must be in the workflow directory. Otherwise you need to give the absolute path to the script.

     

    3. You can run Ruby (and Python and Perl and Applescript) directly by putting in the code window and choosing the appropriate language from the dropdown.

     

    4. The Ruby you're running is the system Ruby, not one you may have installed using RVM (or other tool).

     

    5. In general when you're passing the {query} to a script or command you want to double quote it. And then check the Escape Double Quotes script option. Basically, whatever you're wrapping the {query} in needs to be escaped, e.g., backticks, etc.

  10. Edit : Updated this to make more sense

     

    We use Ringcentral at work but the RingCentral app for Mac is horrible, IMO. I've been playing around with the API where you pass variables in the URL and it will dial the phone number for you. 

    See below for the example of what it looks like:

    Note: The URL is correct I've changed all my values. 
    
    https://service.ringcentral.com/ringout.asp?cmd=call&username=8005551212&ext=123&password=password123&to={query}&from=4155551212&prompt=0

    Now I can get this to work, for the most part, from doing the following.

     

    1. Go to features
    2. Click Contacts
    3. Click the + for custom actions
    4. Field = Phone
    5. Action = Pass to URL Scheme
    6. Then I put the above line in the next box

    This works. I use Alfred to look up my contact, click the phone number and it opens up a web page, passes the URL complete and dials the phone.

     

    Two Issues I have that I hope I can get some help with : 

    1. I really would rather not have a browser open. Is there a way that something can be done behind the scenes without the browser opening to pass the URL (this might be a dumb question but I figured I would ask).
    2. RingCentral, for some reason, even though I'm passing my credentials via the URL still wants me to have a session cookie in the browser otherwise I get an invalid username and password. Seems kind of strange but it might be a RingCentral limitation. 

    Thanks for the help

     

    Josh

    PS. While I love this program it's absolutely killing me trying to find new ways to use Alfred to improve my daily work.  :)

     

    Take a look at the 'curl' command. It has a lot of options for GETing URLs.

  11. As far as I can tell, the only way to get this to display is by including an app bundle in a workflow, right?  I tried an Applescript object and a Script -> osascript object and neither produced a progress window or anything in the Alfred workflow log.

     

    I think you're right. I let my enthusiasm take me away. :-) I'm not sure if it's possible for Alfred to serve as the progress display "handler". I notice that the script editor displays the progress with a pie chart and logging messages in the bottom of the script window, so at some level it should be possible.

  12.  

    First of all: great workflow! And thanks Ted :)

     

    I've just installed Fusion 7 and it is not running on my end. Here is the debug output that you asked for:

    [ERROR: alfred.workflow.input.scriptfilter] Code 1: vmware.rb:63:in `block in inventory_list': undefined method `length' for nil:NilClass (NoMethodError)
    from vmware.rb:63:in `each'
    from vmware.rb:63:in `find_all'
    from vmware.rb:63:in `inventory_list'
    from vmware.rb:25:in `list'
    from main.rb:11:in `generate'
    from main.rb:45:in `start'
    from main.rb:125:in `<main>'

     

    You're using an old version of the script. Please install the one on packal.org.

  13. I've been playing around with the new JavaScript for Automation in Yosemite, and I must say that I've been smitten. It so much more predictable than AppleScript. However, I'm a noob when it comes to scripting in general.

    So, on that note, does anyone know how I should be implementing JavaScript into my Alfred workflows? It won't run in a NSAppleScript action, nor will it run if I put in in a Run Script action with the language set to osascript. I was able to get it to work if I placed the script inside the workflow folder and ran it with a bash command, but then how do I grab the arguments in the script?

    Thanks!

     

    Either wait for a new release that supports it or run it using the shell 'osascript' command.

  14. Just noticed this after installing Yosemite:

     

    Progress Reporting

    AppleScript now has built-in support for reporting progress in a script. The global AppleScript object has four new properties:

    • progress total steps (an integer)

    • progress completed steps (an integer)

    • progress description (text)

    • progress additional description (text)

    A script may set any of these properties at any time during the script to update the progress display. progress completed steps divided by progress total steps provides the fraction completed; if completed or total is -1, progress is considered indeterminate. progress description and progress additional description provide a message about what the script is doing.

    Exactly how the progress is displayed depends on how the script is run: in Script Editor, it appears in the script window’s status bar; in script applications (applets), it appears as a progress dialog; and for scripts run from Script Menu, it appears in the Script Monitor menu. (Script Monitor appeared in previous system releases, but was only used for Automator workflows; it now displays any script run using NSUserScriptTask, which includes anything run from Script Menu.)

     

     

  15. I use menu search all the time in Apple mail to move email to local email boxes. Since yesterday it's acting up. But only in Apple Mail.

     

    I want to reset or remove the cache to see if that helps. Where can I find this cache on the filesystem? Any help is appreciated!

     

    Only the very first version of the workflow used a cache. If you're still using the initial version you should get the later one off of Packal. If you're already using the latest version then you can go into the workflow directory and run './menudump --yaml -- pid <n>' from the command-line to see what the script thinks the menu structure is for a given app. You get the pid number from the ps command, e.g., 'ps -ef'.

  16. Very, very, very few workflows will benefit from compilation. Most workflows actually _do_ very little work. If a script takes 100 milliseconds and a compiled version takes 10 milliseconds, you won't be able to tell the difference. The exception is when your workflow takes seconds to run _and_ the reason for the delay is computation, not network lag. A much more likely reason for compiling code for a workflow is that it's the only (or easiest) way to interact with something in OS/X.

  17.  

    Hum :/ Not proud of myself here, and I feal kinda dumb, but even after reading a little bit more from what you told me, I have seriously no idea what I’m doing…!

     

    Here is my file script.sh

    #!/bin/bash
    open focus://focus

    And here is me trying to run it from terminal, and failling!

    Jolins-iMac:~ jolinm$ chmod +x /Users/jolinm/Desktop/script.sh 
    Jolins-iMac:~ jolinm$ /Users/jolinm/Desktop/script.sh 
    The file /Users/jolinm/focus:/focus does not exist.
    Jolins-iMac:~ jolinm$ .//Users/jolinm/Desktop/script.sh 
    -bash: .//Users/jolinm/Desktop/script.sh: No such file or directory
    Jolins-iMac:~ jolinm$ /Users/jolinm/Desktop 
    -bash: /Users/jolinm/Desktop: is a directory
    Jolins-iMac:~ jolinm$ ./script.sh
    -bash: ./script.sh: No such file or directory
    Jolins-iMac:~ jolinm$ chmod +x script
    chmod: script: No such file or directory
    Jolins-iMac:~ jolinm$ chmod +x script.sh
    chmod: script.sh: No such file or directory
    Jolins-iMac:~ jolinm$ /Users/jolinm/Desktop/script.sh 
    The file /Users/jolinm/focus:/focus does not exist.

     

     

    You got it right, the script isn't working due to a problem with Focus, not with your script. You'll have to take it up with the Focus developer.

  18. Actually, that is exactly what I got, but nothing’s happening. I also tried to run the line in the Terminal, but I don’t know how I need to type in to make it works…

     

    Create a text file and save the contents in it. Make it executable from the command line with 'chmod +x <scriptname>'. Run it from the command line './<scriptname>'

×
×
  • Create New...