Solved

Using Task Scheduler to Open a VB Scrpit that opens a progam, and does a couple commands

Posted on 2011-02-21
6
579 Views
Last Modified: 2012-08-13
Hello, I need help. I can run my VB Script while on the server and it performs. Just when i am trying to do it as a scheduled task it does not work. I have tried to create a batch file to put in Task Scheduler to run the script and no luck. Below is my vb script.

Set WSHshell=CreateObject("WScript.Shell")
'open docstar client
WSHShell.Run "C:\docstar\dsclient.exe"
wscript.sleep (5000)
WSHShell.sendkeys "{enter}"
'This enters the username to login
WSHShell.sendkeys "username"
WSHShell.sendkeys "{enter}"
'This enters the Pasword to login
WSHShell.sendkeys "password"
WSHShell.sendkeys "{enter}"
wscript.sleep (5000)
'The rest below selects docs to file and auto files them
WSHShell.sendkeys "^f"
wscript.sleep (5000)
WSHShell.sendkeys "^a"
wscript.sleep (5000)
WSHShell.sendkeys "%f"
WSHShell.sendkeys "a"
wscript.sleep (5000)
WSHShell.sendkeys "{enter}"
wscript.sleep (5000)
WSHShell.sendkeys "{enter}"
0
Comment
Question by:ccrockett1027
  • 4
  • 2
6 Comments
 
LVL 14

Expert Comment

by:Psy053
ID: 34947557
If the Task was scheduled to occur during an Interactive Logon, it should work fine.

However, if the Task is scheduled to occur when there is no Interactive Logon,  it will fail, due to the use of the SendKeys method.

0
 

Author Comment

by:ccrockett1027
ID: 34951785
I tried that and it did not work. I would run the task while being logged into the account that it is authenticating with. The only way the script would run is if i manually invoke (click) the script. Does anyone have a way that may be different than what i have done to get the same result?
0
 
LVL 14

Accepted Solution

by:
Psy053 earned 500 total points
ID: 35003531
What is happening when the scheduled task runs? Is anything happening?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Assisted Solution

by:ccrockett1027
ccrockett1027 earned 0 total points
ID: 35007709
Nothing happens if i am lgged in or not.

Thanks for the help Psy053.

I after contacting or software vendor we found a way for the program to do what i wanted to script.

Thans Agian
0
 

Author Comment

by:ccrockett1027
ID: 35007752
1
0
 

Author Closing Comment

by:ccrockett1027
ID: 35045469
Had to contact our software vendor. they helped us thru the process in there programming to do what i wanted with the script
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
programming a polycom voip phone 3 25
I'm trying to understand this simple vb code! 2 24
A Table within a User Form 24 47
learn programming 8 42
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
OfficeMate Freezes on login or does not load after login credentials are input.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question