mcnugit Posted March 3, 2015 Posted March 3, 2015 Hey guys, I'm new to autoit, and very happy to be here. Last night I attempted to create an automation script for malwarebytes anti-malware. The script works, but not the compiled exe. The exe crashes right after the installation of the program. If someone could point me to better debugging messages, or make some corrections to my code, that would be fantastic. Thank you~ #include <Date.au3> $mbamExe = @ProgramFilesDir & "\Malwarebytes Anti-Malware\mbam.exe" $mbamPath = @ProgramFilesDir & "\Malwarebytes Anti-Malware\" $mbamUn = @ProgramFilesDir & "\Malwarebytes Anti-Malware\unins000.exe /verysilent /suppressmsgboxes /norestart" $mbamScanColor = 'D98DFC' $logName = 'mbam-' & @UserName & '-PC.txt' Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 0) ;1=absolute, 0=relative, 2=client RunWait ("mbam-setup-2.0.4.1028.exe /silent") Run( $mbamExe, $mbamPath) WinWait('Malwarebytes Anti-Malware (Free) 2.0.4.1028') WinActivate('Malwarebytes Anti-Malware (Free) 2.0.4.1028') MouseClick('primary', 650, 500, 1, 0) While 1 If Hex(PixelGetColor(768, 258), 6) = $mbamScanColor Then ExitLoop Wend MouseClick('primary', 768, 258, 1, 0) WinWait('Scan Log') WinActivate('Scan Log') MouseClick('primary', 63, 792, 1, 0) MouseClick('primary', 52, 817, 1, 0) MouseClick('primary', 674, 240, 1, 0) Send($logName) Send("!S") Send("!Y") Send("!S") Send("{ENTER}") WinWait('Scan Log') WinActivate('Scan Log') WinKill('Scan Log') WinWait('Malwarebytes Anti-Malware (Free) 2.0.4.1028') WinActivate('Malwarebytes Anti-Malware (Free) 2.0.4.1028') WinKill('Malwarebytes Anti-Malware (Free) 2.0.4.1028') Run( $mbamUn )
JohnOne Posted March 3, 2015 Posted March 3, 2015 Try getting rid of WinKill for WinClose. Try adding #RequireAdmin. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
mcnugit Posted March 3, 2015 Author Posted March 3, 2015 Hey, Thanks for the reply! I amended the script, according to your input. Still no dice. It's seems to be crashing right after launching the installer if that helps.
Solution Radiance Posted March 3, 2015 Solution Posted March 3, 2015 (edited) The exe crashes right after the installation of the program. Would be interesting to see the error message. If I had to guess, I'd say that the Run() right after your installation kills it. Are you sure the .exe exists already and the path is correct? When building software installer packages I had cases where the installer.exe already ended, but launched several msiexec.exe's which did the actual installation. Since installer.exe was gone the script assumed that the installation was finished. I'd suggest you try a MsgBox(0, "", FileExists($mbamExe)) right after the installation. This should show you if the installation is already finished or not. Edited March 3, 2015 by Radiance
mcnugit Posted March 3, 2015 Author Posted March 3, 2015 Thanks for the input radiance, I did as you suggested and it actually crashes before that. It seems as soon as it launches the installer it crashes trying to wait. Very curious.
Developers Jos Posted March 3, 2015 Developers Posted March 3, 2015 (edited) Are you Running and Compiling with the same version of AutoIt3 (x86/x64) ? Jos Edited March 3, 2015 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Developers Jos Posted March 3, 2015 Developers Posted March 3, 2015 Looks great, but am not sure you answered my question. Are you running & compiling with SciTE? Is so, could you show the SciTE output pane info of both the run and compile operation so we can check what versions you use? Also still wondering what you mean with crash: does it just end or is there any message/error? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
mcnugit Posted March 4, 2015 Author Posted March 4, 2015 (edited) Sorry for the Confusion, and again thank you so much guys. To answer your questions explicitly Yes I am using SciTE to run and compile. When I run it using go(f5) the script works just fine, no errors to speak of. It does the automation I want. >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\tech\Desktop\mbam.au3" >Exit code: 0 Time: 87.71 Compiling doesn't seem to give any notable insight. >"C:\Program Files (x86)\AutoIt3\SciTE\..\aut2exe\aut2exe.exe" /in "C:\Users\tech\Desktop\mbam.au3" >Exit code: 0 Time: 0.8947 As for errors or indication of failure the program just exits. No error message to speak of. I made a few changes to the source, so I'll post my updated script here, however the problem is persisting. $mbamTitle = "Malwarebytes Anti-Malware (Free) 2.0.4.1028" $mbamExe = @ProgramFilesDir & "\Malwarebytes Anti-Malware\mbam.exe" $mbamPath = @ProgramFilesDir & "\Malwarebytes Anti-Malware\" $mbamUn = @ProgramFilesDir & "\Malwarebytes Anti-Malware\unins000.exe /verysilent /suppressmsgboxes /norestart" $mbamScanColor = 'D9FAEC' $logName = 'mbam-' & @UserName & '-PC.txt' Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 0) ;1=absolute, 0=relative, 2=client RunWait ("mbam-setup-2.0.4.1028.exe /silent") Run( $mbamExe ) WinWait($mbamTitle) WinActivate($mbamTitle) Sleep(200) MouseClick('primary', 655, 493, 1, 0) While 1 If Hex(PixelGetColor(807, 260), 6) = $mbamScanColor Then ExitLoop Wend MouseClick('primary', 807, 260, 1, 0) WinWait('Scan Log') WinActivate('Scan Log') MouseClick('primary', 63, 792, 1, 0) MouseClick('primary', 52, 817, 1, 0) MouseClick('primary', 674, 240, 1, 0) Send($logName) Send("!S") Send("!Y") Send("!S") Send("{ENTER}") WinWait('Scan Log') WinActivate('Scan Log') WinClose('Scan Log') WinWait($mbamTitle) WinActivate($mbamTitle) WinClose($mbamTitle) Run( $mbamUn ) Edited March 4, 2015 by mcnugit
JohnOne Posted March 4, 2015 Posted March 4, 2015 You should download scite4autoit. That output is not from a scite4autoit compilation. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
mcnugit Posted March 4, 2015 Author Posted March 4, 2015 After reinstalling Scite4autoit the output for running is as follows. >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\tech\Desktop\mbam.au3" /UserParams +>17:21:22 Starting AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64 Environment(Language:0409) +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\Administrator\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\Administrator\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.12.0) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\tech\Desktop\mbam.au3 +>17:21:22 AU3Check ended.rc:0 >Running:(3.3.12.0):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\tech\Desktop\mbam.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop +>17:22:29 AutoIt3.exe ended.rc:0 +>17:22:29 AutoIt3Wrapper Finished. >Exit code: 0 Time: 67.42 And for compiling~ >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /ShowGui /in "C:\Users\tech\Desktop\mbam.au3" +>17:25:58 Starting AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64 Environment(Language:0409) +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\Administrator\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\Administrator\AppData\Local\AutoIt v3\SciTE -> No changes made.. >Running AU3Check (3.3.12.0) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\tech\Desktop\mbam.au3 +>17:26:16 AU3Check ended.rc:0 >Running:(3.3.12.0):C:\Program Files (x86)\AutoIt3\aut2exe\aut2exe.exe /in "C:\Users\tech\Desktop\mbam.au3" /out "C:\Users\Administrator\AppData\Local\AutoIt v3\Aut2exe\~AU3yukajwt.exe" /nopack /comp 2 +>17:26:17 Aut2exe.exe ended.C:\Users\Administrator\AppData\Local\AutoIt v3\Aut2exe\~AU3yukajwt.exe. rc:0 +>17:26:17 Created program:C:\Users\tech\Desktop\mbam.exe +>17:26:18 AutoIt3Wrapper Finished. >Exit code: 0 Time: 20.71 Thanks JohnOne
JohnOne Posted March 4, 2015 Posted March 4, 2015 Try putting this at the top of your script. #AutoIt3Wrapper_UseX64=n AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
mcnugit Posted March 4, 2015 Author Posted March 4, 2015 I tried your suggestion John, but unfortunately it was not a solution.
JohnOne Posted March 4, 2015 Posted March 4, 2015 Did you try... #AutoIt3Wrapper_UseX64=y AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted March 4, 2015 Posted March 4, 2015 What does this give you? MsgBox(0, "AutoIt is x64", @AutoItX64) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
mcnugit Posted March 4, 2015 Author Posted March 4, 2015 Yes, I tried #AutoIt3Wrapper_UseX64=y nothing. MsgBox(0, "AutoIt is x64", @AutoItX64) returns a 1
JohnOne Posted March 4, 2015 Posted March 4, 2015 Can you post a screenshot of your crash window, and / or its event log? I'm not sure it would mean much to me, but it might to someone else who may be able to help. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
TheSaint Posted March 4, 2015 Posted March 4, 2015 It's not normal to have the spaces before and after like you are using with your Run commands, inside the brackets. Why are you doing that? Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)
JohnOne Posted March 4, 2015 Posted March 4, 2015 Perfectly valid though. MsgBox ( 0 , "AutoIt is x64" , @UserName ) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
mcnugit Posted March 4, 2015 Author Posted March 4, 2015 Radiance, you were certainly correct. msiexec's~
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