|
-
Jul 28th, 2000, 11:00 AM
#1
Thread Starter
New Member
Hi,
I try to retrieve the path of my java interpreter from the window registry and then concatenate this path with some other strings so as to run my java program. I always loss the second part of my string. This is my code:
' get the path from registry
Dim javaBuffer as String
javaBuffer = GetStringValue("HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\1.2", "JavaHome")
javaBuffer = Trim(javaBuffer)
tempvar = javaBuffer + "\bin\java -classpath..."
'run my java program
Shell tempvar (+ some other arguments)
I notice that tempvar does not contain "\bin\java..." at all even if I do the simple string concatenation as shown in the code above. The value obtained from the registy, though, is correct. Any ideas?
maria.
-
Jul 28th, 2000, 11:40 AM
#2
Addicted Member
use
tempvar = javaBuffer & "\bin\java -classpath.."
Instead of...
tempvar = javaBuffer + "\bin\java -classpath.."
If you can't pronounce my name, call me GURU 
-
Jul 28th, 2000, 12:10 PM
#3
Thread Starter
New Member
get a value from the registry and concatenate with other strings
Hi,
I try your suggestion but it doesn't seem to work. Any more ideas?
Also, I found something weird happening:
if I do:
Dim tempvar as String
tempvar = javaBuffer + "\bin\java" 'it doesn't concatenate
but if I do:
Dim tempvar as String
tempvar = "\bin\java..." + javaBuffer ' it does concatenate
I also try the above code using '&' instead. Same results found.
maria.
-
Jul 28th, 2000, 12:23 PM
#4
transcendental analytic
Shoud work with both + and & but you should use & to avoid numeric addition
What errors do you get? Do you get the correct definitions of both javabuffer and tempvar?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 28th, 2000, 12:29 PM
#5
Thread Starter
New Member
Hi again,
javaBuffer and tempvar are both declared as Strings and javaBuffer seems to have the right value. Please help.
I also used '&'
maria.
-
Jul 28th, 2000, 01:06 PM
#6
transcendental analytic
Hmm, this is getting hard without knowing any code, could you explain what's wrong then? or could you provide more code since what you showed, seems to work correctly
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 28th, 2000, 02:25 PM
#7
Thread Starter
New Member
hi again,
this is all of my code:
Sub SaveAsHtml()
'
' SaveAsHtml Macro
' Macro recorded 7/5/00 by mtsang
'
Dim pathBuffer As String
Dim javaBuffer As String
Randomize
Filename = "c:\temp\RBHTML_" + CStr(Math.Round(Math.Rnd * 10000000000#, 0)) + ".htm"
If Application.Name = "Microsoft Word" Then
ActiveDocument.SaveAs Filename, FileFormat:=wdFormatHTML, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
ElseIf Application.Name = "Microsoft Excel" Then
ActiveWorkbook.SaveAs Filename, FileFormat:=xlHtml, _
ReadOnlyRecommended:=False, CreateBackup:=False
ElseIf Application.Name = "Microsoft PowerPoint" Then
ActivePresentation.SaveAs Filename, FileFormat:=ppSaveAsHTML, EmbedTrueTypeFonts:=msoFalse
Else
MsgBox "Unrecognized Office Application: " + Application.Name
End If
' the value represents the path of the client.properties file
pathBuffer = GetStringValue("HKEY_LOCAL_MACHINE\Software\relBUILDER", "propertiesFile")
pathBuffer = Trim(pathBuffer)
' debug
MsgBox "pathBuffer: " + pathBuffer
' the value represents the path of the java interpreter
javaBuffer = GetStringValue("HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment\1.2", "JavaHome")
javaBuffer = Trim(javaBuffer)
'debug
MsgBox "javaBuffer: " + javaBuffer
'''''''''''''''''''''''''''''''''''''''''''''''''
' CAN'T CONCATENATE 2 STRINGS!!!
var3 = "\bin\java -classpath c:\jars\relbuilder.jar;c:\jars\relbuilder_be.jar;c:\development\relbuilder\officeintegration\classes com.deltacap.relbuilder.client.plugin.Office2000Plugin
'var4 = javaBuffer & var3 'this doesn't works!!
' var4 = var3 + javaBuffer 'this works
'Shell javaBuffer + var3 + Filename + " " + pathBuffer, vbNormalFocus
End Sub
I got a "file not found" error when I run the shell command because it is ignoring "var3 + Filename...."
maria.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|