[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: OT: Jscript Help


  • Date: Fri, 08 Jan 2010 07:45:27 -0000
  • From: "Mike" <sfclimbers@xxxxxxxxx>
  • Subject: [amibroker] Re: OT: Jscript Help

PureBytes Links

Trading Reference Links

Sorry,

I got lazy on that one, firing off a reply without actually testing it :(

I believe that you can get what you are after by using the Run method insteadof Exec. The following (tested this time!) is an example:

var WshShell = new ActiveXObject( "WScript.Shell" );
var Starting_Time = new Date();
var oExec = WshShell.Run( "c:\\windows\\system32\\notepad.exe", 1, true );

if ( oExec.status == 1 )
{
    var Ending_Time = new Date();

    WScript.Echo( "Starting_Time: " + Starting_Time + "Ending_Time: " + Ending_Time );
}
else
{
    WScript.Echo( "Error returned." );
}

More detail can be found here:
http://msdn.microsoft.com/en-us/library/d5fk67ky(VS.85).aspx

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "ta" <tagroups@xxx> wrote:
>
> Thanks Mike. In the jscript code below I am getting the starting time
> correctly. The problem was with the ending time, as the script does not wait
> for the exe to complete its run before it was giving the ending time. I
> rewrote it as follow in vbscript, it does the job for me . I realy don't
> know jscript or vbscript. This was one time thing. Again as always thanks a
> million for all your contributions on this board.
> 
>  
> 
> Dim WshShell, oExec, Ending_Time, Starting_Time
> 
> Set WshShell = CreateObject("WScript.Shell")
> 
> Starting_Time = FormatDateTime(time, 3) 
> 
>  
> 
> Set oExec = WshShell.Exec("c:\\Amibroker\\mytask.exe /f ")
> 
>  
> 
> Do While oExec.Status = 0
> 
>      Ending_Time = FormatDateTime(time, 3) 
> 
> Loop
> 
> WScript.Echo "Starting_Time = " & Starting_Time & "     Ending_Time = " &
> Ending_Time
> 
>  
> 
>  
> 
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
> Of Mike
> Sent: Thursday, January 07, 2010 5:34 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: OT: Jscript Help
> 
>  
> 
>   
> 
> Use one of the *methods* on the Date object to get the value.
> See: http://www.tizag.com/javascriptT/javascriptdate.php
> 
> Mike
> 
> --- In amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%40yahoogroups.com> , "ta"
> <tagroups@> wrote:
> >
> > I asked a programmer to create exe file for me to manipulate AB data
> files.
> > I want to time how long it takes for it to accomplish various tasks. So, I
> > wrote the following script to measure how long it take to run the
> mytask.exe
> > file. However, it does not work as intended. Any help or suggestions would
> > be appreciated. TIA
> > 
> > 
> > 
> > var WshShell = new ActiveXObject("WScript.Shell");
> > 
> > var Starting_Time = new Date(); 
> > 
> > 
> > 
> > var oExec = WshShell.Exec("c:\\Amibroker\\mytask.exe /f ");
> > 
> > 
> > 
> > if( oExec.status == 0 )
> > 
> > {
> > 
> > var Ending_Time = new Date(); 
> > 
> > WScript.Echo("Starting_Time: " + Starting_Time +
> > "Ending_Time: " + Ending_Time);
> > 
> > }
> >
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/