Launching an applescript FROM firefox (URL bar?)

Joined
Jul 16, 2007
Messages
23
Reaction score
0
Points
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?
 
Joined
May 30, 2011
Messages
1
Reaction score
0
Points
1
Applescript to move Firefox windows

I've been using Applescript recently to do simple task scripts lately, including parsing Firefox content. One of the things that bugs me about Firefox is that opening a new window always occurs just below the old one, so a lot of my windows are 20-30 pixels lower than I want, hiding the link/status bar at the bottom. So I too wanted to be able to shuffle windows around, but Firefox hasn't been working so well...

The change position part of the script seems to take 20-30 seconds to run at the top of my other scripts, or actually closes the window when placed at the end of my script. I reduced the active code to show below. Could I get a snippet of what you have that's working? I assume you're getting realistic response time, too... (I haven't gotten as far as showing scripts in Firefox yet, so can't help you there, sorry.)

tell application "Firefox" to activate
tell application "System Events"
tell process "Firefox"
tell window 1
set xy to position
if item 2 of position > 22 then
set position to {item 1 of xy, 22}
end if
#set size to {1070, 800}
end tell
end tell
end tell

Thanks!
Doug.
 
Joined
May 14, 2009
Messages
2,052
Reaction score
136
Points
63
Location
Near Whitehorse, Yukon
Your Mac's Specs
2012 MBP i7 2.7 GHz 15" Matte - 16 GB RAM - 120 GB Intel SSD - 500 GB DataDoubler Mac OS 10.9
The problem with this is the fact that it, for some reason, would ignore the 4 leftmost pixels of the entire screen,
I bet thats because your dock is hidden over on that side of the screen.
The dock has a invisible 4 pixel top that will keep windows from resizing themselves over it, even if you use the window resize corner you will not be able to get over that.
You can get over it by pushing the window to the left and then resizing it again, (What you are doing)


I have the same thing here too, but since my dock is at the bottom of the screen I don't notice it as much as when it is on the sides.


As for launching the applescript from Firefox, I can't see any way that would work as Firefox always tried to download the applescript with the different things I tried.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top