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

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
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.

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


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.