Canasian Posted April 8, 2009 Share Posted April 8, 2009 (edited) Is there something wrong with my computer? Run will not execute anything lol hm... I've tried it with different programs too. I've tried: Run("Diablo II.exe") Run("firefox.exe") Run("Iexplorer.exe") Run"Firefox.exe", ["C:\Program Files\Mozilla Firefox\firefox.exe"]) And i've also tried $Window1 = "Mozilla Firefox Start Page - Mozilla Firefox" Func StartFirefox() Run("firefox.exe","C:\Program Files\Mozilla Firefox\firefox.exe",@SW_MAXIMIZE) WinActivate ($Window1) WinWaitActive ($Window1) EndFunc Is this wrong? such a simple question nothing showed up in search and i did the tutorial on a diff computer and it executed notepad.. i feel stupid lol Edited April 8, 2009 by Canasian Link to comment Share on other sites More sharing options...
herewasplato Posted April 8, 2009 Share Posted April 8, 2009 So, what happens when you manually click on Start > Run Then type notepad Press enter ? [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Canasian Posted April 8, 2009 Author Share Posted April 8, 2009 So, what happens when you manually click on Start > RunThen type notepadPress enter?It opens notepad lol same with firefoxStart > Run > Notepad Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 8, 2009 Share Posted April 8, 2009 Are you actually calling the function you defined in the code you posted? In the code you posted, it is correctly NOT running anything. Link to comment Share on other sites More sharing options...
Canasian Posted April 8, 2009 Author Share Posted April 8, 2009 Are you actually calling the function you defined in the code you posted? In the code you posted, it is correctly NOT running anything. I dunno what i'm doing lol but it doesn't work like this either if that's what you're asking. $Window1 = "Mozilla Firefox Start Page - Mozilla Firefox" Run("firefox.exe","C:\Program Files\Mozilla Firefox\firefox.exe",@SW_MAXIMIZE) WinActivate ($Window1) WinWaitActive ($Window1) This doesn't work either. Link to comment Share on other sites More sharing options...
Danny35d Posted April 8, 2009 Share Posted April 8, 2009 Run("C:\Program Files\Mozilla Firefox\firefox.exe",@TempDir, @SW_MAXIMIZE) AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
Canasian Posted April 8, 2009 Author Share Posted April 8, 2009 (edited) Run("C:\Program Files\Mozilla Firefox\firefox.exe",@TempDir, @SW_MAXIMIZE) Hey that worked why do you put @TempDir? firefox.exe is not a temporary file but.. that worked lol Thank you very much Edited April 8, 2009 by Canasian Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 8, 2009 Share Posted April 8, 2009 The problem was that you needed the full path. The working directory doesn't tell the system where the program is located. Too many people make that mistake. Link to comment Share on other sites More sharing options...
Valik Posted April 8, 2009 Share Posted April 8, 2009 The problem was that you needed the full path. The working directory doesn't tell the system where the program is located. Too many people make that mistake.You're right, it does. I've just changed the documentation to hopefully get people to stop making this mistake: Run ( "program" [, "workingdir" [, show_flag[, opt_flag ]]] ) program The full path of the program (EXE, BAT, COM, or PIF) to run. workingdir [optional] The working directory. This is not the path to the program.Now there's no real excuse. It says full path and explicitly states the working directory is not the path. Link to comment Share on other sites More sharing options...
Canasian Posted April 8, 2009 Author Share Posted April 8, 2009 Thank you very much guys ah yea that makes sense and helps a lot thank you I messed with autoit a couple years ago and i didn't think it was like that.. I never got good but I'd like to try again I actually read the whole learning to script with autoit v3 pdf and stuff still never figured out how to get autoit 1-2-3 to work.. always get errors when i try to run the demos lol. But yay I finished my first script in 2 years haha simple but fun and I actually use it. Did I use the @error macro correctly? I think i'm missing something lol. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Mysticwonton Script Function: Opens Hotmail then logs in then does same for myspace. #ce ---------------------------------------------------------------------------- ;Both Hotmail and Myspace on my comp are set up to "remember me" (username) that's why I just use tab and enter to get to password box. $Window = "Mozilla Firefox Start Page - Mozilla Firefox" $E = "{ENTER}" If @error Then MsgBox(0,"Error Message","Firefox messed up") Else Run("C:\Program Files\Mozilla Firefox\firefox.exe",@TempDir, @SW_MAXIMIZE) WinActivate ($Window) WinWaitActive ($Window) Send("!d") Send("http://hotmail.com") Send($E) WinWaitActive("Sign In - Mozilla Firefox") Send($E) Send("password") Send($E) EndIf Sleep(100) If @error Then MsgBox(0,"Error Message", "Firefox messed up") Else Run("C:\Program Files\Mozilla Firefox\firefox.exe",@TempDir, @SW_MAXIMIZE) Winactivate($Window) WinWaitActive($Window) Send("!d") Send("http://myspace.com") Send($E) Winwaitactive("MySpace | A Place for Friends") Send("{TAB 2}") Send("password") Send($E) EndIf Link to comment Share on other sites More sharing options...
herewasplato Posted April 8, 2009 Share Posted April 8, 2009 (edited) ... Did I use the @error macro correctly? ...Nope. It should be right after the AutoIt functions that sets the @error macro. Run("asdfjlk") If @error ....... You might also want to try a run line like this: Run("C:\Program Files\Mozilla Firefox\firefox.exe http://hotmail.com", @TempDir) Edited April 8, 2009 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Canasian Posted April 8, 2009 Author Share Posted April 8, 2009 Nope. It should be right after the AutoIt functions that sets the @error macro.Run("asdfjlk")If @error .......Ah i feel so dumb So then what do i put instead of Else when i start thisElseRun("C:\Program Files\Mozilla Firefox\firefox.exe",@TempDir, @SW_MAXIMIZE) Link to comment Share on other sites More sharing options...
herewasplato Posted April 9, 2009 Share Posted April 9, 2009 Ah i feel so dumb ...So do I - really. Many of the questions in this forum are way over my head and I've had no formal training in programming. They just tolerate me around here :-) ... So then what do i put instead of Else when i start this Else Run("C:\Program Files\Mozilla Firefox\firefox.exe",@TempDir, @SW_MAXIMIZE)Well, they only way that I know to answer that is to walk thru present your code and make some comments. $Window = "Mozilla Firefox Start Page - Mozilla Firefox" no problem there $E = "{ENTER}" I do not think that I've seen anybody do that. But it works - so you taught me something. Neither of the lines of code above will set @error, so there is no need to check it in your code below: If @error Then MsgBox(0,"Error Message","Firefox messed up") Else Run...... Where ever you do decide to place the "Run" line: Run("C:\Program Files\Mozilla Firefox\firefox.exe",@TempDir, @SW_MAXIMIZE) You should place a WinWait between it and the WinActivate line. WinActivate ($Window) WinWaitActive ($Window) The way that you have it now: Run("C:\Program Files\Mozilla Firefox\firefox.exe",@TempDir, @SW_MAXIMIZE) WinActivate ($Window) WinWaitActive ($Window) The WinActivate line is executing before that Firefox app has opened. These lines you do not need: Send("!d") Send("http://hotmail.com") Send($E) Just use the line that I posted above with the hotmail URL in the "Run" line. This part is okay: WinWaitActive("Sign In - Mozilla Firefox") Send($E) Send("password") Send($E) EndIf If I was going to rewrite that section of code for you, it would look something like: Run("C:\Program Files\Mozilla Firefox\firefox.exe hotmail.com", @TempDir) If @error Then MsgBox(0, "Error Message", "Firefox messed up") Exit EndIf WinWait("Sign In - Mozilla Firefox") WinWaitActive("Sign In - Mozilla Firefox") WinWaitActive("Sign In - Mozilla Firefox") Send("{ENTER}") Send("password") Send("{ENTER}")That code would replace from $Window = "Moz..... to your Sleep(100) in your original code. Instead of your sleep (100), you might consider using WinWait("Windows Live Hotmail - Mozilla Firefox") then repeat the code above for your next website of interest All of the info above is offered on the assumption that I understand what you are attempting to do. If you always want to open Firefox with your code, then the suggested code above should work for you. If you want to reuse a session of Firefox that is already open, then the code should change a bit. hope this helps [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Canasian Posted April 9, 2009 Author Share Posted April 9, 2009 (edited) Thanks a lot herewasplato ok so this is what i have now.. but.. is there another way to get to the password box on myspace? my tab twice thing doesn't always work.. or maybe i should make it sleep or.. i dunno lol. This is what i have so far.. everything works up to the finding password box for myspace lol. Thank you for your help I appreciate it. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Mysticwonton Script Function: Opens Hotmail then logs in then does same for myspace. #ce ---------------------------------------------------------------------------- $Window = "Mozilla Firefox Start Page - Mozilla Firefox" $E = "{ENTER}" Run("C:\Program Files\Mozilla Firefox\firefox.exe http://hotmail.com", @TempDir, @SW_MAXIMIZE) If @error Then MsgBox(0, "Error Message", "Firefox messed up") Exit EndIf If Not @error Then WinWait("Sign In - Mozilla Firefox") WinActivate("Sign In - Mozilla Firefox") WinWaitActive("Sign In - Mozilla Firefox") Send("{ENTER}") Send("password") Send($E) EndIf Sleep(100) Run("C:\Program Files\Mozilla Firefox\firefox.exe http://Myspace.com", @TempDir, @SW_MAXIMIZE) If @error Then MsgBox(0, "Error Message", "Firefox messed up") Exit EndIf If Not @error Then WinWait("MySpace | A Place for Friends") WinActivate("MySpace | A Place for Friends") Winwaitactive("MySpace | A Place for Friends") Send("{TAB 2}") Send("password") Send($E) EndIf edit: I just changed the second half to match first half kinda and.. it works now i think? lol Edited April 9, 2009 by Canasian Link to comment Share on other sites More sharing options...
Nevik564 Posted September 11, 2009 Share Posted September 11, 2009 (edited) i would do it like this.... i Tinks its much faster By the way good luck with you adder bot 8) #include <IE.au3> _IEErrorHandlerRegister () $oIE = _IECreate() _IENavigate($oIE, "http://www.myspace.com") $oForm = _IEFormGetObjByName($oIE, "aspnetForm") $oEmail = _IEFormElementGetObjByName($oForm, "ctl00$ctl00$cpMain$cpMain$LoginBox$Email_Textbox") $oPass = _IEFormElementGetObjByName($oForm, "ctl00$ctl00$cpMain$cpMain$LoginBox$Password_Textbox") _IEFormElementSetValue($oEmail, "UserName Goes Here") _IEFormElementSetValue($oPass, "Password Goes Here") _IEFormSubmit($oForm) _IELoadWait($oIE) Edited September 11, 2009 by Nevik564 Link to comment Share on other sites More sharing options...
Richard Robertson Posted September 11, 2009 Share Posted September 11, 2009 Why did you dig up a several month dead thread to give a response that doesn't follow the thread? The point here was to use Firefox, not Internet Explorer. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now