Jump to content

How to make scripts more generic with title bar contents


Recommended Posts

Hey there! I am brand-spanking new to AutoIt, and am taking the baby-food route in experimenting with it by using AU3Record 3.1 to record mouse and keystrokes as a starting point for scripts.

One issue I have had is that AU3Record captures such specific Title bar information that if the title bar content changes (though is the same application), then the script will pause--waiting for the exact title bar to show up.

For example, I am creating a script which will enter text into a console window. The Title bar shows the path to my Document and Settings path with my user name. But to use this script more generically (and so others may use it), the script won't work this way.

So, how can I adjust the script content to be more generic? Will the script run properly if I remove the absolute path from the script, and only show the EXE name? Would this work if both the script and the EXE are in the same folder?

Thank you for your assistance in advance!

RGBreality

Link to comment
Share on other sites

Hello there,

First off welcome to AutoIT and thank you for your well formatted and coherent question :blink:

I think what you are looking for is a window title matching mode. Basically this will determine how autoit matches windows eg: exact match, partial match from start of the string, and partial match from anywhere in the title string.

The syntax for this is:

opt(winTitleMatchMode, #)

Excerpt from help file:

WinTitleMatchMode Alters the method that is used to match window titles during search operations.

1 = Match the title from the start (default)

2 = Match any substring in the title

3 = Exact title match

4 = Advanced mode, see Window Titles & Text (Advanced)

-1 to -4 = force lower case match according to other type of match.

replace # in the above code with 2 and you will be able to match just the "name.exe" and ignore the file path.

Hope this helps

-1

What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

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