Jump to content

Recommended Posts

Posted

Friends,

A script I am working on calls a commandline utility called lpr.exe. It allows sending files to a printer with an IP address.

My script needs to work on both 32 and 64 bit systems.

on my 64 bit system, the only LPR.exe is a 64 bit app, and if I use a command such as

RunWait(@ComSpec & " /K lpr.exe -S " & $IPAddress & " -P strict " & $FileName, @ScriptDir)

I get an error in the command window telling me there is no lpr.exe command.

If I compile my script in 64 bits, it works fine.

But then of course that script wouldn't work on a 32 bit system.

I could use kludges, such as installing a "lpr32.exe" copied from a 32 bit system on a 64 bit system, and compile the script in 32 bits, or I could even have a 64 and a 32 bit version of the same script. But then, many of my users have no idea if their system is a 32 or 64 bit one, and I'm trying to keep things simple.

Is there a way to use RunWait or something similar in such a way that a 64 bit cmd.exe would be called from a 32-bit compiled script? I kind of doubt that, but someone out there might dream up a way...

Thanks

  • Moderators
Posted

Hi, rodent1. Look in the helpfile for @OSArch. You could add an If statement..

If @OSArch = "X64" Then
RunWait(@ComSpec & " /K lpr.exe -S " & $IPAddress & " -P strict " & $FileName, @ScriptDir)
Else
RunWait(@ComSpec & " /K lpr.exe -S " & $IPAddress & " -P strict " & $FileName, @ScriptDir)
EndIf

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

Aipion,

Sorry I didn't reply sooner. Monday was a holiday, and I didn't have access to the code till this morning.

that worked like a charm!

Thanks!

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
×
×
  • Create New...