Jump to content

Recommended Posts

Posted (edited)

Wondering if someone could give me a hand with basic variables. I'm basically looking to create a user prompt that will ask for a numeric value up to 4 digits. It would then prompt the user to obtain a yes or no value for default printer. It would use the above information to launch one of two command line's to install printers via command prompt. If this is in the wrong location, my apologies. The numeric value entered by the user would fill the 'bolded' number below. Thanks

RUN ("Y:\BATCH\nipp.exe")

WinWaitActive("Novell iPrint Client Setup")

SEND ("!n")

; Delays the execution of the !F long enough for client to complete install

Opt("WinWaitDelay", 9000)

WinWaitActive("Novell iPrint Client Setup")

SEND ("!f")

; Need to add the variables ??

; Enter the numbers after RP in your printer name. (Example RP0004 would be 0004)

; Would you like this to be your default printer, YES or NO

RUN ("C:\WINNT\SYSTEM32\iprntcmd.exe http://www.xxx.xxx/ipp/RP0004 /add")

Edited by haggiss

Posted

RUN ("Y:\BATCH\nipp.exe")

WinWaitActive("Novell iPrint Client Setup")
SEND ("!n")
; Delays the execution of the !F long enough for client to complete install
Opt("WinWaitDelay", 9000)

WinWaitActive("Novell iPrint Client Setup")
SEND ("!f")
; Need to add the variables ??
; Enter the numbers after RP in your printer name. (Example RP0004 would be 0004)
$name = InputBox('Select Printer name', 'Example: 0004', '0000')
If Not @error Then
   RUN ("C:\WINNT\SYSTEM32\iprntcmd.exe http://www.xxx.xxx/ipp/RP" & $name & " /add")
  ; Would you like this to be your default printer, YES or NO
   If MsgBox(4 + 32, 'Set Default Printer', 'Would you like this to be your default printer') = 6 Then
      ; ?? Command to set default printer ??
   EndIf
EndIf

You could replace Opt("WinWaitDelay", 9000) with Sleep(9000) ?

The $name variable will store the value returned by the Inputbox. If Cancel is pressed, then @error will result and the If block will not be processed.

You may need to add a command to set your default printer?

Posted

MHz,

Thanks for your assistance. Very much appreciated. It certainly got me started, i'm thinking I may need a second variable for the YES or NO option. I'm also wondering if it makes more sense for it to go above the enter number variable. There are two different command line variables depending whether or not we want it to install, or install as default.

Run(@ComSpec & " /c " & @SystemDir & "\iprntcmd.exe http://www.iprint.xxx.xxx/ipp/RP" & $name & " /add /default")

or

Run(@ComSpec & " /c " & @SystemDir & "\iprntcmd.exe http://www.iprint.xxx.xxx/ipp/RP" & $name & " /add ")

I've updated this script with your suggestion as well as a few check variables at the beginning. At the moment it, you enter the variable it launches the dos commmand then promts for yes or no. then attempts to execute the default command depending if you choose yes. Ideally if it obtained the yes/no value, then asked for the printer number.. it could use that data to execute only the correct command. Anyways, back at it.. so thanks so much for you assistance

This are the checks im adding in at the beginning:

If Not (@OSVersion == "WIN_2000") And Not (@OSVersion == "WIN_XP") Then

Exit

EndIf

; Exit immediately if running within Citrix

If FileExists("T:\WINNT\explorer.exe") Then

Exit

EndIf

If FileExists("y:\batch\nipp.exe") Then

; continue script

Else

MsgBox(48, "ATTENTION - Fatal Error", "Cannot locate Y:\Batch\nipp.exe." & @LF & @LF & "Please call the Help Desk x34357")

Exit

EndIf

Posted
i'm thinking I may need a second variable for the YES or NO option.

Another variable would not be required. Just add Else to the condition.

RUN ("Y:\BATCH\nipp.exe")

WinWaitActive("Novell iPrint Client Setup")
SEND ("!n")
; Delays the execution of the !F long enough for client to complete install
Opt("WinWaitDelay", 9000)

WinWaitActive("Novell iPrint Client Setup")
SEND ("!f")
; Need to add the variables ??
; Enter the numbers after RP in your printer name. (Example RP0004 would be 0004)
$name = InputBox('Select Printer name', 'Example: 0004', '0000')
If Not @error Then
  ; Would you like this to be your default printer, YES or NO
  If MsgBox(4 + 32, 'Set Default Printer', 'Would you like this to be your default printer') = 6 Then
      RUN ("C:\WINNT\SYSTEM32\iprntcmd.exe http://www.xxx.xxx/ipp/RP" & $name & " /add /default")
  Else
      RUN ("C:\WINNT\SYSTEM32\iprntcmd.exe http://www.xxx.xxx/ipp/RP" & $name & " /add")
  EndIf
EndIf

Good luck :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...