Jump to content

shmulvad

Member
  • Content Count

    7
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by shmulvad


  1. 1 hour ago, deanishe said:

     

    FYI, XML feedback has been deprecated for quite some time now. You should generally use JSON in new workflows. Not least because it's easy to do without needing any libraries.

     

    Okay, I didn't know that - thanks for letting me know! :)

    The workflow is now updated to use JSON. I'll agree with you, that is much cleaner.


  2. Roman Numeral Converter

    Convert between roman numerals and arabic integers

     

    Installation

    1. To download, visit the latest release at GitHub.
    2. All further updates are handled automatically.

     

    Description

    This is a fairly simple workflow for converting between roman numerals and arabic integers. This has been made before by Tyler Eich (Packal link), but hasn't been updated since 2015 and stopped working on my computer during an Alfred or macOS update (can't remember which). But I had an use case for this, and therefore I made a new version written in Python for this simple task.

     

    In Alfred, type rn and enter either your roman numeral or arabic integer. Selected result is copied to your clipboard. 

    arabic_to_roman.png

    roman_to_arabic.png

     

     

    The expression is being evaluated as you type it. If the expression cannot be evaluated, for example if you are using illegal characters, user will be notified about that. 

    gibberish.png

     

    Note

    The workflow doesn't support incorrectly written roman numerals, i.e. "IC", and will also notify user about this:

    invalid_roman.png

     

    Credits

    The workflow makes use of the following code to focus on the implementation of the conversion between the number systems rather than focusing on a lot of Alfred Workflow related stuff.

    1. OneUpdater to easily check for updates by vitorgalvao.
    2. Alfred Workflow Feedback XML Generation to easily add items by lrrfantasy.

     

     


  3. 1 hour ago, vitor said:

     

    What does that exactly mean? You’ll need to provide further details for me to be able to help. Does it only work sometimes? Does it never work? Does it do something different than expected?

    • Open the debugger, set the log output to “All Information”, do the action and post the output.

    • What’s your exact Alfred version?

    •  

      What’s your exact macOS version?

     

    After first reinstalling the workflow and then restarting my Mac it now works again. I am (and was) using macOS 10.14.1 and Alfred v. 3.7.

    Sorry for not trying this out before commenting.


  4. I really wanted the feature I describe above, so I went ahead and modified the code to achieve this behaviour. I don't have any experience with Perl, so I guess the stuff I have rewritten is pretty poorly written code, but for now it works. This is what is now shown when the workflow is called with an expression that can be evaluated:

    RMgMDW7.png

     

    And this is what it looks like when you insert an expression that can't be evaluated:

    VcHG7dL.png

     

    I have forked the original repo and made a pull request. For now, the modified workflow can be downloaded from here,


  5. I really find this workflow useful and have been using it a lot.

     

    Would it be possible to add to it, so that instead of having to press a modifier key to copy different results other than binary and then view them, the result in both decimal, hex, binary and octal is immediately printed to the screen as four separate items in Alfred? And then copying a result is just done by selecting the corresponding item?


  6. Hey

     

    I'm trying to make an AppleScript to be run from Alfred, that should quickly set a specified speaker as audio output device if it is currently connected (in example below "My Awesome Speaker"), and otherwise don't do anything. I have gotten most of the functionality down (toggling between speaker/internal speaker), but I'm having a problem in the instance that the speaker isn't connected.

     

    When this is the case, the script has already clicked on the audioMenu, making the dropdown be there until a mouse click. I thought I could make it go away by branching with an "if else" and then if the speaker isn't connected, then just clicking the audioMenu again (because I've seen similar behaviour (with succes) for other menu bar scripts). But if I instead do this, the audio dropdown will still be staying until a click has been made, and then the script clicks the audio icon again making it doubly annoying.

     

     

    on alfred_script(q)
    
    set speakerName to "My Awesome Speaker"
    set internalSpeakers to "Internal Speakers"
    
    activate application "SystemUIServer"
    tell application "System Events"
    	tell process "SystemUIServer"
    		-- Working CONNECT Script.  Goes through the following:
    		-- Clicks on Audio Menu (OSX Top Menu Bar)
    		-- Clicks your speaker if not connected
    		-- Else if connected, then disconnects by clicking Internal Speakers
    		set audioMenu to menu bar item 4 of menu bar 1
    		tell audioMenu
    			click
    			if exists menu item speakerName of menu 1 then
    				set speakerMenuItem to menu item speakerName of menu 1
    				if value of attribute "AXMenuItemMarkChar" of speakerMenuItem is "✓" then
    					click menu item internalSpeakers of menu 1
    					return "Disconnecting from " & speakerName & "..."
    				else
    					click speakerMenuItem
    					return "Connecting to " & speakerName & "..."
    				end if
    			else
    				-- Doesn't work for now. Just clicks it again after you deselect menu, making it double annoying
    				--click audioMenu
    				return "Doesn't look like you're connected to " & speakerName & "..."
    			end if
    		end tell
    	end tell
    end tell
    end alfred_script

    How can I fix this, so the dropdown actually goes away if speaker is not connected?

     

×
×
  • Create New...