Dobson980

Autoit & Powershell

2 posts in this topic

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?

Share this post


Link to post
Share on other sites



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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
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