Jump to content

Once Program is Compiled it no longer closes all the Windows


Recommended Posts

When I choose Run Script the program runs just fine and closes all of the dialog box windows.  However, after I compile the script the last two windows do not close.  I am not really sure what I may be doing wrong so below is the code:

#RequireAdmin ;Used to deal with Windows UAC
#include <MsgBoxConstants.au3>
; Script Start - Add your code below here
If FileExists(@TempDir & "\ComboFix.exe") Then
    FileDelete(@TempDir & "\ComboFix.exe")
EndIf
Sleep(1000)
$UrlDownloader = "[url=http://download.bleepingcomputer.com/sUBs/ComboFix.exe]http://download.bleepingcomputer.com/sUBs/ComboFix.exe"[/url]
$Directory = @TempDir & "\ComboFix.exe"
InetGet($UrlDownloader, $Directory)
;;;ShellExecute(@TempDir & "\ComboFix.exe", "/S")
ShellExecute("C:\temp\ComboFix.exe", "/S")
Sleep(2000)
WinWait("ComboFix", "update ComboFix?", 10)
If WinExists("ComboFix", "update ComboFix?") Then
    ;MsgBox($MB_SYSTEMMODAL, "", "ComboFix window exists")
    ControlClick("ComboFix", "update ComboFix?", "[CLASS:Button; INSTANCE:1]") ; click YES button
    ;Send("{ENTER}")
EndIf
WinWait("", "ComboFix has detected", 25)
If WinExists("", "ComboFix has detected") Then
    ;MsgBox($MB_SYSTEMMODAL, "", "ComboFix has detected window exists")
    ;WinActivate("Warning !!", "ComboFix has detected")
    ControlClick("Warning !!", "ComboFix has detected", "[CLASS:Button; INSTANCE:1]")
EndIf
WinWait("", "antivirus:", 10)
If WinExists("", "antivirus:") Then
    ;MsgBox($MB_SYSTEMMODAL, "", "antivirus: window exists")
    ControlClick("Warning !!", "", "[TEXT:OK]", "left", 1)
    ;ControlClick("Warning !!", "", "[CLASS:Button; INSTANCE:1]") ;click OK button
EndIf
Any help with this issues would be greatly appreciated. Edited by Melba23
Added code tags
Link to comment
Share on other sites

  • Moderators

countscotch,

Welcome to the AutoIt forum. :)

In future when you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I've noticed that the two WinWait's have blank titles whereas the two ControlClicks have "Warning !!" as titles.  Could that be the issue?

WinWait("", "ComboFix has detected", 25)

If WinExists("", "ComboFix has detected") Then
  ;MsgBox($MB_SYSTEMMODAL, "", "ComboFix has detected window exists")
  ;WinActivate("Warning !!", "ComboFix has detected")
  ControlClick("Warning !!", "ComboFix has detected", "[CLASS:Button; INSTANCE:1]")
EndIf

WinWait("", "antivirus:", 10)

If WinExists("", "antivirus:") Then
  ;MsgBox($MB_SYSTEMMODAL, "", "antivirus: window exists")
  ControlClick("Warning !!", "", "[TEXT:OK]", "left", 1)
  ;ControlClick("Warning !!", "", "[CLASS:Button; INSTANCE:1]") ;click OK button
EndIf
Link to comment
Share on other sites

 

I've noticed that the two WinWait's have blank titles whereas the two ControlClicks have "Warning !!" as titles.  Could that be the issue?

WinWait("", "ComboFix has detected", 25)

If WinExists("", "ComboFix has detected") Then
  ;MsgBox($MB_SYSTEMMODAL, "", "ComboFix has detected window exists")
  ;WinActivate("Warning !!", "ComboFix has detected")
  ControlClick("Warning !!", "ComboFix has detected", "[CLASS:Button; INSTANCE:1]")
EndIf

WinWait("", "antivirus:", 10)

If WinExists("", "antivirus:") Then
  ;MsgBox($MB_SYSTEMMODAL, "", "antivirus: window exists")
  ControlClick("Warning !!", "", "[TEXT:OK]", "left", 1)
  ;ControlClick("Warning !!", "", "[CLASS:Button; INSTANCE:1]") ;click OK button
EndIf

I have added the blank titles and still the same result.  The script will run w/out any errors but after it is compiled it will not close the last two Warning !! windows.

WinWait("Warning !!", "ComboFix has detected", 25)
If WinExists("Warning !!", "ComboFix has detected") Then
    ;MsgBox($MB_SYSTEMMODAL, "", "ComboFix has detected window exists")
    ;WinActivate("Warning !!", "ComboFix has detected")
    ControlClick("Warning !!", "ComboFix has detected", "[CLASS:Button; INSTANCE:1]")
EndIf
WinWait("Warning !!", "antivirus:", 10)
If WinExists("Warning !!", "antivirus:") Then
    ;MsgBox($MB_SYSTEMMODAL, "", "antivirus: window exists")
    ;WinActivate("Warning !!", "antivirus:") ;give focus to the window
    ControlClick("Warning !!", "", "[TEXT:OK]", "left", 1)
    ;ControlClick("Warning !!", "", "[CLASS:Button; INSTANCE:1]") ;click OK button
EndIf
Edited by countscotch
Link to comment
Share on other sites

You're also only waiting 25 seconds and 10 seconds, are you sure that's long enough to wait for the program to run?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

:huh2:

... what happens if you remove timeouts completely?

No dice! Removing the timeouts produced the same results. I am completly stumped. Again, when I debug the script everything appears to be error free. After I complie for the x86 architecture it does not close the last two Warning !! windows. Not sure where the logic in my code is incorrect and/or what else to try.

Thanks again!

Link to comment
Share on other sites

You're also only waiting 25 seconds and 10 seconds, are you sure that's long enough to wait for the program to run?

For x86 architecture this part of the script will click install the ComboFix update:

If WinWait("ComboFix", "update ComboFix?", 20) Then ;MsgBox($MB_SYSTEMMODAL, "", "ComboFix window exists")
    ;If WinWait("ComboFix", "update ComboFix?") Then ;MsgBox($MB_SYSTEMMODAL, "", "ComboFix window exists")
    ControlClick("ComboFix", "update ComboFix?", "[CLASS:Button; INSTANCE:1]") ; click YES button
    ;Send("{ENTER}")
EndIf

However, even if I remove the timeouts the last two windows still do not close when I compile the script for x86.  Here is the code:

WinWait("", "ComboFix has detected")
;WinWait("Warning !!", "ComboFix has detected")
If WinExists("", "ComboFix has detected") Then
    ;MsgBox($MB_SYSTEMMODAL, "", "ComboFix has detected window exists")
    WinActivate("Warning !!", "ComboFix has detected")
    ControlClick("Warning !!", "ComboFix has detected", "[CLASS:Button; INSTANCE:1]")
EndIf
WinWait("", "antivirus:")
;WinWait("Warning !!", "antivirus:")
If WinExists("", "antivirus:") Then
    ;MsgBox($MB_SYSTEMMODAL, "", "antivirus: window exists")
    WinActivate("Warning !!", "antivirus:") ;give focus to the window
    ControlClick("Warning !!", "", "[TEXT:OK]", "left", 1)
    ;ControlClick("Warning !!", "", "[CLASS:Button; INSTANCE:1]") ;click OK button
EndIf

It is my understanding that WinWait would just keep waiting because the Default is 0 (no timeout).

Thanks for your response!

Link to comment
Share on other sites

just a guess,

could perhaps have a sense that if the 2 warnings are fired from a 64-bit executable, then they are not intercepted by your scripts compiled in 32-bit...???
(32bit vs 64bit doesn't work)??

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...