Image Recognition Library
Moderators: Dorian (MJT support), JRL
Image Recognition Library
Hello,
I am trying to program a macro and I can't succeed in doing that in spite of the fact that I have read all the help file.
I have the newest version of macro scheduler- 8.1
I have downloaded the Image Recognition Library files and put it in the directory where the software is installed. I want to "Find occurrences of needle bitmap in haystack bitmap" like the help file says in FindImgPos category. When I try copy the code I get a message "Invalid Numeric Value for MouseMove command."
What should I do? Can anyone detail me more about the form of writing this script?
Thank you.
I am trying to program a macro and I can't succeed in doing that in spite of the fact that I have read all the help file.
I have the newest version of macro scheduler- 8.1
I have downloaded the Image Recognition Library files and put it in the directory where the software is installed. I want to "Find occurrences of needle bitmap in haystack bitmap" like the help file says in FindImgPos category. When I try copy the code I get a message "Invalid Numeric Value for MouseMove command."
What should I do? Can anyone detail me more about the form of writing this script?
Thank you.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
One cause could be trailing spaces.
Make sure that you have removed any trailing spaces that are not really necessary.
But that is just a possibility. May not be the problem. If that does not work, please provide a copy of the script you have written.
Make sure that you have removed any trailing spaces that are not really necessary.
But that is just a possibility. May not be the problem. If that does not work, please provide a copy of the script you have written.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
I clicked on edit-->remove trailing spaces and it still doesn't work.Bob Hansen wrote:One cause could be trailing spaces.
Make sure that you have removed any trailing spaces that are not really necessary.
But that is just a possibility. May not be the problem. If that does not work, please provide a copy of the script you have written.
Here is my code:
Code: Select all
Let>imglibDLL=%SCRIPT_DIR%\imglib.dll
LibLoad>imglibDll,imglib
IfFileExists>d:\screen.bmp
DeleteFile>d:\screen.bmp
EndIf
ScreenCapture>0,0,1024,768,d:\screen.bmp
LibFunc>imglib,FindImgPos,imgs,d:\s.bmp,d:\screen.bmp,20,1,ref:0,ref:0
If>imgs>0
Let>x=imgs_5+x
Let>y=imgs_6+y
MouseMove>x,y
LClick
Endif
Thanks.
In your posted code you have not previously defined any value for "x" or "y". Therefore when you try to Let>x=imgs_5+x you are setting the value of "x" to the text "imgs_5+x". Same with "y". This would cause an error like "Invalid Numeric Value for MouseMove command."Let>x=imgs_5+x
Let>y=imgs_6+y
MouseMove>x,y
Hope this helps,
Dick
Would you please log the file, run it, then post the log file?
If you loaded Image Library in it's default location, then there is the possibility that the imglib.dll is not in %SCRIPT_DIR% and so the dll is not loading at all.
you should always include code to "look before you leap"....here is an example.
If you loaded Image Library in it's default location, then there is the possibility that the imglib.dll is not in %SCRIPT_DIR% and so the dll is not loading at all.
you should always include code to "look before you leap"....here is an example.
Code: Select all
iffileexists>=%SCRIPT_DIR%\imglib.dll
Let>imglibDLL=%SCRIPT_DIR%\imglib.dll
LibLoad>imglibDll,imglib
else>
mdl>the imglib.dll does not exist in this folder
goto>End
endif>
IfFileExists>d:\screen.bmp
DeleteFile>d:\screen.bmp
EndIf
ScreenCapture>0,0,1024,768,d:\screen.bmp
ife>d:\s.bmp
LibFunc>imglib,FindImgPos,imgs,d:\s.bmp,d:\screen.bmp,20,1,ref:0,ref:0
If>imgs>0
Let>x=imgs_5+x
Let>y=imgs_6+y
MouseMove>x,y
LClick
Endif
else>
mdl>the file s.bmp not found
endif>
Label>End
..
Thank you two for yor help.
I removed and installed macro scheduler again and then installed again the image library in the same folder of the macro scheduler.
I don't know how to create a log file but when I run your script I get the message "the imglib.dll does not exist in this folder" (it is the message that you wrote in the code and not a message of the software).
I removed and installed macro scheduler again and then installed again the image library in the same folder of the macro scheduler.
I don't know how to create a log file but when I run your script I get the message "the imglib.dll does not exist in this folder" (it is the message that you wrote in the code and not a message of the software).
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
You create a log file by using the options in the Macro Properties.
Right click the macro name and left click Macro Properties.There is a tab there to enable logging. Enable logging.
I usually use the log level "Log entry BEFORE running step" It also helps to have your script variables surrounded with % symbols so the log will record the value of the variable at the time it was run.
You can also single step through the script or add a Message Box to see the value of %SCRIPT_DIR% and make sure that is where your file is located.
Right click the macro name and left click Macro Properties.There is a tab there to enable logging. Enable logging.
I usually use the log level "Log entry BEFORE running step" It also helps to have your script variables surrounded with % symbols so the log will record the value of the variable at the time it was run.
You can also single step through the script or add a Message Box to see the value of %SCRIPT_DIR% and make sure that is where your file is located.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Thanks
Thank you for explaining me.
Here is the log file for SkunkWorks's code:
Here is the log file for SkunkWorks's code:
Code: Select all
04/11/2006 19:44:39:851 - Started Macro : dsdf
04/11/2006 19:44:39:851 - iffileexists>=C:\Documents and Settings\Administrator\Application Data\Macro Scheduler\imglib.dll
04/11/2006 19:44:39:851 - mdl>the imglib.dll does not exist in this folder
04/11/2006 19:44:41:460 - goto>End
04/11/2006 19:44:41:460 - Finished Macro : dsdf
Your log file CLEARLY shows that the imglib.dll does not exist in the directory. do a quick search of your system and tell us where you find imglib.dll
when you find it, move it to your %SCRIPT_DIR% ...which is probably c:\program files\mjt net ltd\Macro Scheduler
Then run the script again and post your log file.
when you find it, move it to your %SCRIPT_DIR% ...which is probably c:\program files\mjt net ltd\Macro Scheduler
Then run the script again and post your log file.
..
I have ran a full system scan and I found the file imglib.dll just once.
It is located in the folder D:\Program Files\MJT Net Ltd 8.1\Macro Scheduler.
I have two versions of Macro Scheduler- 7.2 and 8.1.
I usually use 7.2 but because it doesn't have the option of image recognition I was this time the 8.1 version. I changed the name of the folder from "MJT Net Ltd" to "MJT Net Ltd 8.1".
It is located in the folder D:\Program Files\MJT Net Ltd 8.1\Macro Scheduler.
I have two versions of Macro Scheduler- 7.2 and 8.1.
I usually use 7.2 but because it doesn't have the option of image recognition I was this time the 8.1 version. I changed the name of the folder from "MJT Net Ltd" to "MJT Net Ltd 8.1".
Thank you
I realize now and I changed the %SCRIPT DIR% to the folder, as you said.
Now I have anither problem, that might be rekated to what JRL has said.
I get the message: "Invalid Numeric Value for MouseMove command.".
Here is my new code:
Here is the log file:
Now I have anither problem, that might be rekated to what JRL has said.
I get the message: "Invalid Numeric Value for MouseMove command.".
Here is my new code:
Code: Select all
iffileexists>D:\Program Files\MJT Net Ltd 8.1\Macro Scheduler\imglib.dll
Let>imglibDLL=D:\Program Files\MJT Net Ltd 8.1\Macro Scheduler\imglib.dll\imglib.dll
LibLoad>imglibDll,imglib
else>
mdl>the imglib.dll does not exist in this folder
goto>End
endif>
IfFileExists>d:\screen.bmp
DeleteFile>d:\screen.bmp
EndIf
ScreenCapture>0,0,1024,768,d:\screen.bmp
ife>d:\s.bmp
LibFunc>imglib,FindImgPos,imgs,d:\s.bmp,d:\screen.bmp,20,1,ref:0,ref:0
If>imgs>0
Let>x=imgs_5+x
Let>y=imgs_6+y
MouseMove>x,y
LClick
Endif
else>
mdl>the file s.bmp not found
endif>
Label>End
Here is the log file:
Code: Select all
05/11/2006 19:18:15:156 - Started Macro : dsdf
05/11/2006 19:18:15:156 - iffileexists>D:\Program Files\MJT Net Ltd 8.1\Macro Scheduler\imglib.dll
05/11/2006 19:18:15:156 - Let>imglibDLL=D:\Program Files\MJT Net Ltd 8.1\Macro Scheduler\imglib.dll\imglib.dll
05/11/2006 19:18:15:156 - LibLoad>imglibDll,imglib
05/11/2006 19:18:15:156 - else>
05/11/2006 19:18:15:156 -
05/11/2006 19:18:15:156 - IfFileExists>d:\screen.bmp
05/11/2006 19:18:15:156 - DeleteFile>d:\screen.bmp
05/11/2006 19:18:15:156 - EndIf
05/11/2006 19:18:15:171 - ScreenCapture>0,0,1024,768,d:\screen.bmp
05/11/2006 19:18:15:281 - ife>d:\s.bmp
05/11/2006 19:18:15:281 -
05/11/2006 19:18:15:281 - LibFunc>imglib,FindImgPos,imgs,d:\s.bmp,d:\screen.bmp,20,1,ref:0,ref:0
05/11/2006 19:18:15:296 - If>imgs>0
05/11/2006 19:18:15:296 - Let>x=imgs_5+x
05/11/2006 19:18:15:296 - Let>y=imgs_6+y
05/11/2006 19:18:15:296 - MouseMove>x,y
05/11/2006 19:18:16:859 - LClick
05/11/2006 19:18:16:953 - Endif
05/11/2006 19:18:16:953 - else>
05/11/2006 19:18:16:953 -
05/11/2006 19:18:16:953 - Label>End
05/11/2006 19:18:16:968 - Finished Macro : dsdf
I see where I made a mistake in the code sample.
Please note that imglib.dll should only be written ONCE in the path to the file.
this:
Let>imglibDLL=D:\Program Files\MJT Net Ltd 8.1\Macro Scheduler\imglib.dll\imglib.dll
should be:
Let>imglibDLL=D:\Program Files\MJT Net Ltd 8.1\Macro Scheduler\imglib.dll
That is probably causing the error. The DLL just wasn't loading
Please note that imglib.dll should only be written ONCE in the path to the file.
this:
Let>imglibDLL=D:\Program Files\MJT Net Ltd 8.1\Macro Scheduler\imglib.dll\imglib.dll
should be:
Let>imglibDLL=D:\Program Files\MJT Net Ltd 8.1\Macro Scheduler\imglib.dll
That is probably causing the error. The DLL just wasn't loading
I have done that
Now here is ny code:
But I still have the same problem, the message: ""Invalid Numeric Value for MouseMove command.".
I see now a difference by the time the code takes to get the message. Before erasing the second imglib.dll it took the code less time to give the message than after I have changed it.
Here is the log file:
Code: Select all
iffileexists>D:\Program Files\MJT Net Ltd 8.1\Macro Scheduler\imglib.dll
Let>imglibDLL=D:\Program Files\MJT Net Ltd 8.1\Macro Scheduler\imglib.dll
LibLoad>imglibDll,imglib
else>
mdl>the imglib.dll does not exist in this folder
goto>End
endif>
IfFileExists>d:\screen.bmp
DeleteFile>d:\screen.bmp
EndIf
ScreenCapture>0,0,1024,768,d:\screen.bmp
ife>d:\s.bmp
LibFunc>imglib,FindImgPos,imgs,d:\s.bmp,d:\screen.bmp,20,1,ref:0,ref:0
If>imgs>0
Let>x=imgs_5+x
Let>y=imgs_6+y
MouseMove>x,y
LClick
Endif
else>
mdl>the file s.bmp not found
endif>
Label>End
I see now a difference by the time the code takes to get the message. Before erasing the second imglib.dll it took the code less time to give the message than after I have changed it.
Here is the log file:
Code: Select all
05/11/2006 22:49:55:531 - Started Macro : dsdf
05/11/2006 22:49:55:531 - iffileexists>D:\Program Files\MJT Net Ltd 8.1\Macro Scheduler\imglib.dll
05/11/2006 22:49:55:531 - Let>imglibDLL=D:\Program Files\MJT Net Ltd 8.1\Macro Scheduler\imglib.dll
05/11/2006 22:49:55:531 - LibLoad>imglibDll,imglib
05/11/2006 22:49:55:531 - else>
05/11/2006 22:49:55:531 -
05/11/2006 22:49:55:531 - IfFileExists>d:\screen.bmp
05/11/2006 22:49:55:531 - DeleteFile>d:\screen.bmp
05/11/2006 22:49:55:531 - EndIf
05/11/2006 22:49:55:531 - ScreenCapture>0,0,1024,768,d:\screen.bmp
05/11/2006 22:49:55:656 - ife>d:\s.bmp
05/11/2006 22:49:55:671 -
05/11/2006 22:49:55:671 - LibFunc>imglib,FindImgPos,imgs,d:\s.bmp,d:\screen.bmp,20,1,ref:0,ref:0
05/11/2006 22:49:56:906 - If>imgs>0
05/11/2006 22:49:56:906 - Let>x=imgs_5+x
05/11/2006 22:49:56:906 - Let>y=imgs_6+y
05/11/2006 22:49:56:906 - MouseMove>x,y
05/11/2006 22:49:59:656 - LClick
05/11/2006 22:49:59:656 - Endif
05/11/2006 22:49:59:656 - else>
05/11/2006 22:49:59:656 -
05/11/2006 22:49:59:656 - Label>End
05/11/2006 22:49:59:656 - Finished Macro : dsdf
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact: