how to run a external program and pass parameters

Asked by Zzz on 2010-02-01

I'd like to run a external program and pass parameters
ex: notepad readme.txt

but openApp only accept program and can not pass parameters.

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2010-02-01
Last reply:
2010-02-03
Sergey Darovskih (darovskih) said : #1
Zzz (dyiqfkdckwtg) said : #2

I'd like to find an image
run an program and pass the x, y of image;

so I can not use the batch file.

Sergey Darovskih (darovskih) said : #3

OK, then you can use something like this:

For example, if I need to open a picture using Paint.

openApp("cmd")
sleep(1)
type("c:\\2.bat c:\\_mg_5790.jpg\n")

and the bat file is:

i:\windows\system32\mspaint %1

if you need to use two parameters in bat file, write <myprogram> %1 %2.

and don't forget to close "cmd" window after all.

Is this is what you need?

Zzz (dyiqfkdckwtg) said : #4

Thanks,

but I need to do it in a loop,

open cmd window and sleep(1) will take a lots of time.

Sergey Darovskih (darovskih) said : #5

Then, it's better to ask guys to add parameter support in "openApp" :)

Sergey Darovskih (darovskih) said : #6

It seems that the always have: use

cmdexec("notepad c:\\1.txt")

it works! Hope this will help you.

Can you help with this problem?

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

To post a message you must log in.