Search the web
Sign In
New User? Sign Up
thecredit · CREdit text editor
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Cannot use WScript Sleep method from VBScript macro   Message List  
Reply | Forward Message #97 of 106 |
Re: Cannot use WScript Sleep method from VBScript macro

Anders,

Thanks for the advice. Your suggestion does all that I need :)

Willie

--- In thecredit@yahoogroups.com, "aklinting" <ank@d...> wrote:
> Hi
> I have done this differently:
>
> Under Options|Tools... create one called
> "Run script"
>
> set command : cscript.exe
> Arguments : $(FilePath)
>
> Check : "Prompt for arguments" and "Redirect to output Window"
> And choose "Active File only" under Save file before running this
> tool"
>
> I furthermore have assigned F5 (under Options|Keyboard...) to run
> this tool.
> This will runn your script and redirect your output to the output
> pane (plus allow you to specify command line arguments).
>
>
> Anders
> --- In thecredit@yahoogroups.com, willie@a... wrote:
> > I have modfied the "Save&Run" macro (that is available from the
> > CREdit website), to allow it to display the output of the
> > executed "script" in the output pane.
> >
> > To do this correctly I need to wait for the script to complete,
and
> I
> > therefore use a loop which contains a "Sleep" to do this.
> > Unfortunately though I can't seem to access the Sleep() method of
> the
> > implicit WScript object.
> >
> > The macro is listed below. Does anyone have any ideas what I am
> > doing wrong?
> >
> > Thanks,
> >
> > Will
> >
> > ' Begin script listing
> > Sub SaveAndRunScript
> > Dim objExec
> >
> > ' change current dir to the active document's directory.
> > Application.CurrentDirectory = ActiveDocument.Path
> >
> > 'Save Without Prompt only if file changed.
> > If ActiveDocument.Saved = False Then ActiveDocument.Save
> > ActiveDocument.FullName,False
> >
> > ' Write to output pane the name of the script that is being
> > run
> > Application.PrintToOutputWindow NOW() & " Starting " &
> > ActiveDocument.FullName
> >
> > Set WshShell = CreateObject("Wscript.Shell")
> >
> > 'Put " around file name in case it contains spaces.
> > Set objExec = WshShell.Exec("cscript.exe" & " " & chr(34) &
> > ActiveDocument.FullName & chr(34))
> >
> >
> > Do While objExec.Status = 0
> > Sleep(100)
> > 'WScript.Sleep(100) -- fails aswell
> > Loop
> >
> > ' Write the scripts StdOut to the output pane
> > Application.PrintToOutputWindow objExec.StdOut.ReadAll()
> > Application.PrintToOutputWindow objExec.StdErr.ReadAll()
> >
> > End Sub




Mon Dec 22, 2003 3:13 am

will4wright
Online Now Online Now
Send Email Send Email

Forward
Message #97 of 106 |
Expand Messages Author Sort by Date

I have modfied the "Save&Run" macro (that is available from the CREdit website), to allow it to display the output of the executed "script" in the output pane....
willie@...
will4wright
Online Now Send Email
Dec 18, 2003
7:55 am

Hi I have done this differently: Under Options|Tools... create one called "Run script" set command : cscript.exe Arguments : $(FilePath) Check :...
aklinting
Offline Send Email
Dec 19, 2003
8:29 am

Anders, Thanks for the advice. Your suggestion does all that I need :) Willie ... and...
will4wright
Online Now Send Email
Dec 22, 2003
11:40 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help