Jump to content

Pennyworth

Member
  • Posts

    46
  • Joined

  • Last visited

  • Days Won

    1

Reputation Activity

  1. Like
    Pennyworth got a reaction from TomBenz in [REQUEST] Microsoft OneNote Workflow   
    Thanks dfay! Your solution gets me most of the way there! If there was only a way to pass through the search results to Alfred, we'd be golden.
  2. Like
    Pennyworth reacted to Andrew in System Preferences - icons - mystery? (10.15.1) [Fixed by Apple in Big Sur]   
    Remarkably, this looks to be fully fixed in the GA Big Sur!
  3. Like
    Pennyworth got a reaction from dfay in Workflow to choose from many 'Open URL' actions   
    Thank you for the suggestion @dfay! I accomplished this using a List Filter and the Conditional utility. Worked like a charm!
  4. Thanks
    Pennyworth reacted to deanishe in 'Open URL' in specific Google Chrome user profile   
    I suspect it’s because Alfred already has a persistent connection to the shared NSWorkspace, whereas your command/script needs to establish a new one every time it's run.
     
    I don’t understand much about the way the whole macOS application runtime works, but when scripting applications, establishing the initial connection typically takes quite a long time, and the subsequent commands execute very quickly in comparison.
     
    Perhaps @Andrew could explain it better/correct me if I'm wrong.
  5. Haha
    Pennyworth reacted to deanishe in Open iStat Menus menu bar items with Alfred keyword   
    Oh, no. Too much work, tbh. The majority of the effort in building a workflow is making it user-friendly and flexible.
     
    If anyone's interested, the script that does the hard bit is here, and they can build their own workflow around it.
     
     
    And thanks for the beer! I'm drinking it now 🍻
  6. Thanks
    Pennyworth reacted to deanishe in Open iStat Menus menu bar items with Alfred keyword   
    I used the Accessibility Inspector to see what iStats widgets are called.
     
    If you paste this AppleScript into Script Editor and run it, it will show you the name of every iStats widget:
    set _names to "" tell application "System Events" tell process "iStat Menus Status" repeat with _bar in every menu bar repeat with _item in _bar's every menu bar item log (name of _item) as text if _names = "" then set _names to (name of _item) as text else set _names to _names & "\n" & (name of _item) as text end if end repeat end repeat end tell display dialog _names end tell You’ll have to change the regular expression to match the title, with some items being easier than others. If you can’t figure some out, post the titles shown, and I’ll try to help. For time, you might need something like \d\d:\d\d, for example.
     
  7. Thanks
    Pennyworth got a reaction from deanishe in Open iStat Menus menu bar items with Alfred keyword   
    Thank you so much! This is amazing! I don't know the magic behind much of this, but it works perfectly! Just bought you a beer via PayPal! 🍻
     
    I've gone ahead and replaced /CPU/ with /Memory/ and /Battery/ for the other menu bar items and those work great, but still can't figure out what iStat calls their menu bar items for 'Sensors' and 'Time'. Wonder how I could do that? Alternatively, can the line let matchiStatsItem = props => { return props.name.match(/dateandtime/) } be modified so that it's a "fuzzy match"?
  8. Thanks
    Pennyworth reacted to deanishe in Open iStat Menus menu bar items with Alfred keyword   
    Here’s an alternative JXA script that does work with iStat Menus.
     
    Put it in a Run Script action with Language = "/usr/bin/osascript (JS)"
     
    You may need to change the matchiStatsItem function at the top, depending on which iStats menu extra you want to click on.
    /* Click iStat Menus menu bar extra ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Moves mouse cursor to menu bar extra, clicks, then moves mouse back to its previous position. This is a workaround because iStat Menus doesn't respond to AppleScript's simulated clicks. Change the matchiStatsItem function to match the properties of the menu bar extra you want to click on. */ ObjC.import('CoreGraphics') // Function that matches the menu item we're looking for let matchiStatsItem = props => { return props.name.match(/CPU/) } function mouseEvent(type, x, y) { let ev = $.CGEventCreateMouseEvent(null, type, {x:x, y:y}, $.kCGMouseButtonLeft) $.CGEventPost($.kCGHIDEventTap, ev) } function click(x, y) { mouseEvent($.kCGEventLeftMouseDown, x, y) mouseEvent($.kCGEventLeftMouseUp, x, y) } function move(x, y) { mouseEvent($.kCGEventMouseMoved, x, y) } function getMenuProperties(match) { let se = Application('System Events') let istat = se.processes.whose({name: 'iStat Menus Status'})[0] for (let i = 0; i < istat.menuBars.length; i++) { let menubar = istat.menuBars[i] for (let j = 0; j < menubar.menuBarItems.length; j++) { let item = menubar.menuBarItems[j] let props = item.properties() console.log(`item=${props.name}`) if (match(props)) { return props } } } } function showError(title, message) { let app = Application.currentApplication() app.includeStandardAdditions = true app.displayDialog(message, { buttons: ['OK'], defaultButton: 'OK', withTitle: title, withIcon: 'stop', givingUpAfter: 2, }) } function run(argv) { // get current mouse position, so we can restore it later const currentPos = $.CGEventGetLocation($.CGEventCreate(null)) let props = getMenuProperties(matchiStatsItem) if (!props) { showError('iStat Menu Clicker', 'No matching iStat Menu item') throw 'menu item not found' } let pos = props.position click(pos[0]+5, pos[1]+5) move(currentPos.x, currentPos.y) }  
  9. Like
    Pennyworth got a reaction from manan in [REQUEST] Microsoft OneNote Workflow   
    Thanks dfay! Your solution gets me most of the way there! If there was only a way to pass through the search results to Alfred, we'd be golden.
  10. Like
    Pennyworth got a reaction from deanishe in Gauth: Google Authenticator (Time-Based Two-Factor Authentication)   
    This workflow is implemented really well but isn't the point of two-factor authentication to have two separate physical devices required to authenticate yourself? What's the point if both factors are on your computer (assuming the computer is what's being authenticated into, and not another device like a smartphone or tablet)?
  11. Like
    Pennyworth reacted to chrisparker in Google Images Search Broken?   
    Is the built-in Google Images web search broken? My browser (Safari) hangs when I try it. Probably started around the time of the Mavericks upgrade.
     
    A custom search of http://www.google.com/search?q='{query}'&tbm=isch works fine.
     
    Mac OS X 10.9.1, Alfred 2.1.1 with PowerPack.
     
    Chris
  12. Like
    Pennyworth got a reaction from Ilithian in About This Mac   
    I've finally figured out this problem! I was having the same issue and after a bit of research, got it to work.

    You need to edit a plist file that has somehow retained your old machine's identifier and edit that information out. Here are the steps: 
    Open the following file with a plist editor of your choice (Xcode, PlistEdit Pro, etc):  ~/Library/Preferences/com.apple.SystemProfiler.plist Under the 'CPU Names' field, locate the identifier for your current system as well as the identifier for your previous system. Delete that old identifier. Save the plist file. In Alfred, reset the About workflow by typing the keyword:  xabout When you run the workflow again by typing the keyword 'about', you should now see the correct 'System (Model Identifier)' entry!
×
×
  • Create New...