to open window which starts with different name
#1
Posted 06 May 2012 - 03:57 PM
to activate a window which starts with 1
I make like this
SetTitleMatchMode, 2
IfWinNotActive,1, , WinActivate,1,
WinWaitActive, 1,
how to make to open window which starts
1 or 2 or 3 or 4 or b
#2
Posted 06 May 2012 - 05:33 PM
SetTitleMatchMode, RegEx
IfWinNotActive, ^[1234b].*
{
WinActivate, ^[1234b].*
WinWaitActive, ^[1234b].*
}
SetTitleMatchMode, 1
; reset the matchmode to the usual default 1 unless you want to use
; more Regular expressions in following Win routines
exit
#3
Posted 06 May 2012 - 07:23 PM
i very did not include/understand
i have windows has ouvrire which begins like
100123
254833
g55555
only the first letter is known
100235
102358
155555
255555
if j' have a window which starts with 1
I do this
SetTitleMatchMode, 2
WinMaximize,1 ,
here it little to start with 1 or 2 or g
possible D to have more d' explanation?
#4
Posted 06 May 2012 - 08:55 PM
SetTitleMatchMode, RegEx
IfWinNotActive, ^[1234b].*
{
WinActivate, ^[1234b].*
WinWaitActive, ^[1234b].*
}
SetTitleMatchMode, RegEx - Sets the matching mode to regex so you can use more complex searching patterns
Other commands -> ^[1234b].*
^ means "starts with"
[1234b] means one of the chars 1, 2, 3, 4, or b (you can also say [1-4b])
.* means "and anything else after it", which you don't strictly need for title matches.
so your final regex is "starts with 1,2,3,4,or b, and can have anything else after it.
If you wanted to make it match any 6 digit number starting with 1, 2, 3, or 4, you could try ^[1-4][0-9]{5}.* which basically says a number that starts with 1-4 and has 0-9 for the next {5} chars.
#5
Posted 07 May 2012 - 11:29 PM
the window to detect which s' open ,with 1 or 2 or g
has like name 1jp
the window s' open
has L interrior of the window 1jp:aaaa bb rrrrr ffff (or another word)
j' have a text like this normalment if I double click of a mouse
I must select ffff
but its all selects 1jp:aaaa bb rrrrr ffff
j' would like that Ca selects just the end by double click
what little this to make if j' ustilise not the function SetTitleMatchMode, RegExk
can one cancel has one moment SetTitleMatchMode, RegExk ?
#6
Posted 08 May 2012 - 03:36 AM
cancels SetTitleMatchMode, RegEx
It is cancelled immediately after the window has been activated
so there is no more RegEx
It should not change how double-click selects a word inside the window.
Please show us your complete script.
#7
Posted 08 May 2012 - 06:16 PM
there was one *on a line
on the other hand SetTitleMatchMode, RegExk little to detect a window which starts with Ca ?
EXAMPLE :
#SingleInstance,ignore
loop
{
SetTitleMatchMode, RegEx
Sleep, 100
IfWinNotActive, ^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&é"'(-è_çà)=~#{[|`\^@]}+-*/:!;,?.§<>=)^_|-"].*
{
IfWinExist, ^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&é"'(-è_çà)=~#{[|`\^@]}+-*/:!;,?.§<>=)^_|-"].*
Sleep, 100
WinMaximize, ^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&é"'(-è_çà)=~#{[|`\^@]}+-*/:!;,?.§<>=)^_|-"].*
Sleep, 100
}
Sleep, 500
}
return
??
#8
Posted 08 May 2012 - 06:30 PM
Script lines most recently executed (oldest first). Press [F5] to refresh. The seconds elapsed between a line and the one after it is in parentheses to the right (if not 0). The bottommost line's elapsed time is the number of seconds since it executed.
002: Loop
005: SetTitleMatchMode,RegEx
006: Sleep,100 (0.11)
007: IfWinNotActive,^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&é"'(-è_çà)=~#{[|\^@]}+-*/:!;,?.§<>=)^_|-"].*
009: IfWinExist,^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&é"'(-è_çà)=~#{[|\^@]}+-*/:!;,?.§<>=)^_|-"].*,,WinClose
011: Send,{CTRLDOW}k{CTRLUP} (0.03)
012: Send,{CTRLDOW}z{CTRLUP} (0.03)
014: Sleep,300 (0.30)
015: Run,"C:\Documents and Settings\pczic\Bureau\detection im op1.ahk" (0.24)
016: Sleep,300 (0.30)
017: Run,"C:\Documents and Settings\pczic\Bureau\RecoRoom1.ahk" (0.27)
021: WinWait,^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&é"'(-è_çà)=~#{[|\^@]}+-*/:!;,?.§<>=)^_|-"].* (1096.30)
#9
Posted 09 May 2012 - 12:06 AM
on the other hand SetTitleMatchMode, RegExk little to detect a window which starts with Ca ?
SetTitleMatchMode, RegEx IfWinExist ^Ca.*^ means the title must start with the following letters (which are: Ca)
Ca means Ca exactly
.* means it can have anything after the Ca
#10
Posted 09 May 2012 - 12:26 AM
It should be: Send, ^k
In your first script, the Loop will continue running forever, after it has maximized all the non-active windows that match your regular expression.
In your second script, WinWait will wait forever, because you have closed all windows that match your regular expression.
Your regular expression:
IfWinNotActive, ^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&é"'(-è_çà)=~#{[|\^@]}+-*/:!;,?.§<>=)^_|-"].*
is almost the same as this:
IfWinNotActive, .*
It will match almost every window (Yes if a window's title starts with "è" for example. No if a window's title starts with "È" for example)
#11
Posted 09 May 2012 - 10:51 PM
I will try d' to explain
the principle will be 1 popup .it has a single name (xx).if I open popup.the window has another name (1111)
but the name of the window pueut to be different each time (248) or (489)...
what I seek has to make :
1> detection of the popup
2> to recover its true name
3> if real name of the window is (489)you launch the program (1)
4> so another name you launches program (2)
5> you close the window
6> to await a news popup
here I do not know if I am clear?
to afflict I am not good in English :?
#12
Posted 11 May 2012 - 04:29 AM
#13
Posted 11 May 2012 - 05:34 AM
but maybe it has the same "class name" each time?
You can detect its class name by running Autoit Window Spy (it's on the Start Menu in the AutoHotkey folder). When Window Spy is running, move the mouse pointer over the target window. Near the top of Window Spy, it will say:
ahk_class <classname>
Use that classname in your script:
Loop
(
IfWinExist ahk_class classname ; (change "classname" to be what Window Spy told you)
{
WinGetTitle, vartitle
if vartitle = 489
run c:\path\program1.exe
else if vartitle = 248
run c:\path\program2.exe
else if vartitle = 1001
run c:\path\program3.exe
else
msgbox the title was unusual %vartitle%
break
}
sleep 250
}
return
Because of the Loop, the script will run continuously until it sees a window with that classname. Then it will run the command you want and quit (because of the Break).
#14
Posted 11 May 2012 - 06:56 AM
Loop
{
IfWinExist ahk_class classname ; (change "classname" to be what Window Spy told you)
{
WinGetTitle, vartitle
if(regexmatch(vartitle,"^[34].*"))
{
msgbox the title starts with 3 or 4
run c:\path\program1
}
else if(regexmatch(vartitle,"^1.*"))
{
msgbox the title starts with 1
run c:\path\program2
}
else
{
msgbox title not matched %vartitle%
}
break ; stops the loop because it found a target window
} ; end of IfWinExist
sleep 250 ; so the continuous loop will not make the CPU too busy
} ; end of Loop. Starts the loop again.
return
#15
Posted 16 May 2012 - 01:15 PM




