1. Commandline params?
- Posted by Euman <euman at bellsouth.net> Jan 27, 2001
- 499 views
- Last edited Jan 28, 2001
------=_NextPart_000_000D_01C088C7.AD2C3980 charset="iso-8859-1" Hello, I have an un-usual problem here that I dont know the answer to right = off. Maybe someone could simplify this for me. The problem stems from: cmd =3D command_line() cmd[2..length(cmd)] Question: How do I retrieve the full commandline with " " (null string) space between each cmd without haveing to loop thru it? Example is to be: [On-the-fly ParamCount] Windows execution, without the = Window. <snippet> --start example-- include machine.e include dll.e without warning with trace atom lib integer jJumpto --id --(Highly Modified) DaJaRo Example lib =3D open_dll("shell32.dll") jJumpto =3D define_c_func(lib,"ShellExecuteA", = if jJumpto =3D -1 then puts(1,"couldn't find ShellExecuteA\n") abort(1) end if procedure Jump_to(integer id,sequence filename,sequence defaultpath, = sequence parameters, integer flag) sequence command, Filenam, DefaultPath, Parameters integer Nop atom command_ptr,Fnm_ptr,Prm_ptr,Dfp_ptr,hw command =3D "Open" Filenam=3D filename Parameters=3Dparameters DefaultPath=3Ddefaultpath command_ptr =3D allocate_string(command) Fnm_ptr =3D allocate_string(Filenam) Prm_ptr =3D allocate_string(Parameters) Dfp_ptr =3D allocate_string(DefaultPath) free(command_ptr) free(Fnm_ptr) free(Prm_ptr) free(Dfp_ptr) end procedure constant SW_HIDE =3D 0 procedure RunTut() sequence cmd cmd =3D command_line() trace(1) -- = *************************************************************************= *************** Jump_to(0,"comp.exe", "C:\\" , cmd[2] & " " & cmd[3], SW_HIDE )=20 -- .exe Current path Parameters Show = or Hide Window -- = *************************************************************************= *************** end procedure RunTut() <snippet> I could setup a certain amount of cmd[n] probably 9 or so levels deep and nullify the nth remaining params if not in use but, I hoped I = wouldn't have to do this.\\ Any and all suggestion appreciated ! euman at bellsouth.net ____________________________________________________________ T O P I C A -- Learn More. Surf Less. Newsletters, Tips and Discussions on Topics You Choose. http://www.topica.com/partner/tag01 ------=_NextPart_000_000D_01C088C7.AD2C3980 charset="iso-8859-1" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 5.50.4611.1300" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>Hello,</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>I have an un-usual problem here that I = dont know=20 the answer to right off.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>Maybe someone could simplify this for=20 me.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>The problem stems from:</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>cmd =3D command_line()</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>cmd[2..length(cmd)]</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Question:</FONT></DIV> <DIV><FONT face=3DArial size=3D2>How do I retrieve the full commandline = with " "=20 (null string) space</FONT></DIV> <DIV><FONT face=3DArial size=3D2>between each cmd without haveing to = loop thru=20 it?</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Example is to be: [On-the-fly = ParamCount] Windows=20 execution, without the Window.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2><snippet></FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>--start example--<BR>include = machine.e<BR>include=20 dll.e</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>without warning<BR>with = trace</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>atom lib<BR>integer = jJumpto =20 --id</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>--(Highly Modified) DaJaRo = Example<BR>lib =3D=20 open_dll("shell32.dll")<BR>jJumpto =3D = define_c_func(lib,"ShellExecuteA",=20 {C_INT,C_POINTER,C_POINTER,C_POINTER,C_POINTER,C_INT},C_INT)<BR>if = jJumpto =3D -1=20 then<BR>puts(1,"couldn't find ShellExecuteA\n")<BR>abort(1)<BR>end=20 if</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>procedure Jump_to(integer id,sequence=20 filename,sequence defaultpath, sequence parameters, integer = flag)<BR>sequence=20 command, Filenam, DefaultPath, Parameters<BR>integer Nop<BR>atom=20 command_ptr,Fnm_ptr,Prm_ptr,Dfp_ptr,hw<BR>command =3D = "Open"<BR>Filenam=3D=20 nd_ptr =3D=20 allocate_string(command)<BR>Fnm_ptr =3D = allocate_string(Filenam)<BR>Prm_ptr =3D=20 allocate_string(Parameters)<BR>Dfp_ptr =3D=20 rm_ptr)<BR>free(Dfp_ptr)<BR>end=20 procedure</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>constant SW_HIDE =3D 0</FONT></DIV> <DIV> </DIV><FONT face=3DArial size=3D2> <DIV><BR>procedure RunTut()<BR>sequence cmd<BR>cmd =3D=20 command_line()<BR>trace(1)</DIV> <DIV>--=20 *************************************************************************= ***************</DIV> <DIV> </DIV> <DIV>Jump_to(0,"comp.exe", "C:\\" , cmd[2] & " " & cmd[3], = SW_HIDE=20 )=20 nbsp; =20 exe = Current=20 path =20 Parameters Show or Hide=20 Window</DIV> <DIV> </DIV> <DIV>--=20 *************************************************************************= ***************<BR>end=20 procedure</DIV> <DIV> </DIV> <DIV>RunTut()</DIV> <DIV> </DIV> <DIV><snippet></DIV> <DIV> </DIV> <DIV> <DIV><FONT face=3DArial size=3D2>I could setup a certain amount of = cmd[n]=20 probably 9 or so levels deep</FONT></DIV> <DIV><FONT face=3DArial size=3D2>and nullify the nth remaining params if = not in use=20 but, I hoped I wouldn't</FONT></DIV> <DIV><FONT face=3DArial size=3D2>have to do this.\\</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Any and all suggestion appreciated=20 !</FONT></DIV></DIV> <DIV> </DIV> <DIV><A = <DIV><BR> </DIV></FONT> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> T O P I C A -- Learn More. Surf Less. Newsletters, Tips and Discussions on Topics You Choose. <A HREF=3D"http://www.topica.com/partner/tag01">http://www.topica.com/partner/tag01</A></PRE> ------=_NextPart_000_000D_01C088C7.AD2C3980--
2. Re: Commandline params?
- Posted by Euman <euman at bellsouth.net> Jan 27, 2001
- 563 views
- Last edited Jan 28, 2001
------=_NextPart_000_0019_01C088CA.4F26FB60 charset="iso-8859-1" BTW, The Example I sent earlier between <snippet> will not run without modification in RunTut. Sorry euman ----- Original Message -----=20 From: Euman=20 To: EUforum at topica.com=20 Sent: Sunday, January 28, 2001 01:07 Subject: Commandline params? Hello, I have an un-usual problem here that I dont know the answer to right = off. Maybe someone could simplify this for me. The problem stems from: cmd =3D command_line() cmd[2..length(cmd)] Question: How do I retrieve the full commandline with " " (null string) space between each cmd without haveing to loop thru it? Example is to be: [On-the-fly ParamCount] Windows execution, without = the Window. <snippet> --start example-- include machine.e include dll.e without warning with trace atom lib integer jJumpto --id --(Highly Modified) DaJaRo Example lib =3D open_dll("shell32.dll") jJumpto =3D define_c_func(lib,"ShellExecuteA", = if jJumpto =3D -1 then puts(1,"couldn't find ShellExecuteA\n") abort(1) end if procedure Jump_to(integer id,sequence filename,sequence defaultpath, = sequence parameters, integer flag) sequence command, Filenam, DefaultPath, Parameters integer Nop atom command_ptr,Fnm_ptr,Prm_ptr,Dfp_ptr,hw command =3D "Open" Filenam=3D filename Parameters=3Dparameters DefaultPath=3Ddefaultpath command_ptr =3D allocate_string(command) Fnm_ptr =3D allocate_string(Filenam) Prm_ptr =3D allocate_string(Parameters) Dfp_ptr =3D allocate_string(DefaultPath) Nop=3Dc_func(jJumpto,{0,command_ptr,Fnm_ptr,Prm_ptr,Dfp_ptr,flag}) free(command_ptr) free(Fnm_ptr) free(Prm_ptr) free(Dfp_ptr) end procedure constant SW_HIDE =3D 0 procedure RunTut() sequence cmd cmd =3D command_line() trace(1) -- = *************************************************************************= *************** Jump_to(0,"comp.exe", "C:\\" , cmd[2] & " " & cmd[3], SW_HIDE )=20 -- .exe Current path Parameters Show = or Hide Window -- = *************************************************************************= *************** end procedure RunTut() <snippet> I could setup a certain amount of cmd[n] probably 9 or so levels deep and nullify the nth remaining params if not in use but, I hoped I = wouldn't have to do this.\\ Any and all suggestion appreciated ! euman at bellsouth.net =20 ____________________________________________________________ T O P I C A -- Learn More. Surf Less.=20 Newsletters, Tips and Discussions on Topics You Choose. http://www.topica.com/partner/tag01 ____________________________________________________________ T O P I C A -- Learn More. Surf Less. Newsletters, Tips and Discussions on Topics You Choose. http://www.topica.com/partner/tag01 ------=_NextPart_000_0019_01C088CA.4F26FB60 charset="iso-8859-1" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 5.50.4611.1300" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>BTW, The Example I sent earlier between = <snippet> will</FONT></DIV> <DIV><FONT face=3DArial size=3D2>not run without modification in RunTut. = Sorry</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>euman</FONT></DIV> <BLOCKQUOTE dir=3Dltr=20 style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; = BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV> <DIV=20 style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: = black"><B>From:</B>=20 <A title=3Deuman at bellsouth.net = href=3D"mailto:euman at bellsouth.net">Euman</A>=20 </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A = title=3DEUforum at topica.com=20 href=3D"mailto:EUforum at topica.com">EUforum at topica.com</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Sunday, January 28, 2001=20 01:07</DIV> <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Commandline = params?</DIV> <DIV><BR></DIV> <DIV><FONT face=3DArial size=3D2>Hello,</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>I have an un-usual problem here that = I dont know=20 the answer to right off.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>Maybe someone could simplify this for = me.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>The problem stems from:</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>cmd =3D command_line()</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>cmd[2..length(cmd)]</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Question:</FONT></DIV> <DIV><FONT face=3DArial size=3D2>How do I retrieve the full = commandline with " "=20 (null string) space</FONT></DIV> <DIV><FONT face=3DArial size=3D2>between each cmd without haveing to = loop thru=20 it?</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Example is to be: [On-the-fly = ParamCount] Windows=20 execution, without the Window.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2><snippet></FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>--start example--<BR>include = machine.e<BR>include=20 dll.e</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>without warning<BR>with = trace</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>atom lib<BR>integer = jJumpto =20 --id</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>--(Highly Modified) DaJaRo = Example<BR>lib =3D=20 open_dll("shell32.dll")<BR>jJumpto =3D = define_c_func(lib,"ShellExecuteA",=20 {C_INT,C_POINTER,C_POINTER,C_POINTER,C_POINTER,C_INT},C_INT)<BR>if = jJumpto =3D=20 -1 then<BR>puts(1,"couldn't find ShellExecuteA\n")<BR>abort(1)<BR>end=20 if</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>procedure Jump_to(integer id,sequence = filename,sequence defaultpath, sequence parameters, integer = flag)<BR>sequence=20 command, Filenam, DefaultPath, Parameters<BR>integer Nop<BR>atom=20 command_ptr,Fnm_ptr,Prm_ptr,Dfp_ptr,hw<BR>command =3D = "Open"<BR>Filenam=3D=20 = nd_ptr =3D=20 allocate_string(command)<BR>Fnm_ptr =3D = allocate_string(Filenam)<BR>Prm_ptr =3D=20 allocate_string(Parameters)<BR>Dfp_ptr =3D=20 = rm_ptr)<BR>free(Dfp_ptr)<BR>end=20 procedure</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>constant SW_HIDE =3D 0</FONT></DIV> <DIV> </DIV><FONT face=3DArial size=3D2> <DIV><BR>procedure RunTut()<BR>sequence cmd<BR>cmd =3D=20 command_line()<BR>trace(1)</DIV> <DIV>--=20 = *************************************************************************= ***************</DIV> <DIV> </DIV> <DIV>Jump_to(0,"comp.exe", "C:\\" , cmd[2] & " " & = cmd[3],=20 SW_HIDE )=20 = nbsp; =20 .exe = Current=20 path =20 Parameters Show or Hide = Window</DIV> <DIV> </DIV> <DIV>--=20 = *************************************************************************= ***************<BR>end=20 procedure</DIV> <DIV> </DIV> <DIV>RunTut()</DIV> <DIV> </DIV> <DIV><snippet></DIV> <DIV> </DIV> <DIV> <DIV><FONT face=3DArial size=3D2>I could setup a certain amount = of cmd[n]=20 probably 9 or so levels deep</FONT></DIV> <DIV><FONT face=3DArial size=3D2>and nullify the nth remaining params = if not in=20 use but, I hoped I wouldn't</FONT></DIV> <DIV><FONT face=3DArial size=3D2>have to do this.\\</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Any and all suggestion appreciated=20 !</FONT></DIV></DIV> <DIV> </DIV> <DIV><A = <DIV><BR> </DIV></FONT> <DIV><FONT face=3DArial = ____________________ T O P I C A -- Learn More. Surf Less.=20 Newsletters, Tips and Discussions on Topics You Choose. <A = r/tag01</A></PRE></BLOCKQUOTE> T O P I C A -- Learn More. Surf Less. Newsletters, Tips and Discussions on Topics You Choose. <A HREF=3D"http://www.topica.com/partner/tag01">http://www.topica.com/partner/tag01</A></PRE> ------=_NextPart_000_0019_01C088CA.4F26FB60--
3. Re: Commandline params?
- Posted by Graeme <graemeburke at CROSSWINDS.NET> Jan 27, 2001
- 489 views
- Last edited Jan 28, 2001
-----------<EXERPT FROM WIN32.HLP>------------------- The GetCommandLine function returns a pointer to the command-line string for the current process. LPTSTR GetCommandLine(VOID) Parameters This function has no parameters. Return Value The return value is a pointer to the command-line string for the current process. ------------------</EXERPT>-------------------------- It's in kernel32. Should be a sinch to wrap. Graeme. ---------------------------------------------------- http://www.geocities.com/SiliconValley/Network/6843/ ____________________________________________________________ T O P I C A -- Learn More. Surf Less. Newsletters, Tips and Discussions on Topics You Choose. http://www.topica.com/partner/tag01
4. Re: Commandline params?
- Posted by Euman <euman at bellsouth.net> Jan 27, 2001
- 481 views
- Last edited Jan 28, 2001
------=_NextPart_000_0037_01C088D0.79EB1B00 charset="iso-8859-1" That one was too easy, I must be brain dead tonight (well, everynight. = hehe) I figured this one out just after I sent the last post. You can replace the procedure RunTut (sent earlier) with this one Change "comp.exe" to any other program you want to run (DOS or Win) and on the commandline, you'll be able to run those programs with any level command parameters it takes. procedure RunTut() sequence cmd, cmd2, cmd3 cmd =3D command_line() cmd3 =3D {} cmd2 =3D cmd[3..length(cmd)] for x =3D 1 to length(cmd2) do cmd3 &=3D cmd2[x] & " " end for Jump_to(0,"comp.exe", "C:\\euphoria\\bmcrunch", cmd3, SW_HIDE ) -- .exe Current path Parameters = Show or Hide Window end procedure RunTut() euman at bellsouth.net ____________________________________________________________ T O P I C A -- Learn More. Surf Less. Newsletters, Tips and Discussions on Topics You Choose. http://www.topica.com/partner/tag01 ------=_NextPart_000_0037_01C088D0.79EB1B00 charset="iso-8859-1" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 5.50.4611.1300" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>That one was too easy, I must be brain = dead tonight=20 (well, everynight. hehe)</FONT></DIV> <DIV><FONT face=3DArial size=3D2>I figured this one out just after I = sent the last=20 post.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>You can replace the procedure RunTut = (sent earlier)=20 with this one</FONT></DIV> <DIV><FONT face=3DArial size=3D2>Change "comp.exe" to any other program = you want to=20 run (DOS or Win)</FONT></DIV> <DIV><FONT face=3DArial size=3D2>and on the commandline, you'll be able = to run those=20 programs</FONT></DIV> <DIV><FONT face=3DArial size=3D2>with any level command parameters it=20 takes.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>procedure RunTut()<BR>sequence cmd, = cmd2,=20 cmd3<BR>cmd =3D command_line()<BR>cmd3 =3D {}</FONT></DIV> <DIV><FONT face=3DArial size=3D2><BR>cmd2 =3D cmd[3..length(cmd)]<BR>for = x =3D 1 to=20 length(cmd2) do<BR> cmd3 &=3D cmd2[x] & " = "<BR>end=20 for</FONT></DIV> <DIV><FONT face=3DArial size=3D2><BR>Jump_to(0,"comp.exe", = "C:\\euphoria\\bmcrunch",=20 cmd3, SW_HIDE )<BR>-- =20 exe Current=20 sp; =20 sp; =20 Show or Hide Window<BR>end procedure</DIV> <DIV> </DIV> <DIV>RunTut()<BR></FONT></DIV> <BLOCKQUOTE dir=3Dltr=20 style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; = BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV><FONT face=3DArial size=3D2><A=20 = <DIV><FONT face=3DArial = size=3D2></FONT> </DIV></BLOCKQUOTE> T O P I C A -- Learn More. Surf Less. Newsletters, Tips and Discussions on Topics You Choose. <A HREF=3D"http://www.topica.com/partner/tag01">http://www.topica.com/partner/tag01</A></PRE> ------=_NextPart_000_0037_01C088D0.79EB1B00--