Jump to content

set directory from a reg entry


KPrior
 Share

Recommended Posts

I am fairly new to AutoIT and would like to know how can I read a reg entry (string) then take that result to set this as a directory to copy a file to or open and read a file? Here is an excerpt of what I have so far:

$var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment", "CurrentVersion")

MsgBox(4096, "Current JRE is:", $var)

If $var = "1.5" Then

MsgBox(4096,"JRE Detected", "JRE 1.5 is detected!")

$var1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.5", "JavaHome")

MsgBox(4096, "Java Home is:", $var1)

; Need to take this $var1 and set as directory for steps below

; i.e C:\Program Files\Java\jre1.5.0_06

EndIf

;FileCopy ($SSO\Jaccess.jar, $var1\lib\ext)

;FileCopy ($SSO\Javasso.jar, $var1\lib\ext)

;$file1 = FileOpen("$var1\lib\Awt.Properties", 1)

;$file2 = FileOpen("$var1\lib\accessibility.Properties", 1)

; Check if file opened for reading OK

If $file1 = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

Else

MsgBox(0, "Error", "Able to open file.")

FileWriteLine($file1, "AWT.EventQueueClass=com.sun.java.accessibility.util.EventQueueMonitor")

FileWriteLine($file1, "sAWT.assistive_technologies=com.protocom.sso.javasso.JavaSSOHook" & @CRLF)

Exit

EndIf

FileClose($file1)

If $file2 = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

Else

MsgBox(0, "Error", "Able to open file.")

FileWriteLine($file2, "lineassistive_technologies=com.protocom.sso.javasso.JavaSSOHook")

Exit

EndIf

FileClose($file2)

Link to comment
Share on other sites

You're close... :whistle:

$file1 = FileOpen($var1 & "\lib\Awt.Properties", 1)

Thanks! I have working now and figured out how to copy file as well as write to the files. Thanks again!

-------------------------------------------------------------------------------

$SSO = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\SLPROTO.EXE", "Path")

MsgBox(4096, "SSO Path is:", $SSO)

$var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment", "CurrentVersion")

MsgBox(4096, "Current JRE is:", $var)

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

; Block user input during installation

;BlockInput(1)

If $var = "" Then

;BlockInput(0)

MsgBox(4096,"Install Error", "JRE was not detected.")

Exit

;Else

;MsgBox(4096,"Debug Info", "ActivClient should be installed and install will continue!")

;Call ("SCPL")

EndIf

If $var = "1.5" Then

MsgBox(4096,"JRE Detected", "JRE 1.5 is detected!")

$var1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.5", "JavaHome")

MsgBox(4096, "Java Home is:", $var1)

EndIf

$file1 = FileCopy($SSO & "\Jaccess.jar", $var1 & "\lib\ext")

$file2 = FileCopy($SSO & "\Javasso.jar", $var1 & "\lib\ext")

$file3 = FileOpen($var1 & "\lib\Awt.Properties", 1)

$file4 = FileOpen($var1 & "\lib\accessibility.Properties", 1)

; Check if file opened for reading OK

If $file3 = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

Else

MsgBox(0, "Error", "Able to open file.")

FileWriteLine($file3, "AWT.EventQueueClass=com.sun.java.accessibility.util.EventQueueMonitor")

FileWriteLine($file3, "sAWT.assistive_technologies=com.protocom.sso.javasso.JavaSSOHook" & @CRLF)

EndIf

FileClose($file3)

If $file4 = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

Else

MsgBox(0, "Error", "Able to open file.")

FileWriteLine($file4, "lineassistive_technologies=com.protocom.sso.javasso.JavaSSOHook")

EndIf

FileClose($file4)

-------------------------------------------------------------------------------

Edited by KPrior
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...