Lanch applescript from Firefox URL bar

Discussion in 'Mac Basics and Help' started by Snipeye, May 30, 2010.

  1. Snipeye macrumors newbie

    Snipeye

    Joined:
    Sep 29, 2008
    #1
    Basically, here's what I'm trying to do:

    I often have a small chat program running, I keep it in the bottom right corner of my screen. It's kind of a stupid application, so it never pops up above active windows for an update, so I keep it uncovered - this means all my windows have to be shrunk to fit, and to not hide it.

    Now, because I'm such an OCD person, I like to have a perfect, 1px border between applications, and I like things to be neat and orderly, etc. That means there's a VERY specific place all my firefox windows go. When i open a new one, however, they can be in any shape, size, etc. For a while, I had a bookmarklet with a keyword, I would just type "chatsize" into the URL bar, and the window would automatically position itself correctly. The problem with this is the fact that it, for some reason, would ignore the 4 leftmost pixels of the entire screen, and would not line up with the edge. Moving it 4 pixels isn't such a big deal, but it gets kind of annoying. No matter what I tried javascripting into the URL bar, it never worked.

    I came up with a solution: Applescript, I could make the window go to the perfect spot and be the perfect size, but now, I have another problem: I can't launch the applescript from the URL bar. I want to be able to type in "chatsize" to the URL bar, and have it work perfectly, but whenever I change the bookmark to the applescript's location on my hard drive, it attempts to download it. Does anybody have any clue how to launch the application from the URL bar?
     
  2. calderone macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #2
    Well, this would be a pretty big security hole if an AppleScript could be run from the browser. May I recommend spotlight?

    Or, make it a service with Automator and assign a keyboard shortcut.
     
  3. Snipeye thread starter macrumors newbie

    Snipeye

    Joined:
    Sep 29, 2008
    #3
    Well, I didn't think it would be a huge security hole, seeing as the file in question would have to already be on my hard drive - it's just like launching an application from the URL bar, how would you do that?

    A keyboard shortcut is a valid alternative, but I was hoping to use something that I was used to.
     
  4. calderone macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #4
    Well, you are making the assumption that the file would have to be stored locally. The ability to execute things from within browsers is a big factor for amounts of malware for Windows machines.

    How do you open a program from within Firefox? As far as I know, you can't. Although, the first place I would look is here:

    https://addons.mozilla.org/en-US/firefox/
     
  5. Snipeye thread starter macrumors newbie

    Snipeye

    Joined:
    Sep 29, 2008
    #5
    Well, I'm getting used to the hotkey, but I had a wonderful idea that's proving... troublesome.

    I want to make it so not only firefox would go to the right position and size when I pressed Control+option+apple+m, but any window that was present. I wrote another script, this is what I have:

    tell current application
    activate
    set the bounds of the first window to {0, 0, 1173, 1178}
    end tell

    and I've managed to make it run in the background. Unfortunately, it comes up with a dialog box that says "press run to run this script or quit to quit" or something like that, and if I move off the active window to press "run" then it fails, and doesn't do anything to the active window.

    Any clue how to remedy this?
     
  6. g££k macrumors newbie

    Joined:
    Jun 11, 2010
    #6
    You have the Startup Screen box checked. Uncheck it. It's a pain in the butt.
     

Share This Page