How to get click event value

Asked by Muthumanikandan on 2017-07-28

How to get click event value and how to pass that value in DB:

My scenario is when i click execute button in windows GUI i will get one popup(Ex: REC05)
Once i clicked ok button i will exit my application , then i will login into Sql developer and update column values as 'REC05'
TO automate this process give me the code to get value from click event and pass that value to DB.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
Muthumanikandan
Solved:
2017-08-01
Last query:
2017-08-01
Last reply:
2017-07-28
masuo (masuo-ohara) said : #1

Do you mean that you want to get strings from popup of your application?

Muthumanikandan (nmuthu1) said : #2

Yes you right mauso, i want to get strings from popup of my application and i need to pass that value into Sql developer

Manfred Hampl (m-hampl) said : #3

See the documentation http://sikulix-2014.readthedocs.io/en/latest/interaction.html#input for getting a string from the popup window.

You probably need something like

newvalue = input("Please enter the new value:")

and then construct a SQL-statement that uses the value in variable newvalue using string concatenation, something like

sqlstatement = "UPDATE tablename WHERE searchkey = keyvalue SET columnname="+newvalue

(details depending on the syntax rules that have to be followed for your update statement)

Muthumanikandan (nmuthu1) said : #4

My script:

newvalue = input("Enter Dock no :")
wait(1)
text_file = open("Output.sql", "w")
text_file.write("UPDATE terminal SET te_ar = '")
text_file.write(newvalue)
text_file.write("' WHERE te_ip = (SELECT SYS_CONTEXT('USERENV','IP_ADDRESS') as ip_address FROM dual);")
text_file.write("\ncommit;")
text_file.close()

batch_file=open("Script.bat","w")
batch_file.write("set NetPath=%~dp0")
batch_file.write("\n@echo off")
batch_file.write("\nsqlplus -L GPCPRD/ZEROGPC@DB10:1521/ORCL.CORP.SIERRATEC.COM @%NetPath%/Output.sql")
batch_file.write("\nexit")
batch_file.close()

openApp("Script.bat")
wait(4)

i tried own with the idea of your comment #3, got worked .Problem solved Thanks alot:)