Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
activating windows with dynamic name
#6
1. Is it possible to match unknown length wild cards?  
yes as long as the maxlength is higher than the unknown length 

in the regex pattern [a-zA-Z]{3,5} matches any letters 3 to 5 characters long the {3,5} the 3 is the min number to match the 5 is the max. can change either number. The [] means characters in set. So could do

[a-zA-Z0-9]{3,50} which would match any group of letters and or letters and numbers 3 to 50 characters long


2. Is it possible to include characters other than letters in the wildcard e.g. "-","%","+" etc and multiple wildcards at different points in the window name?
yes
regular expressions are a very powerful tool


Code:
Copy      Help
int w1=win("test .{3,50} black .{3,50}" "Notepad" "Notepad" 0x200)

will match name  test followed by any character 3-50 in length followed by black followed by  any character 3-50 in length

another quick example for a more complicated search with random characters in the middle and the end

Function RandomNotepadName2
Code:
Copy      Help
int w
run "$system$\notepad.exe" "" "" "" 0x800 win("" "Notepad") w
rep 10
,str mp ep
,mp.RandomString(3 50)
,ep.RandomString(3 50)
,_s.format("test %s black %s" mp ep)
,_s.setwintext(w)
,0.3
,int w1=win("test .{3,50} black .{3,50}" "Notepad" "Notepad" 0x200) 
,act w1
,1
,act _hwndqm
,1


Messages In This Thread
RE: activating windows with dynamic name - by Kevin - 02-06-2019, 06:58 PM
RE: activating windows with dynamic name - by r0n - 02-11-2019, 05:07 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)