Jump to content

Autoit & Powershell


Dobson980
 Share

Recommended Posts

Hello,

I'm working on a tool for some basic printer installations. I have a general idea of how I want to accomplish this within Powershell. I am having difficulties invoking these commands via autoit. A powershell script is not applicable here. Below is basically what the end goal is:

 

Invoke-Command {pnputil.exe -a "driverpath/file.inf"}
Add-PrinterDriver -Name "SHARP MX-4140N PCL6"
Get-PrinterDriver -Name "SHARP MX-4140N PCL6"
Add-PrinterPort -Name "PSOCE2S" -PrinterHostAddress "PSOCE2S"
Add-Printer -Name "PSOCE2S" -PortName "PSOCE2S" -DriverName "SHARP MX-4140N PCL6"

 

I tried this sort of approach without much luck:

Run("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe")
WinWaitActive("C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe")
send('Invoke-Command {pnputil.exe -a "driverpath\file.inf"}' & "{ENTER}")

... without much luck. Is there a better way to go about this?

Link to comment
Share on other sites

  • Moderators

You say a powershell is not applicable, does this mean you want to do it natively in AutoIt? If so, do a forum search for the Printers UDF.

"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!

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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