Hello, I have to call another program (windows) with a long string (about 250 characters or more) which also has line-feeds (CR/LF).
How can I do this? With shell.execute(program, arguments) or using shell.arguments nothing gets thru (using Xojo 2023r1.1).
Command/Argument Example:
c:\tmp\SendCommand.exe /test /p 587 /b "Sehr geehrter Herr Test,
wunschgemäß erinnern wir Sie an Ihren Termin in unserer Praxis am .
Bis bald!
Freundlich grüßt Sie
" /Server imap.xxx.de /to xxx@xxx.com /sub Terminerinnerung /from xxx@xxxx /u xxxxxxx /pass xxxx /SSL /s
Hi Tim, this does not work. I am calling a program that demands the shown parameter in exact that way.
The exact use of my little tool is a little wrapper between 2 foreign programs. I take the parameterstring from the calling program with system.commandline, replace a faulty part of that lengthy string and want to pass the corrected string to the (renamed) target program.
Sure, I know. Here the string (System.Commandline) my Wrapper get’s from the calling program:
"D:\tmp\mywrapper.exe" /test /p 587 /b "Sehr geehrter Herr Test,
wunschgemäß erinnern wir Sie an Ihren Termin in unserer Praxis am .
Bis bald!
Freundlich grüßt Sie
" /Server xxx.xxxxx.de /to xxx@xxxxr.com /sub Terminerinnerung /from xxx@xxxx.de /u xxx@xxxxx.de /pass xxxx /SSL /s
I do some nessesary string replacements, then call the shell, like:
// a1 is the string containig the modified system.commandline string
Var sh As New Shell
sh.Arguments = a1
sh.ExecuteMode = shell.ExecuteModes.synchronous
sh.Execute("d:\tmp\Originally called program.exe") 'does not work
'sh.Execute("d:\tmp\Originally called program.exe") 'does not work either
Var x1 As Integer = sh.ExitCode
I wrote a temporary exe only showing the now incoming system.commandline
It does not matter if:
not using sh.arguments, so calling it with sh.Execute(“d:\tmp\Originally called program.exe”, a1)
replacing endofline with endofline.CRLF, .CR or .LF
creating console or desktop app (all Windows)
I don’t get why this works in the original setup anyway. This morning I wrote a replacement for the called program (Sending of eMail).
Your code above throws errors (i use API2) b.t.w.: There is no endofline.msdos (I took .CRLF instead), and before the _ there has do be a +.
I have the feeling that in the real commandline parameters there is some code/character other then cr/lf and xojo interprets it before it is stored in system.commandline?