Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Different window class every launch
#1
I am trying to add a command to bring a window (Camtasia) to the front or launch it. I usually am successful with a command like
Code:
Copy      Help
int w3=win("Camtasia 9" "HwndWrapper[CamtasiaStudio.exe;;8840f44d-1628-4e6b-a264-e2e4c072445c]")
if(!w3)
   run "C:\Program Files\TechSmith\Camtasia 9\CamtasiaStudio.exe"
else
   act w3
My problem is the application keeps changing the class. When Firefox was doing this, I was able to use an empty string. I can’t seem to figure out what would work here. When I record the macro, I pick up something like this
Code:
Copy      Help
int w1=act(win("Camtasia 9" "HwndWrapper[CamtasiaStudio.exe;;9dd82749-1bbb-46d5-af73-64f395048457]"))
however, like I said the long number seems to change every time launch the program. How could I create a string that finds the window each time? Thanks
#2
Within "win" you can use wildcards for the "class" parameter:

Macro Macro3
Code:
Copy      Help
int w
;w=win("Mozilla Firefox" "MozillaWindowClass") ;; The actual 'win' definition
w=win("Mozilla Firefox" "MozillaWi*") ;; Alternative version, uses '*' (put cursor on 'win' then press [F1])

;; Could try this for 'Camtasia' code:
int w1=act(win("Camtasia 9" "HwndWrapper[CamtasiaStudio.exe*]"))
#3
That worked like a charm. Now I have another understanding of dynamic referencing. Thank you so much!


Forum Jump:


Users browsing this thread: 1 Guest(s)