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

RE: [amibroker] Re: OT: Jscript Help


  • Date: Fri, 8 Jan 2010 07:05:06 -0800
  • From: "ta" <tagroups@xxxxxxxxxxxxx>
  • Subject: RE: [amibroker] Re: OT: Jscript Help

PureBytes Links

Trading Reference Links



Thanks again

 

From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Mike
Sent: Thursday, January 07, 2010 11:45 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: OT: Jscript Help

 

 

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/_javascript_T/_javascript_date.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/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___