Jump to content
Sign in to follow this  
norelidd

How can I send URLs to FireFox?

Recommended Posts

norelidd

I am trying to get a script written up to help out with some common things I do. I am trying to send a URL to firefox, or better yet, I want to input text to the Address Bar as I am using the Firefox Keyword Search feature, which relies on the text being entered in the address bar or the CTRL+L "Open Location" menu.

The thing is, activating Firefox and using keyboard commands to open a new tab (^T), then enter text and paste something in and hit enter is a little clunky and cumbersome. Is there another way to do this? Additionally, if I swtich windows while the script is still running, it will dump the keystrokes into whatever window I swtiched to, which is logical, but annoying. Can the Firefox window be locked in activation while the script runs, or perhaps the commands be sent behind the scenes to not need keyboard macros?

Also, another problem I'm having is activating the correct FF window. I will sometimes have little popup windows active for various tasks, but if the script activates those windows, it will fail, since it has no address bar to paste the text into. Can WinActivate differentiate between a FireFox instance that has tabs and an address bar, and one that doesn't?

Thanks for the help!

Share this post


Link to post
Share on other sites
Nahuel

I've never tried with Firefox.. but I suppose it should work:

Go to the AutoIt Window Info tool and search firefox's controls. Then look in help file for ControlClick, ontrolSetText, ControlGetText, etc...

Share this post


Link to post
Share on other sites
norelidd

I tried that, but all windows seem to have the same properties. Is there a way to conditionally activate a window based on some control properties?

Share this post


Link to post
Share on other sites
Nahuel

Something like this maybe?

Run("mspaint")
WinWaitActive("[CLASS:MSPaintApp]")

While 1
    If BitAND(Wingetstate("[CLASS:MSPaintApp]"),8)=8 Then
        ToolTip("Paint is active",0,0,"Window State")
        
    Else
        ToolTip("Paint is NOT active - Activating",0,0,"Window State")
        WinActivate("[CLASS:MSPaintApp]")
    EndIf
    Sleep(25)
    If BitAND(Wingetstate("[CLASS:MSPaintApp]"),2)<>2 then Exit
WEnd

Oh... and I think you could make it work with more than one window. Just work with their handles.

Edited by Nahuel

Share this post


Link to post
Share on other sites
SmOke_N

These are all the controls mine had:

MozillaWindowClass1

MozillaWindowClass2

MozillaWindowClass3

MozillaWindowClass4

MozillaWindowClass5

MozillaWindowClass6

MozillaWindowClass7

MozillaWindowClass8

MozillaWindowClass9

MozillaWindowClass10

MozillaWindowClass11

MozillaWindowClass12

MozillaWindowClass13

MozillaWindowClass14

MozillaWindowClass15

MozillaWindowClass16

MozillaWindowClass17

MozillaWindowClass18

MozillaWindowClass19

MozillaWindowClass20

MozillaWindowClass21

MozillaWindowClass22

MozillaWindowClass23

MozillaWindowClass24

MozillaWindowClass25

MozillaWindowClass26

MozillaWindowClass27

MozillaWindowClass28

MozillaWindowClass29

MozillaWindowClass30

MozillaWindowClass31

MozillaWindowClass32

MozillaWindowClass33

MozillaWindowClass34

MozillaWindowClass35

MozillaWindowClass36

MozillaWindowClass37

MozillaWindowClass38

MozillaWindowClass39

MozillaWindowClass40

MozillaWindowClass41

MozillaWindowClass42

MozillaWindowClass43

MozillaWindowClass44

MozillaWindowClass45

MozillaWindowClass46

MozillaWindowClass47

MozillaWindowClass48

MozillaWindowClass49

MozillaWindowClass50

MozillaWindowClass51

MozillaWindowClass52

MozillaWindowClass53

MozillaContentWindowClass1

MozillaContentWindowClass2

MozillaContentWindowClass3

MozillaContentWindowClass4

MozillaContentWindowClass5

MozillaContentWindowClass6

MozillaContentWindowClass7

MozillaContentWindowClass8

MozillaContentFrameWindowClass1

MozillaContentFrameWindowClass2

MozillaContentFrameWindowClass3


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×