I'm working on an HTA which includes a subroutine that executes two different commands (install a printer then load it's configuration file via "rundll32 printui.dll,PrintUIEntry..."). My problem is that the script tries to load the configuration file before the print driver is ready to accept it.
How can I force the "configuration" command to run only after the "install" command has completed what it needs to do? After searching around a bit, I discovered that I can't even use wscript.sleep for a temporary pause since it won't work in an HTA. I did find a few alternate ways to pause a script, but I'd prefer that the script be more precise and continue only after the previous command has finished.
Any ideas?
These are the commands that I'm running:
In case you wanted to know... printer.value is a variable containg the printer name.
If you want more info regarding printui.dll, just run this:
How can I force the "configuration" command to run only after the "install" command has completed what it needs to do? After searching around a bit, I discovered that I can't even use wscript.sleep for a temporary pause since it won't work in an HTA. I did find a few alternate ways to pause a script, but I'd prefer that the script be more precise and continue only after the previous command has finished.
Any ideas?
These are the commands that I'm running:
Code:
...
[i]install the printer[/i]
objShell.Run "rundll32 printui.dll,PrintUIEntry /if /b """ & printer.value & """ /f ""%windir%\inf\ntprint.inf"" /r ""IP_192.168.1.148"" /m ""HP LaserJet 2200 Series PCL 6"" /u"
[i]configure the printer[/i]
objShell.Run "rundll32 printui.dll,PrintUIEntry /Sr /n """ & printer.value & """ /a ""C:\Documents and Settings\Administrator\My Documents\Printer Settings\" & printer.value & ".dat"""
...
If you want more info regarding printui.dll, just run this:
Code:
rundll32 printui.dll,PrintUIEntry /?