Posts: 4
Threads: 2
Joined: Feb 2014
We have made this macro to run a program but it updated yesterday which changed the name of the program and messed up the macro so it wont work now, is there any way we can use a wildcard so that we dont have to change the macro everytime the program updates ? Or some way that we only need partial of the program name
Posts: 4
Threads: 2
Joined: Feb 2014
i am referring to the windows handle
For Example
win("Linnworks - Order Management - Release 4 - 4.1.1.1 - 467" "WindowsForms10.Window.8.app.0.2780b98")
Changes to
win("Linnworks - Order Management - Release 4 - 4.1.1.1 - 468" "WindowsForms10.Window.8.app.0.2780b98")
Posts: 1,337
Threads: 61
Joined: Jul 2006
you can edit the window name it doesn't have to have the entire title of the window
By Default name can be partial
could use
win("Linnworks - Order Management" "WindowsForms10.Window.8.app.0.2780b98")
it still Will work.
or you could use
win("" "WindowsForms10.Window.8.app.0.2780b98")
and Still Will Work but only using the class name may not work so good if you have other windows open that have the same class name
read more in qm help title win(Find window (get handle); compare properties)
Posts: 23
Threads: 8
Joined: Sep 2013
Hi. For similar cases in the future you can use regular expressions (which is a powerful and versatile way to define a string) or wildcard characters. The program will acknowledge you intend to use one of these if you add the right flags.
Related info from the page "Find window (get handle); compare properties", in the help document:
flag "1":
name is full or with wildcard characters (*?).
For example, if window name must end with " - Notepad", use "* - Notepad" and flag 1. If it must be exactly "Notepad", use "Notepad" and flag 1.
String "*" matches windows with no name.
For example, for the name you could use this:
"Linnworks - Order Management - Release*"
or
"Linnworks - Order Management*"
but for these two you will have to add the exename and the flags. It's easy but if you don't understand how to do it, ask here.
Have in mind that, if you use the "Find window or control" dialog (and some other ones), after you fill some of the fields you can test whether the information you have entered is accurate enouph or not for the macro to find (during the present conditions) the window (or the child window, or the accessible object, depending on the dialog). That is, you put some values in the dialog's fields - either manually or by using the "Drag" tool - and then you click at the "test" button. If it can find it with the info you have entered, a black rectangle will flicker about 5 times arround the object you try to "describe". If it can't find it, you will see a warning message - in this case you can edit the fields and try again.
Plus when you need to replace or just find some text in one or many macros (e.g. replace "Linnworks - Order Management - Release 4 - 4.1.1.1 - 467" with "Linnworks - Order Management - Release 4 - 4.1.1.1 - 468" or with "Linnworks - Order Management*") you can do it very easily with the "Find" pane; it's very-very useful!
Also, if you have (or intend to have) more macros that use the Linnworks window you could create a function that finds it and returns its handle. Then, where you need the handle, you can enter just the function's name and, if they change the text of the window again, you will have to make a change only to this function and not to all the macros and functions that use it.
OS: Windows XP Home Edition SP2
Memory: 1024 MB (1016 MB system + 8 MB video)
Virtual Memory: 2.00 GB
CPU: 1.60 GHz