• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

I have a 7 line script, with one loop. please debug it and make it work for 500 quick pts

this is a standalone script, I am scheduling to run once per minute on a server.
It opens the command window, but apparently does not run the .exe
Please make it work, including the switch, and post back
set wsobject = wscript.createobject("wscript.shell")
i=1
do while i<11
  wsobject.run('"C:\\Program Files\\2BrightSparks\\SyncBackSE\\SyncBackSE.exe" -m "FTPWebcam"',0,"TRUE")
  wscript.sleep 6000
  i=i+1
loop

Open in new window

0
ksuchy
Asked:
ksuchy
  • 5
  • 4
  • 2
  • +1
4 Solutions
 
jazzIIIloveCommented:
0
 
ksuchyAuthor Commented:
please fix my script.  I'm not looking for alternatives, and don't have time to debug myself.
0
 
Shift-3Commented:
This should work.


set wsobject = wscript.createobject("wscript.shell")
i=1
do while i<11
    wsobject.run Chr(34) & "C:\Program Files\2BrightSparks\SyncBackSE\SyncBackSE.exe" & _
        Chr(34) & "-m " & Chr(34) & "FTPWebcam" & Chr(34),0,"TRUE")
    wscript.sleep 6000
    i=i+1
loop

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jazzIIIloveCommented:
>>am scheduling to run once per minute on a server.
If a windows server, follow the shots...

best regards...
VBSTask1.JPG
VBSTask2.JPG
VBSTask3.JPG
0
 
rejoinderCommented:
You can try this too...
set wsobject = wscript.createobject("wscript.shell")
i=1
do while i<11
  strEXE = """C:\Program Files\2BrightSparks\SyncBackSE\SyncBackSE.exe"" -m ""FTPWebcam"""
  wsobject.run strEXE,0,TRUE
  wscript.sleep 6000
  i=i+1
loop

Open in new window

0
 
ksuchyAuthor Commented:
Jazz & ReJoinder,

Ok, I'm much closer now, so thanks to both of you.  However, there remain a few issues.  In Windows Server 2003 task manager, "the duration must be longer than the repetition interval".  Frankly, it doesn't make sense to me WHY, but that's the message if you try to set it for 1 minute repetitions, and duration 1 minute.  

So I ran 3 tests:
(1) set it to run every 1 minute, for a duration of 2 minutes, but it stops after one iteration and I don't think the task is attempting to run a second time from task scheduler,
(2) even if I click the box that reads "if the task is still running, stop it at this time" it still never kicks off a 2nd time
(3) then I also added the "Stop this task if it runs for 2 minutes" on the settings tab

I AM ABLE to verify that the script does successfully run through once (that SyncBackSE.exe executes with the appropriate FTP switch 9 times.

Is there something about how you need to end the script, perhaps to release the wscript host or some other components/variables?

My last line is verbatum yours, "Loop".

Thanks,
~k
0
 
rejoinderCommented:
I suggest that you set up the loop so that it will never end - comment out the line;
i=i+1
This will loop the script forever.
In the Task Manager window, set up the script to run at system startup and blank out the check box to stop the script after 72 hours.
What will happen is the system boots up, runs the script which will loop every minute.  The script will continue to fire every minute until you stop the task.
0
 
ksuchyAuthor Commented:
Hi ReJoinder,

Thanks, it seems to be working now, but once again, only as long as I'm logged in.
When I log off, I get a very brief window that reads,

SynBackSE.exe - DLL Initialization Failed
"The application failed to initialize because the window is shutting down."

While logged off, it doesn't run at all now, and when I log back on, this window is right on top, like the script is hung.

Regards,
~k
0
 
rejoinderCommented:
Try running the task as a local admin account (you might need to create an account just for this purpose)  not the account you use to log in as.  This should start the script without it being visible since it will run as that other account.  When the script fires, the exe should be running under the context of the other account and should not be visible to the logged in user.  Logging out will not affect the script running.
0
 
ksuchyAuthor Commented:
Got it working.  I set the task to daily repetition once per day at 8 am, with a duration of 23 hrs 59 minutes.
0
 
rejoinderCommented:
Glad to know the script is running well now.
0
 
ksuchyAuthor Commented:
Thank You :-)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now