sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #13696
[Question #211347]: How to increment values in array
New question #211347 on Sikuli:
https://answers.launchpad.net/sikuli/+question/211347
Hi,
I am writing code, in which text file is used as :
(11,50,12)
(11,52,21)
(12,15,20)
(12,30,45)
Check the script:
def myHandler(event):
wait(2)
click("1349867277615-1.png")
type('v', KeyModifier.CTRL)
wait(2)
until = list(time.localtime())
until[3:6]=eval(arr[1]) # hour minute second # DON'T KNOW HOW TO HANDLE THE ARR IN INCREMENTAL
timeUntil = time.mktime(tuple(until))
timeToWait = int(timeUntil - time.time())
if timeToWait < 1:
timeToWait1 = (86400 + int(timeUntil - time.time()))
wait(timeToWait1)
else:
wait(timeToWait)
click("submit-2.png")
wait(8)
click("clear-1.png")
wait(2)
# Main function
setThrowException(True)
wait(2)
import array
arr=[]
f=open("D:\\DPTT_XML\\Time.txt","r")
fout = open("D:\\DPTT_XML\\Time-results.txt","w")
for line in f.readlines():
arr.append(line.strip()) # get rid of newline
f.close()
wait(2)
click("1348813496420-12.png")
wait(1)
# For clock in for Employee E3
type("D:\\DPTT_XML\\E3.txt")
wait(1)
type(Key.ENTER)
wait(1)
type('a', KeyModifier.CTRL)
type('c', KeyModifier.CTRL)
type(Key.F4, KeyModifier.ALT)
wait(1)
# Open firefox
click("1348813496420-12.png")
wait(5)
click("earthprogram-9.png")
type("firefox" + Key.ENTER)
wait(5)
type("t", KeyModifier.CTRL)
wait(5)
type("https://localhost:9043/IDS/TestIDS.jsp" + Key.ENTER)
wait("RequestXMLRe-3.png",20)
click("DSservi0ehds-1.png")
type(Key.END )
type (Key.BACKSPACE)
type("http://localhost:9080/IDS/service/ids/")
type(Key.TAB)
type('v', KeyModifier.CTRL)
wait(2)
until = list(time.localtime())
until[3:6]=eval(arr[0]) # hour minute second # HERE I AM GETTING VALUE FROM ARR [0] AS I HAVE NOT CALLED THE myhandler
timeUntil = time.mktime(tuple(until))
timeToWait = int(timeUntil - time.time())
if timeToWait < 1:
timeToWait1 = (86400 + int(timeUntil - time.time()))
wait(timeToWait1)
else:
wait(timeToWait)
click("submit-2.png")
wait(8)
click("clear-1.png")
wait(2)
# For clock in for Employee E6
click("1348813496420-12.png")
wait(1)
type("D:\\DPTT_XML\\E6.txt")
wait(1)
type(Key.ENTER)
wait(1)
type('a', KeyModifier.CTRL)
type('c', KeyModifier.CTRL)
type(Key.F4, KeyModifier.ALT)
wait(2)
onAppear("submitclear.png", myHandler) # HERE I WANT IT SHOULD TAKE VALUE FROM ARR [1]
observe(10)
wait(2)
# For clock in for Employee E5
click("1348813496420-12.png")
wait(1)
type("D:\\DPTT_XML\\E5.txt")
wait(1)
type(Key.ENTER)
wait(1)
type('a', KeyModifier.CTRL)
type('c', KeyModifier.CTRL)
type(Key.F4, KeyModifier.ALT)
wait(2)
onAppear("submitclear.png", myHandler) # HERE I WANT IT SHOULD TAKE VALUE FROM ARR [2]
observe(10)
wait(2)
# For clock in for Employee E2
click("1348813496420-12.png")
wait(1)
type("D:\\DPTT_XML\\E2.txt")
wait(1)
type(Key.ENTER)
wait(1)
type('a', KeyModifier.CTRL)
type('c', KeyModifier.CTRL)
type(Key.F4, KeyModifier.ALT)
wait(2)
onAppear("submitclear.png", myHandler) # HERE I WANT IT SHOULD TAKE VALUE FROM ARR [3]
observe(10)
wait(2)
Not able to increment the array values when handler is used.
Please help me out.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.