Hello,
I have a window that is split screen and the two halves can be resizes. I have a text entry field that is a number and increased or decreased by clicking in either the up or down arrow buttons next to the text box. There is a label “textâ€Â
Click a toggle on a resizable window
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Sounds like a case for the Image Recognition Library. Using this you can have the script find the location of the up arrow button and click it. See examples that come with the image recognition library:
http://www.mjtnet.com/imagerecognition.htm
http://www.mjtnet.com/imagerecognition.htm
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Problems with Image Lib Examples
Hello,
Download image library examples, however; I cannot get "Google Button" & "Password" examples to work. I have the bitmaps in the correct place. I keep getting "invalid numberic value for mosemove command" for "MouseMove>imgs_5,imgs_6" Tried to display values of imgs_5 & imgs_6 in message command and displayed no value.
Any ideas?
Cheers.
Download image library examples, however; I cannot get "Google Button" & "Password" examples to work. I have the bitmaps in the correct place. I keep getting "invalid numberic value for mosemove command" for "MouseMove>imgs_5,imgs_6" Tried to display values of imgs_5 & imgs_6 in message command and displayed no value.
Any ideas?
Cheers.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Could you post your script - only my crystal ball aint working today and I need a bit more to go on ...
Seriously, post your script and we'll be better able to tell you what might be wrong.
Also please confirm which version of Macro Scheduler you are running. Check under Help/About.
Seriously, post your script and we'll be better able to tell you what might be wrong.
Also please confirm which version of Macro Scheduler you are running. Check under Help/About.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Sorry!
Here you go,
I have version 8.0.3e
Let>imglibDLL=%SCRIPT_DIR%\imglib.dll
LibLoad>imglibDll,imglib
//Focus Google
SetFocus>Google - Microsoft Internet Explorer
Wait>1
//Get bounds of window
GetActiveWindow>title,X,Y,W,H
//Capture the screen to a bitmap
IfFileExists>d:\screen.bmp
DeleteFile>d:\screen.bmp
EndIf
ScreenCapture>X,Y,W,H,d:\screen.bmp
LibFunc>imglib,FindImgPos,imgs,d:\googlebutton.bmp,d:\screen.bmp,20,1,ref:0,ref:0
If>imgs>0
MessageModal>%X% %Y% %W% %H%
//click on button
//remember that x,y returned is relative the image and since we didn't use the
//full screen we will need add top left offset to get screen coordinates
MessageModal>%imgs_5% %imgs_6%
Let>x=imgs_5+x
Let>y=imgs_6+y
MouseMove>x,y
LClick
Endif
LibFree>imglib
***** and ***************
VBSTART
Sub OpenPage(URL,Wait)
Dim IE
Set IE = CreateObject("InternetExplorer.Application")
IE.visible = 1
IE.navigate URL
do while IE.Busy and Wait
loop
End Sub
VBEND
//Go to the flash password example at Webwasp.co.uk
VBRun>OpenPage,http://www.webwasp.co.uk/flash-sample-m ... ndex.php,1
WaitReady>0
SetFocus>Flash Tutorial: - webwasp.co.uk*
//Maximise IE
GetActiveWindow>title,X,Y
WindowAction>1,title
//Normally we can't automate clicking on flash buttons because they are only images.
//Now we can use FindImgPos to locate the flash button ...
//I have used Capture.exe to extract the password edit box and the edit button to bitmaps:
Let>editbox=d:\passwordedit.bmp
Let>enterbutton=d:\enterbutton.bmp
//Load the library
Let>imglibDLL=%SCRIPT_DIR%\imglib.dll
LibLoad>imglibDll,imglib
//get screen res and capture full screen
LibFunc>imglib,GetScreenRes,screen,ref:0,ref:0
IfFileExists>d:\screen.bmp
DeleteFile>d:\screen.bmp
Endif
Wait>1
ScreenCapture>0,0,screen_1,screen_2,d:\screen.bmp
//Find the password box on the screen
LibFunc>imglib,FindImgPos,imgs,editbox,d:\screen.bmp,20,1,ref:0,ref:0
If>imgs>0
//Click in box
MouseMove>imgs_5,imgs_6
LClick
//Enter a password
Send>private
Endif
//Find the password box on the screen
LibFunc>imglib,FindImgPos,imgs,enterbutton,d:\screen.bmp,20,1,ref:0,ref:0
If>imgs>0
//Click on button
MouseMove>imgs_5,imgs_6
LClick
Endif
//Free library
LibFree>imglib
I have version 8.0.3e
Let>imglibDLL=%SCRIPT_DIR%\imglib.dll
LibLoad>imglibDll,imglib
//Focus Google
SetFocus>Google - Microsoft Internet Explorer
Wait>1
//Get bounds of window
GetActiveWindow>title,X,Y,W,H
//Capture the screen to a bitmap
IfFileExists>d:\screen.bmp
DeleteFile>d:\screen.bmp
EndIf
ScreenCapture>X,Y,W,H,d:\screen.bmp
LibFunc>imglib,FindImgPos,imgs,d:\googlebutton.bmp,d:\screen.bmp,20,1,ref:0,ref:0
If>imgs>0
MessageModal>%X% %Y% %W% %H%
//click on button
//remember that x,y returned is relative the image and since we didn't use the
//full screen we will need add top left offset to get screen coordinates
MessageModal>%imgs_5% %imgs_6%
Let>x=imgs_5+x
Let>y=imgs_6+y
MouseMove>x,y
LClick
Endif
LibFree>imglib
***** and ***************
VBSTART
Sub OpenPage(URL,Wait)
Dim IE
Set IE = CreateObject("InternetExplorer.Application")
IE.visible = 1
IE.navigate URL
do while IE.Busy and Wait
loop
End Sub
VBEND
//Go to the flash password example at Webwasp.co.uk
VBRun>OpenPage,http://www.webwasp.co.uk/flash-sample-m ... ndex.php,1
WaitReady>0
SetFocus>Flash Tutorial: - webwasp.co.uk*
//Maximise IE
GetActiveWindow>title,X,Y
WindowAction>1,title
//Normally we can't automate clicking on flash buttons because they are only images.
//Now we can use FindImgPos to locate the flash button ...
//I have used Capture.exe to extract the password edit box and the edit button to bitmaps:
Let>editbox=d:\passwordedit.bmp
Let>enterbutton=d:\enterbutton.bmp
//Load the library
Let>imglibDLL=%SCRIPT_DIR%\imglib.dll
LibLoad>imglibDll,imglib
//get screen res and capture full screen
LibFunc>imglib,GetScreenRes,screen,ref:0,ref:0
IfFileExists>d:\screen.bmp
DeleteFile>d:\screen.bmp
Endif
Wait>1
ScreenCapture>0,0,screen_1,screen_2,d:\screen.bmp
//Find the password box on the screen
LibFunc>imglib,FindImgPos,imgs,editbox,d:\screen.bmp,20,1,ref:0,ref:0
If>imgs>0
//Click in box
MouseMove>imgs_5,imgs_6
LClick
//Enter a password
Send>private
Endif
//Find the password box on the screen
LibFunc>imglib,FindImgPos,imgs,enterbutton,d:\screen.bmp,20,1,ref:0,ref:0
If>imgs>0
//Click on button
MouseMove>imgs_5,imgs_6
LClick
Endif
//Free library
LibFree>imglib
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
I'll look at it more later but the first thing I see is:
ScreenCapture>X,Y,W,H,d:\screen.bmp
Screen Capture doesn't use Width and Height it needs coordinates for the four corners of the capture area, so you have to calculate X and Y for the lower right corner and then:
ScreenCapture>X1,Y1,X2,Y2,Filename
ScreenCapture>X,Y,W,H,d:\screen.bmp
Screen Capture doesn't use Width and Height it needs coordinates for the four corners of the capture area, so you have to calculate X and Y for the lower right corner and then:
ScreenCapture>X1,Y1,X2,Y2,Filename
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Do these image files exist:
d:\passwordedit.bmp
d:\enterbutton.bmp
Did you make sure imglib.dll is in the same directory as your script?
When you step through the script line by line with the debugger what is the value for imglib?
d:\passwordedit.bmp
d:\enterbutton.bmp
Did you make sure imglib.dll is in the same directory as your script?
When you step through the script line by line with the debugger what is the value for imglib?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Put DLL in folder of script, Works!
Hello,
Put recommended DLL in same folder as script and it worked. Thanks.
Now, suggestions how to speed up the process. Reduce the capture screen area?
Thanks & cheers,
Put recommended DLL in same folder as script and it worked. Thanks.
Now, suggestions how to speed up the process. Reduce the capture screen area?
Thanks & cheers,