Images lost in script

Asked by Ben

Hello everyone,

I have the latest version of sikuli, I accidentally lost my images that were saved in a folder, I managed to recover all the images. However, I opened my project again and rather than the images being shown as "click(*image here*), i now get a long line such as "click(Pattern("1443553021333.png").exact())." As i have all my images in the correct folder again is there anyway I can get sikuli to reccognise this and so it returns to normal, otherwise I will have to capture all the images again and offset them etc which will take a very long time. Also, how do i prevent this happening in the future?

Thank you very much

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

  • by Ben
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Supposing "latest version" means latest nightly build of 1.1.0.

--- I accidentally lost my images
Any idea when and how that happened?

--- I managed to recover all the images
How did you do that?

Are you using a normal script folder .sikuli, that contains a .py file and all the images?

--- and so it returns to normal
I have no idea, how the Pattern("1443553021333.png").exact() was created by your "recovery". This is usually created, when clicking on an image in the IDE and push the similarity to 0.99.
Nevertheless, the image thumbnails should be shown in the IDE.
If .exact() is not suitable for an image, then either use Preview to reset it to 0.7, or edit the .py file in an external editor and use find/replace changing
Pattern("1443553021333.png").exact()
to
Pattern("1443553021333.png")

or even in 2 steps
to
"1443553021333.png"

Revision history for this message
Ben (benpersonal97) said :
#2

So I lost all my images when trying to tidy up folders as I wasn't sure where it had saved too. Having accidentally deleted the folder containing images and py, then closing the program I lost it all. When I opened the sikuli program it was as if it had remembered where I left off, but was unable to load the images due to the fact they were no longer present in the folder. I used a recovery prgram and got most images back in the folder with the same file name but this isn't being recognised by ide. I am now using a normal folder that contains a py file and the images, about 7 images have recovered correctly but only 2 of these are loading in the script. I think the pattern(".........").eacr() was created from before where I set the image named 144355 ...... To exact similarity but the photo was replaced with file name as it couldn't locate the photo. Will resetting it to 0.7 allow the ide to load the images from the file again?

Thank you for the fast response

Revision history for this message
RaiMan (raimund-hocke) said :
#4

1. take care, that all the images are in a separate backup folder.

2. make a folder myscript.sikuli containing your script file named myscript.py (you may choose what you want as myscript, but .sikuli and .py must have the same name.

3. now COPY the images from the backup folder to the myscript.sikuli folder

4. open the script in the IDE

5. images shown with their filename and not with their thumbnail where not found in the folder. make your decision, how to deal with it.

6. repair what is needed with each image using Preview (rename, similarity, target offset)

7. save the script and you are back.

Be aware: all images (files .png) that are not referenced in the script with their filename (even in comments) are deleted at time of script save from the .sikuli folder (this is why a backup folder in your case makes sense until back again). Image filenames starting with a _ (underscore) are never deleted.

You might switch between thumbnail and plain text view using ctrl-T (menu view).

Revision history for this message
Ben (benpersonal97) said :
#5

thank you very much!!!

Revision history for this message
Wang Li (li7-wang) said :
#6

RaiMan, i was worried by the same issue , could you please tell me how to find the back up folder?

Revision history for this message
RaiMan (raimund-hocke) said :
#7

@Wang Li
there is no backup folder, if you did not do any backups before by yourself.
SikuliX does not do any backups.

Revision history for this message
Wang Li (li7-wang) said :
#8

THX for your quick responce and i back up it by myself now .

Can you help with this problem?

Provide an answer of your own, or ask Ben for more information if necessary.

To post a message you must log in.