← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #268418]: MAC Shell command

 

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

    Status: Answered => Open

Jeff_Vallis is still having a problem:
> to run a script file created from scratch,  just create a file wherever
> you want with the shebang in the first line and then the lines you need
> to be processed.

Sorry what do you mean by shebang in the first line
and
Dont think I will need it for Cropping then - not in a rush so I can wait for 1.1.0 to be released - think I saw it was planned for August sometime.
but usefull to understand how to use the run() command

LOL :-
Google :-
shebang
ʃɪˈbaŋ/
noun
1.
informal
a matter, operation, or set of circumstances.
"the Mafia boss who's running the whole shebang"
2.
NORTH AMERICANarchaic
a rough hut or shelter.


> On 22 Jun 2015, at 14:26:28, RaiMan <question268418@xxxxxxxxxxxxxxxxxxxxx> wrote:
> 
> Your question #268418 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/268418
> 
>    Status: Open => Answered
> 
> RaiMan proposed the following answer:
> with versions <1.1.0 you have to use os.popen() or the features of the
> subprocess module.
> 
> with version 1.1.0, you can do this:
> 
> result = run("env")
> 
> getting result as a multi line string like this:
> 0
> SHELL=/bin/bash
> LC_CTYPE=UTF-8
> DYLD_LIBRARY_PATH=/Applications/NetBeans/NetBeans 7.4.app/Contents/Resources/NetBeans/webcommon/bin:
> TMPDIR=/var/folders/72/r0r_pc952b97blkfdk5yh0hr0000gn/T/
> JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home
> SHLVL=1
> …. more
> 
> the first line is the return code, the rest is the stuff going to stdout
> and lines after a line *****error***** the stuff that goes to stderr.
> 
> to run a script file created from scratch,  just create a file wherever
> you want with the shebang in the first line and then the lines you need
> to be processed.
> 
> then issue 
> result = run("<the-path-to-your-commandfile>  option1 option2")
> 
> --- crop an image
> … also can be done with version 1.1.0 (not documented yet ;-)
> 
> img = Image.create("someFile.png")
> imgCropped = img.getSub(x, y, w, h) # still in memory 
> imgCroppedFile = imgCropped.asFile() # a file in temp
> 
> … and this is possible:
> find(imgCropped) # just use the in memory image
> 
> -- 
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/sikuli/+question/268418/+confirm?answer_id=0
> 
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/sikuli/+question/268418
> 
> You received this question notification because you asked the question.

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