Jump to content
Sign in to follow this  
ScottL

Windows Freezing when using AutoIt compiled EXE

Recommended Posts

ScottL

I'm having a problem that seems to be a new one for me. I've created a number of EXEs using AutoIt to streamline some of the more routine tasks in our company. These EXEs are used by a number of people. However, recent a few of the users are unable to use any of the EXEs, as they are making the users entire PC freeze. They cannot even control+alt+delete, as the task manager does not display.

Is this something anybody has heard of before? Is it a windows configuration thing, or an Autoit thing, or something else entirely?

Thanks

Share this post


Link to post
Share on other sites
SmOke_N

I'm having a problem that seems to be a new one for me. I've created a number of EXEs using AutoIt to streamline some of the more routine tasks in our company. These EXEs are used by a number of people. However, recent a few of the users are unable to use any of the EXEs, as they are making the users entire PC freeze. They cannot even control+alt+delete, as the task manager does not display.

Is this something anybody has heard of before? Is it a windows configuration thing, or an Autoit thing, or something else entirely?

Thanks

It all has to do with your code I'm sure... Seeing as there is none to reproduce the issue, I can't see you getting very far with an actual/factual answer. Edited by SmOke_N

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
ScottL

It all has to do with your code I'm sure... Seeing as there is none to reproduce the issue, I can't see you getting very far with an actual/factual answer.

It's possible that it has to do with my code, in fact I hope it does becasue then at least I could make the correction and that would be the end of it. But since it is only happening to a select group of users and it happens with every script I've written, and it doesn't happen for the rest of the users and we are all using the same scripts (complied into EXEs)--something in all of this leads me to believe it's a windows setting.

As for code, a copy of one of my scripts is posted below. This script is designed to switch mapped drives to point to specific environments.

Again, any thoughts or help are greatly appreciated.

CODE
; Required inclusions

#include <GUIConstants.au3>

; Change to OnEvent mode

Opt("GUIOnEventMode", 1)

; Create the GUI

GUICreate("Planning Environment Toggle", 400, 110)

; Set the font for the GUI

$font = "Arial"

GUISetFont (10, 400, 0, $font)

; Establish the event for the Windows close button

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

; Create radio buttons for CM and RBT

$radio1 = GUICtrlCreateRadio ("CM Planning Environment", 10, 10, 250, 20)

GUICtrlSetState ($radio1,$GUI_CHECKED)

$radio2 = GUICtrlCreateRadio ("RBT Planning Environment", 10, 40, 250, 20)

; Create an OK button and establish an event for it

$okbutton = GUICtrlCreateButton("OK", 10, 75, 50)

GUICtrlSetOnEvent($okbutton, "OKButton")

; Check to see which version of Windows is being run, XP or NT

If FileExists("C:\WINNT") Then

$windir = "C:\WINNT"

Else

$windir = "C:\WINDOWS"

EndIf

; Set the GUI state

GUISetState ()

; Idle until an event is called

While 1

Sleep(1000)

WEnd

; OK button function

Func OKButton()

; RBT radion button

If GUICtrlRead($radio1)>1 Then

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0,$font)

GUICtrlCreateLabel("RBT Environment selected ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(3000)

GUISetState(@SW_HIDE)

; Disconnect mapped Drive

DriveMapDel("M:")

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0,$font)

GUICtrlCreateLabel("Previous Environment disconnecting ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(5000)

GUISetState(@SW_HIDE)

; Connect mapped Drive

DriveMapAdd("M:", "\\artapp1\RBT2planning", 1)

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0, $font)

GUICtrlCreateLabel("RBT Environment Mapping ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(5000)

GUISetState(@SW_HIDE)

; Copies the EQLSRVR.INI file from the server to the local machine

FileCopy("M:\Functional0 - Config\eqlsrvr.ini", $windir & "\eqlsrvr.ini", 1)

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0, $font)

GUICtrlCreateLabel("INI Files Copying ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(5000)

GUISetState(@SW_HIDE)

; Exit the program

Exit

; CM radio button

ElseIf GUICtrlRead($radio2)>1 Then

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0, $font)

GUICtrlCreateLabel("CM Environment selected ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(3000)

GUISetState(@SW_HIDE)

; Disconnect mapped Drive

DriveMapDel("M:")

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0, $font)

GUICtrlCreateLabel("Previous Environment disconnecting ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(5000)

GUISetState(@SW_HIDE)

; Connect mapped Drive

DriveMapAdd("M:", "\\artapp1\planning", 1)

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0, $font)

GUICtrlCreateLabel("CM Environment mapping ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(5000)

GUISetState(@SW_HIDE)

; Copies the EQLSRVR.INI file from the server to the local machine

FileCopy("M:\Functional0 - Config\eqlsrvr.ini", $windir & "\eqlsrvr.ini", 1)

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0, $font)

GUICtrlCreateLabel("INI Files Copying ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(5000)

GUISetState(@SW_HIDE)

; Exit the program

Exit

EndIf

EndFunc

; Close function

Func CLOSEClicked()

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0, $font)

GUICtrlCreateLabel("Exiting ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(3000)

GUISetState(@SW_HIDE)

; Exit the program

Exit

EndFunc

Share this post


Link to post
Share on other sites
kiwikid

It's possible that it has to do with my code, in fact I hope it does becasue then at least I could make the correction and that would be the end of it. But since it is only happening to a select group of users and it happens with every script I've written, and it doesn't happen for the rest of the users and we are all using the same scripts (complied into EXEs)--something in all of this leads me to believe it's a windows setting.

As for code, a copy of one of my scripts is posted below. This script is designed to switch mapped drives to point to specific environments.

Again, any thoughts or help are greatly appreciated.

CODE
; Required inclusions

#include <GUIConstants.au3>

; Change to OnEvent mode

Opt("GUIOnEventMode", 1)

; Create the GUI

GUICreate("Planning Environment Toggle", 400, 110)

; Set the font for the GUI

$font = "Arial"

GUISetFont (10, 400, 0, $font)

; Establish the event for the Windows close button

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

; Create radio buttons for CM and RBT

$radio1 = GUICtrlCreateRadio ("CM Planning Environment", 10, 10, 250, 20)

GUICtrlSetState ($radio1,$GUI_CHECKED)

$radio2 = GUICtrlCreateRadio ("RBT Planning Environment", 10, 40, 250, 20)

; Create an OK button and establish an event for it

$okbutton = GUICtrlCreateButton("OK", 10, 75, 50)

GUICtrlSetOnEvent($okbutton, "OKButton")

; Check to see which version of Windows is being run, XP or NT

If FileExists("C:\WINNT") Then

$windir = "C:\WINNT"

Else

$windir = "C:\WINDOWS"

EndIf

; Set the GUI state

GUISetState ()

; Idle until an event is called

While 1

Sleep(1000)

WEnd

; OK button function

Func OKButton()

; RBT radion button

If GUICtrlRead($radio1)>1 Then

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0,$font)

GUICtrlCreateLabel("RBT Environment selected ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(3000)

GUISetState(@SW_HIDE)

; Disconnect mapped Drive

DriveMapDel("M:")

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0,$font)

GUICtrlCreateLabel("Previous Environment disconnecting ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(5000)

GUISetState(@SW_HIDE)

; Connect mapped Drive

DriveMapAdd("M:", "\\artapp1\RBT2planning", 1)

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0, $font)

GUICtrlCreateLabel("RBT Environment Mapping ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(5000)

GUISetState(@SW_HIDE)

; Copies the EQLSRVR.INI file from the server to the local machine

FileCopy("M:\Functional0 - Config\eqlsrvr.ini", $windir & "\eqlsrvr.ini", 1)

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0, $font)

GUICtrlCreateLabel("INI Files Copying ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(5000)

GUISetState(@SW_HIDE)

; Exit the program

Exit

; CM radio button

ElseIf GUICtrlRead($radio2)>1 Then

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0, $font)

GUICtrlCreateLabel("CM Environment selected ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(3000)

GUISetState(@SW_HIDE)

; Disconnect mapped Drive

DriveMapDel("M:")

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0, $font)

GUICtrlCreateLabel("Previous Environment disconnecting ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(5000)

GUISetState(@SW_HIDE)

; Connect mapped Drive

DriveMapAdd("M:", "\\artapp1\planning", 1)

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0, $font)

GUICtrlCreateLabel("CM Environment mapping ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(5000)

GUISetState(@SW_HIDE)

; Copies the EQLSRVR.INI file from the server to the local machine

FileCopy("M:\Functional0 - Config\eqlsrvr.ini", $windir & "\eqlsrvr.ini", 1)

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0, $font)

GUICtrlCreateLabel("INI Files Copying ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(5000)

GUISetState(@SW_HIDE)

; Exit the program

Exit

EndIf

EndFunc

; Close function

Func CLOSEClicked()

; Create message GUI

$handle = GUICreate("Please Wait", 250, 50)

GUISetFont (10, 400, 0, $font)

GUICtrlCreateLabel("Exiting ...", 20, 10)

GUISetState(@SW_SHOW)

Sleep(3000)

GUISetState(@SW_HIDE)

; Exit the program

Exit

EndFunc

After a quick glance of your code, I'd recommend checking out the return code from the DriveMapAdd.

i.e.

$result = DriveMapAdd("M:", "\\artapp1\RBT2planning", 1)

MsgBox (0, "Trying to map the drive", $result)

From the help file:

When the function fails (returns 0) @error contains extended information:

1 = Undefined / Other error. @extended set with Windows API return

2 = Access to the remote share was denied

3 = The device is already assigned

4 = Invalid device name

5 = Invalid remote share

6 = Invalid password

Share this post


Link to post
Share on other sites
SmOke_N

; Check to see which version of Windows is being run, XP or NT
If FileExists("C:\WINNT") Then
$windir = "C:\WINNT"
Else
$windir = "C:\WINDOWS"
EndIfoÝ÷ Ø   e¶l¨§v¸¯zØZ¶Øb²++jz'À)è¶;¬¶ëZ)Ý£·è­©eæX§zÊr^¶«y«­¢+ØÀÌØíÝ¥¹¥Èô]¥¹½ÝÍ¥È

I didn't go past that point.


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
ScottL

I didn't go past that point.

I'm still learning the finer points of programming as well as autoit. Yes, your single line of code is easier, probably more stable, and certainly more elegant than my own. But this is not the problem. I do hope you will keep going through the code to see if you find anything truly glaring to may cause this to work on some PCs and not others.

From the help file:

When the function fails (returns 0) @error contains extended information:

1 = Undefined / Other error. @extended set with Windows API return

2 = Access to the remote share was denied

3 = The device is already assigned

4 = Invalid device name

5 = Invalid remote share

6 = Invalid password

Thanks for the advice. I plan on trying this to see what the results are. But this too does not seem to be the problem. This script works on some PCs and not others. Additional scripts I have written do not reference the Windows Directory nor do they map to a drive, and they work on some PCs and not others.

So I'm still left with the same question: could this be a Windows setting or configuration issue?

Share this post


Link to post
Share on other sites
SmOke_N

Possibly because you're not actually checking the "@error" here, is why it returns "0" (for failure by the way).

Failure: Returns 0 if a new mapping could not be created and sets @error

So, $result would only contain the 0 or 1 (1 for success) as a boolean value.

$result = DriveMapAdd("M:", "\\artapp1\RBT2planning", 1)
$nError = @error
If $result = 0 Then MsgBox (0, "Trying to map the drive", "Error Code: " & $nError)
Should help you along.

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
ScottL

Possibly because you're not actually checking the "@error" here, is why it returns "0" (for failure by the way).So, $result would only contain the 0 or 1 (1 for success) as a boolean value.

$result = DriveMapAdd("M:", "\\artapp1\RBT2planning", 1)
$nError = @error
If $result = 0 Then MsgBox (0, "Trying to map the drive", "Error Code: " & $nError)
Should help you along.
But I'm not having the error when the script executes. The problem I'm having is that, for some of the users, the EXE never loads. It doesn't even come up on the desktop. And then, nothing else will run either, including Windows Task Manager. They can't even control+alt+delete to shut down. They have to hard boot.

But not every user! Just some of them. For the others, the exact same script works fine.

I don't understand why that is! What would be so wrong in a script that the resulting compiled EXE does not even load on a PC for some users, but it does load and work perfectly normally for other??

Share this post


Link to post
Share on other sites
SmOke_N

But I'm not having the error when the script executes. The problem I'm having is that, for some of the users, the EXE never loads. It doesn't even come up on the desktop. And then, nothing else will run either, including Windows Task Manager. They can't even control+alt+delete to shut down. They have to hard boot.

But not every user! Just some of them. For the others, the exact same script works fine.

I don't understand why that is! What would be so wrong in a script that the resulting compiled EXE does not even load on a PC for some users, but it does load and work perfectly normally for other??

As I said before, you were hard coding things with "C:" drive. I would go to those PC's and see what drive they are actually using... I can't run your script personally, but if you are debugging, why not use what I just showed you about WindowsDir and the error checking to see what the issues really are. I don't see the complications in it if you have access and permissions to run the stuff you are running anyway on them.

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
ScottL

As I said before, you were hard coding things with "C:" drive. I would go to those PC's and see what drive they are actually using... I can't run your script personally, but if you are debugging, why not use what I just showed you about WindowsDir and the error checking to see what the issues really are. I don't see the complications in it if you have access and permissions to run the stuff you are running anyway on them.

I made the recommended changes. The windows directory variable is now set to @WindowsDir, and I added the variable and if statement to trap any error with the DriveMapAdd. It still did not work.

As before, the EXE never loaded on the PC and the remaining applications became frozen and I had to hard boot the machine.

Any other thoughts on what could be causing this (and any AutoIt EXE) to freeze the machine?

Share this post


Link to post
Share on other sites
SmOke_N

I made the recommended changes. The windows directory variable is now set to @WindowsDir, and I added the variable and if statement to trap any error with the DriveMapAdd. It still did not work.

As before, the EXE never loaded on the PC and the remaining applications became frozen and I had to hard boot the machine.

Any other thoughts on what could be causing this (and any AutoIt EXE) to freeze the machine?

No I have no idea with the code you provided really, other than the obvious I stated before. The only other thing I can think of is that you are running it on a machine with no ram what so ever, a memory leak in one of the functions you are using, an operating system that isn't supported, or maybe AV software is over writing it before it's ran (doesn't really explain the PC freezing).

If you think it's one of the functions, then you need to create a working example (that re-creates your issue) that someone can run, to test it.


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
kiwikid

I made the recommended changes. The windows directory variable is now set to @WindowsDir, and I added the variable and if statement to trap any error with the DriveMapAdd. It still did not work.

As before, the EXE never loaded on the PC and the remaining applications became frozen and I had to hard boot the machine.

Any other thoughts on what could be causing this (and any AutoIt EXE) to freeze the machine?

Are your users telling you that it won't load and is locking up or have you verified it personally? It could be an EBKAC. I have seen where some of my programs/scripts have hung for a while and that's all due to a user getting a little impatient and clicking non stop creating several instances of the same program/script running in the background. This could lock up a computer for various reasons dependent upon the scope of the script and/or how it's written. This is just an idea though.

Share this post


Link to post
Share on other sites
herewasplato

...But since it is only happening to a select group of users and it happens with every script I've written, and it doesn't happen for the rest of the users and we are all using the same scripts (complied into EXEs)--something in all of this leads me to believe it's a windows setting...

Are they all running the same version of anti virus software? If yes, do they all have the same rev signature file (virus list)?

If it turns out to be the AV software doing a bad job of quarantining your AutoIt EXE, then I would like to know who makes the AV software so that I can avoid it :-)

I could not tell for sure from your first post, but it sounds like you have one or more users that could run one or more of your EXEs and now that same user(s) cannot run that same (unchanged) EXE. That would point to something else changing on the user's system... like an AV signature file update and a bad quarantine attempt.

Grasping at straws here...

-MSP-


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
ScottL

Are they all running the same version of anti virus software? If yes, do they all have the same rev signature file (virus list)?

If it turns out to be the AV software doing a bad job of quarantining your AutoIt EXE, then I would like to know who makes the AV software so that I can avoid it :-)

A month later...

Here's the answer (apparently). We are all using the same anti-virus (Symantec), but we have differnet operating systems. Some of us are on XP, some are on Windows 2000. Apparently, the anti-virus was trying to block the EXEs on any PC running Windows 2000, but not on any running XP. And it was doing it so poorly, that it was freezing the whole machine. Our PC group that administers the anti-virus had to put in special exclusions so that the autoit EXEs would run.

How strange is that?

Thanks again for everybody's help!

Share this post


Link to post
Share on other sites
herewasplato

Thanks for the update.

I also use Symantec

Corp Ed. 10.1.4.4010

Scan Eng 71.3.0.25

But I have no W2k OSs left - only XP.

Glad you are up and running again.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
herewasplato

OH NO!!!

@herewasplato, you need to be on 10.1.6, the 10.1.4 build has vulnerabilities.

Also, have you checked out Symantec Endpoint Protection 11.0? Its new from the ground up ( I would only recommend this in a test env. for now as it is so new )

Unfortunately, I do not make those decisions for the company that I work for. :-(

[size="1"][font="Arial"].[u].[/u][/font][/size]

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.