I have a script that uses several image recognition lines. I want to copy the script to use in a different application. If I Save AS, the script copies to the new name but the image folder does not copy and the script does not work. If I copy the images from one folder to another, the script does not work.
Basically, I need two scripts on the same machine with the same images. Once this is done, I will modify the second script to fit the new application.
How do I copy a Script with image recognition
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: How do I copy a Script with image recognition
The bitmap files are stored in a folder which has the same name as the script.
So after copying the script, copy the folder and rename the copied folder to the same name as the script.
So after copying the script, copy the folder and rename the copied folder to the same name as the script.
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?
Re: How do I copy a Script with image recognition
Marcus,
I tried that also. I copied and renamed the folder. I opened the folder and verified the presence of the images.
The script does not run. When I edit the script and open the image folder, it shows blank.
I reopened in explorer and the images are there but Macro Scheduler doesn't see them.
I have done this before in Windows 7 successfully but it doesn't seem to work in Windows 10.
It's a real puzzler.
I tried that also. I copied and renamed the folder. I opened the folder and verified the presence of the images.
The script does not run. When I edit the script and open the image folder, it shows blank.
I reopened in explorer and the images are there but Macro Scheduler doesn't see them.
I have done this before in Windows 7 successfully but it doesn't seem to work in Windows 10.
It's a real puzzler.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: How do I copy a Script with image recognition
I guess I need to see what you are seeing but a filename/path MUST be wrong somewhere.
Are you definitely referring to the images via BMP_DIR as the wizard creates it?
If so is there a subfolder with the exact same name as the script.
The location of this image folder will be one of the following depending on two different scenarios:
* If this script is being edited/run standalone outside of Macro Scheduler then this same name image folder should be at the same level as the script
OR
* If you are using this script inside Macro Scheduler (you see it listed within Macro Scheduler) then this same name image folder should be in the group folder for this macro (right click on the Group it is in and select Properties to see the folder path and double check it - it might not be what you think it is).
Are you definitely referring to the images via BMP_DIR as the wizard creates it?
If so is there a subfolder with the exact same name as the script.
The location of this image folder will be one of the following depending on two different scenarios:
* If this script is being edited/run standalone outside of Macro Scheduler then this same name image folder should be at the same level as the script
OR
* If you are using this script inside Macro Scheduler (you see it listed within Macro Scheduler) then this same name image folder should be in the group folder for this macro (right click on the Group it is in and select Properties to see the folder path and double check it - it might not be what you think it is).
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?
Re: How do I copy a Script with image recognition
Are you definitely referring to the images via BMP_DIR as the wizard creates it? YES
If so is there a subfolder with the exact same name as the script. YES
Attached is a screenshot that will show you what I see.
UPS2 is the original script and works fine.
UPS1 is the copy.
The folder UPS1 is a copy of folder UPS2 and contains all the bmp images found in UPS2.
I am using the script inside Macro Scheduler and the Group Properties shows the same folder path as shown in the directory screenshot. I've even searched my computer for other copies of the UPS scripts and folders just to make sure and none were found.
I thought the filename/path was wrong also but I can't find any evidence.
Hope you have another idea.
If so is there a subfolder with the exact same name as the script. YES
Attached is a screenshot that will show you what I see.
UPS2 is the original script and works fine.
UPS1 is the copy.
The folder UPS1 is a copy of folder UPS2 and contains all the bmp images found in UPS2.
I am using the script inside Macro Scheduler and the Group Properties shows the same folder path as shown in the directory screenshot. I've even searched my computer for other copies of the UPS scripts and folders just to make sure and none were found.
I thought the filename/path was wrong also but I can't find any evidence.
Hope you have another idea.
Re: How do I copy a Script with image recognition
I finally found a solution that doesn't require me to rewrite the entire script.
I changed the line from:
FindImagePos>%BMP_DIR%\image_4.bmp,WINDOW:Active Window,0.5,1,XArr,YArr,NumFound,CCOEFF
TO:
FindImagePos>C:\Users\david\Documents\Macro Scheduler 14\USP1\image_4.bmp,WINDOW:Active Window,0.5,1,XArr,YArr,NumFound,CCOEFF
I can make this edit throughout the script as needed and everything works!
I changed the line from:
FindImagePos>%BMP_DIR%\image_4.bmp,WINDOW:Active Window,0.5,1,XArr,YArr,NumFound,CCOEFF
TO:
FindImagePos>C:\Users\david\Documents\Macro Scheduler 14\USP1\image_4.bmp,WINDOW:Active Window,0.5,1,XArr,YArr,NumFound,CCOEFF
I can make this edit throughout the script as needed and everything works!