Jump to content

Script Running Twice


Recommended Posts

Hello,

I've used AutoIt several years ago, and I want to use it again today for a new project. So I have installed the latest version on my Windows 7 machine.

I have started to write a few simple scripts, build exe files and execute them. But each time I double-click the .exe file runs twice !

For example the "msgbox.au3" example provided with the installation files will display the text box a first time, then I click "Ok", and the text box shows up again.

Here is the script :

#include <Constants.au3>

MsgBox($MB_SYSTEMMODAL, "AutoIt Example", "This is line 1" & @CRLF & "This is line 2" & @CRLF & "This is line 3")

What is wrong ???

Edited by Codyssey
Link to comment
Share on other sites

The script is : "C:\Program Files (x86)\AutoIt3\Examples\msgbox.au3" provided with AutoIt installation. It only contains the two lines I have written above, plus some comments :

 

#include <Constants.au3>

;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win9x/NT
; Author:         Jonathan Bennett (jon at autoitscript dot com)
;
; Script Function:
;   Demo of using multiple lines in a message box
;

; Use the @CRLF macro to create a newline in a MsgBox - it is similar to the n in v2.64
MsgBox($MB_SYSTEMMODAL, "AutoIt Example", "This is line 1" & @CRLF & "This is line 2" & @CRLF & "This is line 3")

However, the problem occurs with any script I have tried so far, so I think that the problem is related to AutoIt and/or my PC configuration. If I run the .au3 file (instead of the .exe file) from the AutoIt editor, it runs once.

Link to comment
Share on other sites

I had already copied the au3 file in a sub-folder of my docs folder.

I have just tested AutoIt on another PC, and it did'nt have this problem. The most obvious difference between the two PC is the antivirius. So I tried to deactivate the antivirus (Avast) and ... it worked !!!

Now I have to figure out why Avast Antivirus causes exe files created with Autoit to run twice...

Edited by Codyssey
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...