Sign in to follow this  
Followers 0
agentsmith2

Firefox wont run

2 posts in this topic

Hello I'm new to Autoit. I tryed the following Code

#include <Constants.au3>
#include <WinAPIFiles.au3>


; Prompt the user to run the script - use a Yes/No prompt with the flag parameter set at 4 (see the help file for more details)
_WinAPI_Wow64EnableWow64FsRedirection(True)

Local $iAnswer = MsgBox(BitOR($MB_YESNO, $MB_SYSTEMMODAL), "AutoIt Example (English Only)", "This script will run Firefox type in some text and then quit.  Do you want to run it?")

; Check the user's answer to the prompt (see the help file for MsgBox return values)
; If "No" was clicked (7) then exit the script
If $iAnswer = 7 Then
    MsgBox($MB_SYSTEMMODAL, "AutoIt", "OK.  Bye!")
    Exit
EndIf

; Run Notepad
$iPid = Run("firefox","C:Program Files (x86)Mozilla Firefox", @SW_SHOWMAXIMIZED)
;MouseClick("left" ,275,1185)
If $iPid = 0 Then
    MsgBox($MB_SYSTEMMODAL, "AutoIt" + @error, "OK.  Bye!")
    Exit
EndIf

; Wait 10 seconds for the Notepad window to appear.
Local $hWnd = WinWait("[CLASS:MozillaWindowClass]", "", 10)
WinActivate($hWnd)
Sleep(2000)

Send("{ESC}")
Send("{ALT} + {SPACE}")

Send("x")


; Set the state of the Notepad window to "SHOW".
WinSetState($hWnd, "", @SW_SHOW)
WinSetState($hWnd, "", @SW_MAXIMIZE)

; Wait for the Notepad to become active. The classname "Notepad" is monitored instead of the window title
WinWaitActive("[CLASS:MozillaWindowClass]")
Sleep(500)


; Now that the Notepad window is active type some special characters
Send("{ALT} + s")
Send("http://s1.piratesoftortuga2.de/settlement.php?toggle=town&sid=61bdb8022e72bdaee9b14a3846d388f2")
WinWaitActive("[CLASS:MozillaWindowClass]")
Sleep(500)
; Finished!
Exit

 

@error is 1 and FF isnt starting.

I am using Win 7 Ultimate 64x

also maximizing is not working

can anyone  help me

 

thx, Chris

Share this post


Link to post
Share on other sites



Welcome to the forums!

You aren't calling the Run command correctly. The first parameter requires the full path to the executable. You should also look into using the FF.au3 UDF (look for the thread in the Examples section) instead ofhlacking your way through it using MouseClick, Send, WinWait, etc.

P.S. Next time, please use code tags when posting code (the blue A icon in the editor). That greatly enhances readability of your script.

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  
Followers 0