Jump to content

Test script behaves unexpectedly


Recommended Posts

Hello

I have just begun using AutoIt (Version: 3.3.6.1), and in making a very simple test script I am seeing unusual behavior. I am completely new to this but possibly it's a bug so I thought I should post about it...

The script simply binds a double mouse click to a hotkey:

HotKeySet("z", "KeyA")

Func KeyA()

Send( MouseClick("left") )

Send( MouseClick("left") )

EndFunc

While 1

Sleep (10)

WEnd

It works fine, as long as I don't have a file or folder on the desktop (where I was testing) that has a name beginning with "1". No matter what file the mouse pointer is over, a file or folder on the desktop that is named "1 ..." will always open instead (I happened to have a text file on the desktop named as a phone number " 1 800 xxx ...."). If I rename or remove the file from the desktop, then the compiled script operates as expected. Files or folders on the desktop with names beginning with numerals other than 1 do not cause this behavior. Rather odd, it seems. I tested on two different systems (XP Pro x64, & XP Pro x86) and received the same result.

Any ideas?

Other than this, thanks for what seems to be a great utility. No doubt it will consume a great deal of time learning to use it well, but surely it will save much more in the long run :mellow:

Link to comment
Share on other sites

Welcome to the forum!

You shouldn't be using Send().

HotKeySet("{Esc}", "ExitPlease")
HotKeySet("z", "KeyA")

Func KeyA()
    MouseClick("left")
    MouseClick("left")
EndFunc

Func ExitPlease()
    Exit
EndFunc

While 1
    Sleep (10)
WEnd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Welcome to the forum!

You shouldn't be using Send().

Thank you! That works so much better. Figured it had to be something simple that I was yet to become painfully aware of.

I took that snippet from this board, #785528 which came up googling 'autoit hotkey'. & I see you posted right below that one too :mellow:

Appreciate the reply.

Oh, ESC is already bound in the application, & I can't let AutoIt rob that input, but thanks as well for pointing out the need for some method to terminate. Not to worry, taken care of.

Back to reading AutoIt3.chm ...

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...