← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #173993]: Sikuli RC3 stopped working

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
I have made a Sikuli-IDE-portable.bat, that allows to run Sikuli from a
stick.

*** What is needed:
- a directory on the stick with the contents of the folder contained in the zipped bundle (alternatively you might copy the "Sikuli X" directory of a Sikuli installation to the stick)
- put Sikuli-IDE-portable.bat in this directory too
- the machine, where you are using the stick, must have a valid Java (JRE) installation (you might use a portable Java package - but then you have to modify the Sikuli-IDE-portable.bat)

*** Sikuli-IDE-portable.bat - what it does
- it checks the java installation and sets the system path as needed (exits if no standard java found)
- it creates a temp directory on the stick for Sikuli
- it restores the registry branch where Sikuli stores it's preferences (if a reg file exists on the stick)
- you may decide to save the preferences to a reg file after terminating Sikuli
- and finally Sikuli-IDE is started from the stick

---TakeCare:  Sikuli-IDE-portable.bat  runs even if on the machine
another Sikuli is already installed, but it changes the registry. Feel
free to add code, that saves an already existing registry branch and
restores it again at the end.

*** Sikuli-IDE-portable.bat - the source
@echo off

set SPATH=%~d0%~p0
echo SikuliHome %SPATH%

set JPATH=%PROGRAMFILES%\Java\jre6\bin
set JAVA_EXE=%JPATH%\java.exe
if defined PROGRAMFILES(X86) ( 
   set JPATH=%PROGRAMFILES(X86)%\Java\jre6\bin
   set JAVA_EXE=%JPATH%\java.exe
)

if not exist "%JAVA_EXE%" (
   echo Java not found at %JAVA_EXE%
   pause
   exit
) else (
   echo running java from %JAVA_EXE%
)

PATH=%SPATH%libs;%JPATH%;%PATH%

echo --------------
echo making tmpdir %SPATH%temp
rmdir /s /q "%SPATH%temp" 2>nul
mkdir "%SPATH%temp"

echo --------------
set SAVED_PREFS=%SPATH%myPreferences.reg
if exist "%SAVED_PREFS%" (
   echo restoring saved preferences %SAVED_PREFS%
   reg import "%SAVED_PREFS%" 
) else (
   echo no saved preferences found
)

echo --------------
echo after closing Sikuli, preferences will be saved to %SAVED_PREFS% 
set /p ANSWER="type y<enter> if you want to save else press <enter> only: "

set JAVA_PARM=-Xms64M -Xmx512M -Dfile.encoding=UTF-8
-Djava.io.tmpdir=%SPATH%temp

echo -------------- starting Sikuli-IDE ---------------

"%JAVA_EXE%"  %JAVA_PARM% -Dpython.path="%SPATH%sikuli-script.jar/" -jar
"%SPATH%sikuli-ide.jar" %*

echo -------------- Sikuli-IDE terminated ---------------

if "%ANSWER%"=="y" (
   echo --------------
   echo saving preferences to %SAVED_PREFS%
   reg export HKCU\Software\JavaSoft\Prefs\org\sikuli\ide "%SAVED_PREFS%" /y
)

pause

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