×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

HTA vbs script cannot execute program when scheduled task launched

HTA vbs script cannot execute program when scheduled task launched

HTA vbs script cannot execute program when scheduled task launched

(OP)


Trying to make a simple kiosk HTA, that autostarts when the user log on. But I cannot get it to work, when I add the hta as a scheduled task.

I use a hta file as a splash screen, while it executes needed scripts and programs and then the kiosk interface HTA file.

When I run the splash hta manually, everything works as intended. But when I add the splash HTA as a scheduled task it breaks my execute script and can't find any of the programs and scripts I tell it to launch.

I use Inno setup to install the kiosk and also want it the setup the scheduled task if possible.

The files I need to run are installed to: C:\Users\USER\AppData\Local\Programs\MyKiosk\data

The scheduled task action is: Program: C:\Windows\System32\mshta.exe Arguments: %localappdata%\Programs\Mykiosk\Splash.hta

This is the vbs script from the splash HTA:

<HTA:APPLICATION
CONTEXTMENU = "no"
BORDER="none"
INNERBORDER = "no"
SINGLEINSTANCE = "yes"
SHOWINTASKBAR = "no"
SCROLL="no"/>

<script type="text/vbscript">

Sub window_onload()
CenterWindow (screen.Width - widthX)/4, (screen.Height - heightY)/4.5

Call Execute("program.exe")
Call Execute("script.bat")
Call Sleep(1)
Call Execute("StartKiosk.bat")
Window.Close

End Sub

'-----------------------------WindowsSize-----------------------------------------
Sub CenterWindow( widthX, heightY )
self.ResizeTo widthX, heightY
self.MoveTo (screen.Width - widthX)/2, (screen.Height - heightY)/2
End Sub
'----------------------------Execute---------------------------------------
Sub Execute(Program)
set shell=CreateObject("Shell.Application")
' shell.ShellExecute "application", "arguments", "path", "verb", window
shell.ShellExecute ""&Program&"",,"data\", "runas", 0
set shell=nothing
End sub
'-----------------------------Sleep-----------------------------------------
Sub Sleep(seconds)
CreateObject("WScript.Shell").Run "%COMSPEC% /c ping 127.0.0.1 -n " _
& seconds+1, 0, True
End Sub

</script>

I've tried replacing the data\ path to %localappdata%\Programs\Mykiosk\data\ But that didn't help, get the same Windows cannot find the program errors.

I'm stuck, can anyone tell me what I'm doing wrong?

RE: HTA vbs script cannot execute program when scheduled task launched

Take out the executes and just leave the centre window - does it start?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close