← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #215343]: setting image file path

 

Question #215343 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/215343

    Status: Open => Answered

RaiMan proposed the following answer:
--- at 1 and 2:

the basics:

import os
import shutil

imgDir = "some absolute path"

name = str(int(1000*time.time())) # unique name based on milli seconds
ret = input("name of next image", name) # define a name yourself 
if not ret: exit()

img = capture("please select image " + ret) # capture the image
shutil.move(img, os.path.join(imgDir, ret + ".png")) # move the image to final destination

--- at 3: 
input fields are usually positioned by searching something nearby, that does not change, and then use targetOffset as the click point to click the field

click(Pattern("something nearby.png").targetOffset(x,y))

this Pattern can be constructed in the IDE using the Preview feature.

The further steps depend on how the field reacts on clicks (e.g. all is
already selected or the cursor is just positioned at the click point).
In some cases a doubleClick() does the job to select the field content.

The rest is usage of type() to simulate the manual actions.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.