open desktop shortcut

Asked by Ramprasad

I have created a desktop shourtcut for internet explore. But I am not able to open using openApp. Is there any other command available to open desktop shortcut?

reason why I use desktop short cut is in a way i can force IE to always open in maximized mode.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Ramprasad
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

import os
os.popen("start /MAX -D<work-dir> <internetexplorer>")

this uses the Windows start command, that runs IE in maximized window.

the things in <> have to be adapted to your situation.

look at the start command docs for more info.

Revision history for this message
Ramprasad (ramprasad-info) said :
#2

I used below code.

import os
os.popen('start /MAX /D "c:\" iexplore')

I am getting this error

[error] Error message: Traceback (most recent call last):
File "C:\Users\v180648\AppData\Local\Temp\sikuli-tmp443888738301719096.py", line 2, in
os.popen('start /MAX /D "c:\" iexplore')
File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\os.py", line 735, in popen
File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\subprocess.py", line 755, in __init__
File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\subprocess.py", line 1240, in _execute_child
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'

When I use start /MAX /D "c:\" iexplore in command line it works fine.

Revision history for this message
Ramprasad (ramprasad-info) said :
#3

import os
os.popen("start /MAX /D "c:\" iexplore")

when I use double quotes

[error] Error message: SyntaxError: ('mismatched character \'"\' expecting \'\\n\'', ('C:\\Users\\v180648\\AppData\\Local\\Temp\\sikuli-tmp3997014338485364637.py', 2, 28, 'os.popen("start /MAX /D "c:\\" iexplore")\n'))

Revision history for this message
RaiMan (raimund-hocke) said :
#4

BTW: "" on Windows command line for prameters are only needed, if the parameter contains blanks

one of the following should do it

os.popen(r"start /MAX /D c:\ iexplore") # raw string, no need for escaping

or

os.popen("start /MAX /D c:\\ iexplore") # \ escaped

or even yours

os.popen('start /MAX /D "c:\\" iexplore')
or
os.popen(r'start /MAX /D "c:\" iexplore')

Revision history for this message
Ramprasad (ramprasad-info) said :
#5

tried all the option above..getting same error

[error] Error message: Traceback (most recent call last):
File "C:\Users\v180648\AppData\Local\Temp\sikuli-tmp443888738301719096.py", line 2, in
os.popen('start /MAX /D "c:\" iexplore')
File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\os.py", line 735, in popen
File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\subprocess.py", line 755, in __init__
File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\subprocess.py", line 1240, in _execute_child
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'

Revision history for this message
RaiMan (raimund-hocke) said :
#6

the first one (my favorite) works fine only Win7 32:

os.popen(r"start /MAX /D c:\ iexplore")

Revision history for this message
RaiMan (raimund-hocke) said :
#7

sorry typo

the first one (my favorite) works fine on my Win7 32:

Revision history for this message
Ramprasad (ramprasad-info) said :
#8

I too use win7 32 and sikuli version 1.0rc2

Revision history for this message
RaiMan (raimund-hocke) said :
#9

ok, I am using the latest version of rc3.

This might be problem of Jython 2.5.1 (rc3 uses Jython 2.5.2).

put the start command into a callme.cmd file, that can be found on system path and try:

os.popen("callme.cmd")

Revision history for this message
Ramprasad (ramprasad-info) said :
#10

I have copied the start command to one bat file put that into %SIKULI_HOME% and called it using this command below. I'll try to upgrade to rc3 or try find some other effective work around.

import subprocess
subprocess.call("openie.bat")

Revision history for this message
Ramprasad (ramprasad-info) said :
#11

I have copied the start command to one bat file put that into %SIKULI_HOME% and called it using this command below. I'll try to upgrade to rc3 or try find some other effective work around.

import subprocess
subprocess.call("openie.bat")

Revision history for this message
RaiMan (raimund-hocke) said :
#12

Worked?

Revision history for this message
Ramprasad (ramprasad-info) said :
#13

yes it worked