WINEXEC with OE 4.13 (OpenInsight 32-Bit)
At 15 APR 2010 02:06:22PM David Salvesen wrote:
Hi
Can anyone give me some more information about how to use this please?
I am messing around with SOLR indexing information from an OI database and would like to be able to call either a batch file, or better still a Java command from within an Oengine program. I can get the DOS window to come up but can't work out how to format the parameters that it requires (either the batch filename or the whole script).
For instance, the script I would like to run, in a given folder for preference, although the OI folder would be fine, if necessary, is
java -Xmx1024m -Durl=http://localhost:8080/solr/windata/update -jar post.jar C:\heritage\solrtest\toindex\toindex17.xml
or if using a batch file:
c:\heritage\solrtest\toindex.bat
Many thanks
David
At 15 APR 2010 02:15PM Dave Harmacek wrote:
Look at the Utility function, parameter RUNWIN.
It passes a command line to the WinExec function. I use it to run .bat files that I had just created.
Dave
At 16 APR 2010 06:56AM David Salvesen wrote:
Dave
Thanks for this. I understand, but when I tried
Result=Utility(RUNWIN, "CMD")
within a function which I am running from the System Editor I got an error:
"The stored procedure can be run in event context only"
Or with a 1 at the end. Similar effect trying other utilities like BEEP although copyfile worked e.g.
retval=Utility("COPYFILE" , "C:\AUTOEXEC.BAT", "C:\AUTOEXEC.SAD")
So I thought that I would try WINEXEC instead. I could then at least get the command line to open up. Perhaps I haven't the syntax quite right?
At 16 APR 2010 07:31AM John Bouley wrote:
David,
Your command should be result=utility("RUNWIN",cmd)
HTH,
John
At 16 APR 2010 09:31AM Dale Jessop wrote:
Have you tried using the shellExecute command ?
At 16 APR 2010 11:25AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
Hi David,
The following functions can only be run in "Event Context" which means they can only be called properly from within a Basic+ event handler, which means their point of origin has to be an OI window (having said that they can be run from the System Monitor though the @window variable won't be valid)
Get_Property Set_Property Send_Message UtilitySo that's why they don't like being executed from the System Editor - but back to WinExec…
This function was actually deprecated in Win32 - these days it's just a wrapper around CreateProcess but you can still use it. I believe Rev have prototyped it in DLL_KERNEL32 as
UINT STDCALL WinExec(LPCHAR,UINT)So to use it simply do this:
.bpPre {
font-family:Consolas,Courier New,Courier,Verdana,Arial;font-size:10pt;background-color:#FEFEFE;color:#000000;border:1px solid #7389AE;padding:10px 20px;margin:0px 10px auto;}
.bpComment {
font-style:italic;color:#008000;}
.bpDirective {
color:#808000;}
.bpKeyword {
color:#0000FF;}
.bpNumber {
color:#800000;}
.bpString {
color:#008080;}
.bpSymbol {
color:#800040;}
.bpSysVar {
color:#8000FF;}
.bpDebug {
font-size:12pt;font-weight:bold;color:#FF0000;}
.bpDict {
color:#FF8000;}
.bpLabel {
font-size:11pt;font-weight:bold;}
.bpLineNo {
font-family:Courier New, Courier, monospace;color:#808080;background-color:#F5F5F5;}
declare function WinExec equ SW_SHOWNORMAL$ to 1 lpCmd = "java -Xmx1024m -Durl=http://localhost:8080/solr/windata/update -jar post.jar C:\heritage\solrtest\toindex\toindex17.xml" lpCmd := \00\ ; * // prototyped as LPCHAR so null-terminate x = WinExec( lpCmd, SW_SHOWNORMAL$ )World leaders in all things RevSoft
At 19 APR 2010 09:30AM David Salvesen wrote:
Hi
Many thanks for this. Almost there but it appears that the null-termination is not required (I noticed that it was back in '98 when Mike asked a question about using WinExec to control a modem), but it wouldn't work for me with it.
By the way, and this may have been discussed, I notice that the date on many messages in the forum has been changed to quite recent even for very old messages. I guess that this is the result of an upload or some such, but it makes it very difficult to separate out the new from the old when using the archive. Any chance of changing the dates RevSoft please?