Code: Select all
MsgBox, % ErrorLevel
Code: Select all
MsgBox, % ErrorLevel
If the button always is at the same place, then You dont need image search.
If the plugin window is a true stand-alone window, then you can do this using coordinates relative to the window. It looks like it may not be, though. If not, then you need to somehow locate the position of the button, and ImageSearch should work.Philharmonic wrote: ↑28 Jun 2017, 11:27I know that I can use mouse base location, but that would not be ideal for me because the plugin window will not always be in the same location.
Using .png format is just as reliable as .bmp format. They both are lossless (no compression artifacts), which is the key -- 100% pixel-for-pixel true to the original image. It is formats like .jpg that change the pixel content while they compress the image that can and will cause ImageSearch to fail.BoBo wrote: ↑18 Apr 2020, 06:56Just for the records, as far as I remember ImageSearch works best/more reliable if the source image is in *.bmp format.
Philharmonic wrote: ↑18 Apr 2020, 12:22Thanks everyone for your help and suggestions. Totally awesome of you all for pitching in. I'm going to run some test of my own, specifically using FindText. That looks very interesting. If that doesn't find the result I want, then I'll move to other suggestions noted on this thread. There will definitely be a bunch of trial an error, but regardless, I will keep you all updated on my findings. It's' going to take sometime so thank you all again.
Halelluja!!!!w0z wrote: ↑18 Apr 2020, 13:26Philharmonic wrote: ↑18 Apr 2020, 12:22Thanks everyone for your help and suggestions. Totally awesome of you all for pitching in. I'm going to run some test of my own, specifically using FindText. That looks very interesting. If that doesn't find the result I want, then I'll move to other suggestions noted on this thread. There will definitely be a bunch of trial an error, but regardless, I will keep you all updated on my findings. It's' going to take sometime so thank you all again.
I made a short video:
https://www.youtube.com/watch?v=rnJF_D5yIBQ
I hope it helps.!
Code: Select all
PgUp::
WinMenuSelectItem, Pro Tools, , AudioSuite, EQ, Channel Strip
return
Code: Select all
#Include FindText.ahk
PgUp::
WinMenuSelectItem, Pro Tools, , AudioSuite, EQ, Channel Strip
return
t1:=A_TickCount, X:=Y:=""
Text:="|<Render Button>*188$66.zzzzzzzzzzzU1zzzzzVzzzU1zzzzzVzzzbsTzzzzVzzzbsTzzzzVzzzbsM7U7U1US1bsM7U7U1US1U1VVbbba66TU1VVbbba66TbbU1bbba06TbbU1bbba06TbVtzbbbbbyTbVtzbbbbbyTbsM7bbU7USTbsM7bbU7USTzzzzzzzzzzzU"
if (ok:=FindText(842-150000, 1703-150000, 842+150000, 1703+150000, 0, 0, Text))
{
CoordMode, Mouse
X:=ok.1.x, Y:=ok.1.y, Comment:=ok.1.id
Click, %X%, %Y%
}
for i,v in ok
if (i<=2)
FindText_MouseTip(ok[i].x, ok[i].y)
Return
Code: Select all
#Include FindText.ahk
PgUp::
WinMenuSelectItem, Pro Tools, , AudioSuite, EQ, Channel Strip
;return ; in this line it is the end of the code therefore lines below won't work. So delete it
Sleep, 1000
t1:=A_TickCount, X:=Y:=""
...
A couple of things that can be done to help ImageSearch work better.Philharmonic wrote: ↑17 Apr 2020, 18:57I'm sorry to keep wasting your time on this, but I just can't figure it out...boiler wrote: ↑17 Apr 2020, 17:45You need to crop that image so it's within the bounds of the button itself for the reason described in my last post. Best to make the image just around the letters.
In what directory is the script file that you are running? That's where you put the image. Otherwise, you can specify the full path to the image by changing the ImageSearch to this:Code: Select all
ImageSearch, ImX, ImY, 0, 0, A_ScreenWidth, A_ScreenHeight, C:\Program Files\AutoHotkey\render.png
Code: Select all
ImageSearch, ImX, ImY, 0, 0, A_ScreenWidth, A_ScreenHeight, *50 C:\Program Files\AutoHotkey\render.png
SOTE wrote: ↑18 Apr 2020, 17:54A couple of things that can be done to help ImageSearch work better.Philharmonic wrote: ↑17 Apr 2020, 18:57I'm sorry to keep wasting your time on this, but I just can't figure it out...boiler wrote: ↑17 Apr 2020, 17:45You need to crop that image so it's within the bounds of the button itself for the reason described in my last post. Best to make the image just around the letters.
In what directory is the script file that you are running? That's where you put the image. Otherwise, you can specify the full path to the image by changing the ImageSearch to this:Code: Select all
ImageSearch, ImX, ImY, 0, 0, A_ScreenWidth, A_ScreenHeight, C:\Program Files\AutoHotkey\render.png
1. Use *n (variation). https://www.autohotkey.com/docs/commands/ImageSearch.htm
The variation can be adjusted between 0 to 255. Helps if coloring of the image varies slightly and compensates for differences between ImageFile format (.jpg, .png, .gif, etc...) and image on the screen.2. Optionally, use WinActivate to select the correct window, before using ImageSearch. https://www.autohotkey.com/docs/commands/WinActivate.htmCode: Select all
ImageSearch, ImX, ImY, 0, 0, A_ScreenWidth, A_ScreenHeight, *50 C:\Program Files\AutoHotkey\render.png
If you have multiple windows on the desktop, this can help that you are searching the correct one.
3. Optionally, use CoordMode for searching the screen. https://www.autohotkey.com/docs/commands/CoordMode.htm
You usually just have to choose between WinActivate, WindowTitle or CoordMode, Pixel, Screen in your script.
w0z wrote: ↑18 Apr 2020, 17:36Code: Select all
#Include FindText.ahk PgUp:: WinMenuSelectItem, Pro Tools, , AudioSuite, EQ, Channel Strip ;return ; in this line it is the end of the code therefore lines below won't work. So delete it Sleep, 1000 t1:=A_TickCount, X:=Y:="" ...
Code: Select all
for i,v in ok
if (i<=2)
FindText_MouseTip(ok[i].x, ok[i].y)
if WinExist("ahk_class DigiFloaterClass")
WinKill
Return
Code: Select all
FindText_Left_Click(Obj,X_Adj=0,Y_Adj=0,Move_Back=0){
CoordMode, Mouse
MouseGetPos,Orig_X,Orig_Y
x:=(obj.1+obj.3//2)+X_Adj
y:=(obj.2+obj.4//2)+Y_Adj
Click, %X%,%Y%
if (Move_Back){
Sleep, 30
MouseMove, %Orig_X%,%Orig_Y%
}
Return
Code: Select all
#Include FindText.ahk
+d::
WinMenuSelectItem, Pro Tools, , Audiosuite, Noise Reduction, RX 7 De-click
Sleep, 1000
SetMouseDelay, 20
t1:=A_TickCount, X:=Y:=""
Text:="|<>*190$41.zzzzzzz1UakM8CtTBirrBqy/QjisABKt31qvuBmyrgrqPhxbQUiks/bzzzzzzw"
if (ok:=FindText(1392, 652, 1458, 672, 0, 0, Text))
{
CoordMode, Mouse
X:=ok.1.x, Y:=ok.1.y, Comment:=ok.1.id
Click, %X%, %Y%
}
for i,v in ok
if (i<=2)
FindText_MouseTip(ok[i].x, ok[i].y)
Sleep, 50
if WinExist("ahk_class DigiFloaterClass")
WinKill
Return
Code: Select all
#Include FindText.ahk
+d::
WinMenuSelectItem, Pro Tools, , Audiosuite, Noise Reduction, RX 7 De-click
Sleep, 1000
SetMouseDelay, 20
t1:=A_TickCount, X:=Y:=""
Text:="|<>*190$41.zzzzzzz1UakM8CtTBirrBqy/QjisABKt31qvuBmyrgrqPhxbQUiks/bzzzzzzw"
if (ok:=FindText(1392, 652, 1458, 672, 0, 0, Text))
{
CoordMode, Mouse
X:=ok.1.x, Y:=ok.1.y, Comment:=ok.1.id
Click, %X%, %Y%
}
for i,v in ok
if (i<=2)
FindText_MouseTip(ok[i].x, ok[i].y)
Sleep, 50
if WinExist("ahk_class DigiFloaterClass")
WinKill
Return
+p::
WinMenuSelectItem, Pro Tools, , Audiosuite, Noise Reduction, RX 7 De-plosive
Sleep, 1000
SetMouseDelay, 20
t1:=A_TickCount, X:=Y:=""
Text:="|<>*190$41.zzzzzzz1UakM8CtTBirrBqy/QjisABKt31qvuBmyrgrqPhxbQUiks/bzzzzzzw"
if (ok:=FindText(1392, 652, 1458, 672, 0, 0, Text))
{
CoordMode, Mouse
X:=ok.1.x, Y:=ok.1.y, Comment:=ok.1.id
Click, %X%, %Y%
}
for i,v in ok
if (i<=2)
FindText_MouseTip(ok[i].x, ok[i].y)
Sleep, 50
if WinExist("ahk_class DigiFloaterClass")
WinKill
Return
Code: Select all
~+d::
WinMenuSelectItem, Pro Tools, , Audiosuite, Noise Reduction, RX 7 De-click
Sleep, 500
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
loop, 50 ; wait a maximum of 5 seconds (50 * 100ms) for render button to appear
{
ImageSearch, ImX, ImY, 0, 0, A_ScreenWidth, A_ScreenHeight, render.png
Sleep, 100
} until !ErrorLevel
if ErrorLevel
MsgBox, Could not find 'Render' button
else
Click, %ImX%, %ImY%
Sleep, 2500
if WinExist("ahk_class DigiFloaterClass")
WinKill
Return
Code: Select all
~+d::
WinMenuSelectItem, Pro Tools, , Audiosuite, Noise Reduction, RX 7 De-click
Sleep, 500
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
MouseGetPos, PrevX, PrevY
loop, 50 ; wait a maximum of 5 seconds (50 * 100ms) for render button to appear
{
ImageSearch, ImX, ImY, 0, 0, A_ScreenWidth, A_ScreenHeight, render.png
Sleep, 100
} until !ErrorLevel
if ErrorLevel
MsgBox, Could not find 'Render' button
else
Click, %ImX%, %ImY%
MouseMove, PrevX, PrevY
Sleep, 2500
if WinExist("ahk_class DigiFloaterClass")
WinKill
Return
Oh shoot. Hahahahaha. Thanks for pitching in anyways.BNOLI wrote: ↑19 Apr 2020, 03:24Congrats! But I've checked the whole thread for that script that you've said I've had suggested - and didn't find it!
So I have the idea you saluted the wrong guy/lady Anyway, IMHO it's a combined effort of all contributors/supporters.
GO AHK
BTW, use MouseGetPos to keep the mouse position right before you trigger ImageSearch. Once ImageSearch went successfully let's move back to the previous position using MouseMove.
Good luck
Boiler! I initially saluted the wrong guy so I want to apologize. Haha! I wanted to personally thank you for helping me with this 3 year old problem. Thank you for your valuable time and effort in helping me out.boiler wrote: ↑19 Apr 2020, 05:38Below is how to use MouseGetPos and MouseMove to return the mouse pointer to its original position.I suspect the reason it didn’t work on your laptop is that you have a Windows setting for scaling at something other than 100%. What I’ve seen is that when the scaling factor is greater than 150%, Windows doesn’t render graphics at their true pixel-for-pixel representation, but it stretches and blends the pixel colors, usually making ImageSearch impossible even with high allowable variation in color.Code: Select all
~+d:: WinMenuSelectItem, Pro Tools, , Audiosuite, Noise Reduction, RX 7 De-click Sleep, 500 CoordMode, Pixel, Screen CoordMode, Mouse, Screen MouseGetPos, PrevX, PrevY loop, 50 ; wait a maximum of 5 seconds (50 * 100ms) for render button to appear { ImageSearch, ImX, ImY, 0, 0, A_ScreenWidth, A_ScreenHeight, render.png Sleep, 100 } until !ErrorLevel if ErrorLevel MsgBox, Could not find 'Render' button else Click, %ImX%, %ImY% MouseMove, PrevX, PrevY Sleep, 2500 if WinExist("ahk_class DigiFloaterClass") WinKill Return
Code: Select all
#IfWinActive, Pro Tools
+d::
WinMenuSelectItem, Pro Tools, , AudioSuite, Other, Gain
if WinExist("AudioSuite")
WinActivate
Sleep, 1000
WinGetPos, wX, wY, wW, wH, AudioSuite
SetMouseDelay, 20
t1:=A_TickCount, X:=Y:=""
Text:="|<>*190$41.zzzzzzz1UakM8CtTBirrBqy/QjisABKt31qvuBmyrgrqPhxbQUiks/bzzzzzzw"
; Text:="|<Render Button>*188$66.zzzzzzzzzzzU1zzzzzVzzzU1zzzzzVzzzbsTzzzzVzzzbsTzzzzVzzzbsM7U7U1US1bsM7U7U1US1U1VVbbba66TU1VVbbba66TbbU1bbba06TbbU1bbba06TbVtzbbbbbyTbVtzbbbbbyTbsM7bbU7USTbsM7bbU7USTzzzzzzzzzzzU"
if (ok:=FindText(wX, wY, wX+wW, wY+wH, 0, 0, Text))
{
CoordMode, Mouse,Screen
MouseGetPos, Orig_X,Orig_Y
X:=ok.1.x, Y:=ok.1.y, Comment:=ok.1.id
Click, %X%, %Y%
} else {
MsgBox, 48, , No render button found!, 2
}
for i,v in ok
if (i<=2)
FindText_MouseTip(ok[i].x, ok[i].y)
MouseMove, %Orig_X%, %Orig_Y%
Sleep, 1500
if WinExist("ahk_class DigiFloaterClass")
WinKill
Return
#IfWinActive
Users browsing this forum: haomingchen1998, ntepa, sofista, TAC109, Tvlao and 117 guests