Aqua-Soft Forums: Passing Command Line Arguments - Aqua-Soft Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Passing Command Line Arguments Rate Topic: -----

#1 User is offline   SirSmiley Icon

  • Douchebag
  • Group: Member
  • Posts: 1,885
  • Joined: 28-June 05

Posted 11 May 2006 - 11:23 PM

Okay, so I'm learning js as I build desklets maybe not the best but, I also see a number of functions that can be carried out within the regular xml file. So, I truly understand the power of it even more and must extend my thanks again. Now for the question.

The SDK documents the use of command lines well. The question is does it override the systems autorun settings & default to the AveDesk/AveScripter directory?

Running the code below defaults to the specific desklet folder then only requires syntax to subfolder. Is this the default?

I realize this needs to be addressed in my script either way as some people probably override the autron to default drive, Just need to know the starting point as I can eliminate calling the shell run object.

/* Create WSH Shell */

oShell = WScript.CreateObject( "WScript.Shell" );



/* run command line program followed by parameters */

/* Launch a command shell "/C" <- close cmd window */

/* Launch a command shell "/K" <- shows cmd window */

/* Specify 0 to keep window hidden 1 for open	  */

/* If command line autorun is overridden to		*/

/* default to home drive then code won't work */



/* Archive Type 7z with maximum compression */

oShell.Run( "%COMSPEC% /c program7z.exe a -t7z -r program.7z program/* -mx9 ",0 );

0

#2 User is offline   pcm Icon

  • Group: Member
  • Posts: 617
  • Joined: 02-May 05

Posted 12 May 2006 - 12:34 AM

Hmm... I've tried real hard to understand your question, but I just can't seem to understand it.

I've never use the oShell and I had a few issues with it. I've implemented ExecuteCMD in the IO.

Example

cmd = desklet.IO.ExecuteCMD('cmd /k','onCMDResult');
cmd.Start();

Using that one, it seems to be the Home directory of the user the default directory.

Again, I might be just blow alot of air since I'm not clear on the question.
0

#3 User is offline   SirSmiley Icon

  • Douchebag
  • Group: Member
  • Posts: 1,885
  • Joined: 28-June 05

Posted 12 May 2006 - 12:51 AM

on XP by default the cmd console autoruns from the directory it's activitated from.

If i execute the cmd console from C:/Program Files/AveDesk/Desklets/AveScripter/Desklet then it executes specifically from that folder. Cmd prompt will start in C:/Program Files/AveDesk/Desklets/AveScripter/Desklet.

Personally I've tweaked the registry so, that cmd console always executes from the root directory. If u execute the cmd console from C:/Program Files/AveDesk/Desklets/AveScripter/Desklet it opens up to C:.

As an example in my code above the directory is C:/Program Files/AveDesk/Desklets/AveScripter/Desklet/program/7z.exe . I switched back to system default
& only need to pass the subfolder argument not the full path.

It sounds like it runs whatever the system default is.

Save the code below to a js file & run from a desklet directory to see what I'm saying.

oShell = WScript.CreateObject( "WScript.Shell" );

oShell.Run( "%COMSPEC% /K ",1 );

0

#4 User is offline   pcm Icon

  • Group: Member
  • Posts: 617
  • Joined: 02-May 05

Posted 12 May 2006 - 02:42 AM

Mine opens in C:
0

#5 User is offline   SirSmiley Icon

  • Douchebag
  • Group: Member
  • Posts: 1,885
  • Joined: 28-June 05

Posted 12 May 2006 - 02:55 AM

I'm just going to set it to C: in the command line which will save writing an if statement.

Thanks for the help. :)
0

#6 User is offline   herd Icon

  • Group: Developers
  • Posts: 999
  • Joined: 02-November 03

Posted 13 May 2006 - 12:13 PM

AFAIK, all the Wscript.* methods are implemented in wscript.exe and exposed to the script engine and are thus specific to scripts run in windows script host only.

Judge's SysStats implements a bunch of these to ease porting, but IIRC, AveScripter does not.

The correct way doing this in JScript would hence be:

oShell = new ActiveXObject( "WScript.Shell" );

oShell.Run( "%COMSPEC% /K ",1 );


Apart from running programs, the Shell object has a lot of nice things built in, e.g. creating shortcuts. Also check out the other wsh* objects, by viewing wshom.ocx in a typelib viewer of your choice.

hth,

herd
0

#7 User is offline   SirSmiley Icon

  • Douchebag
  • Group: Member
  • Posts: 1,885
  • Joined: 28-June 05

Posted 13 May 2006 - 04:58 PM

Thx. Was wondering about that last night as calling the FSO using the way I posted seemed sloppy also. :)
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic