Jump to content

Open File Dialog Box to select a file to pass into script


Recommended Posts

I am new to autoit, but so far i really like it. Here is what i am trying to do.

I have multiple .cab files out on the network, each one contains a different set of settings/drivers for the "printmig" tool that microsoft has. I want to have a dialog box open up and let the technician pick the file to pass into the script. I've looked through the help file, but am not finding anything to point me in the right direction.

$PMap = DriveMapGet ("Z:")
If $PMap = "" Then
    Else
    MsgBox(0,"A mapping was detected on Z:",$PMap,2)
EndIf

MsgBox(0,"Removing Existing Mapping",$PMap,1)
DriveMapDel ("Z:")
MsgBox(0,"Mapping Printer Migration Location","\\Server_name\Shared\PMig",1)
DriveMapAdd("Z:","\\server_ip\Shared\PMig",0,"domain\user","password")

$folder="Z:\printer\printmig.exe"
IF FileExists($folder) Then
    msgbox (0,"Printer tool Found","Proper files found on the network",1)
Else
    msgbox (0,"Printer tool not found","Please validate network connectivity - printer tool not detected",1)
    exit
EndIf

$BLD = InputBox ("Enter Building or Department", "Enter a file descriptor for the log file")

MsgBox(0, "Saving Current printer settings","Backing up current configuration to the network",1)

If $SystemRoot = "C:\WINNT" Then
    RunWait(@COMSPEC & " /c c:\winnt\System32\cscript.exe Z:\printer\prnmngr.vbs -l > Z:\"& $BLD &"_%computername%.txt")
Else   
    RunWait(@COMSPEC & " /c c:\windows\System32\cscript.exe Z:\printer\prnmngr.vbs -l > Z:\"& $BLD &"_%computername%.txt")
EndIf

RunWait(@COMSPEC & " /c Z:\printer\printmig.exe -b Z:\"& $BLD &"_%computername%.cab")

MsgBox(0,"Removing all Printers","Please wait - Uninstalling local printers",1)

If $SystemRoot = "C:\WINNT" Then
    RunWait(@COMSPEC & " /c c:\winnt\System32\cscript.exe Z:\printer\prnmngr.vbs -x")
Else   
    RunWait(@COMSPEC & " /c c:\windows\System32\cscript.exe Z:\printer\prnmngr.vbs -x")
EndIf

MsgBox(0,"Installing New Printer Settings","New printer configuration being installed",1)

RunWait(@COMSPEC & " /c Z:\printer\printmig.exe -r Z:\printer\myprinters.cab -o")

DriveMapDel ("Z:")
MsgBox(0,"Restoring Previous Mapping",$PMap,1)
DriveMapAdd("Z:",$PMap)

MsgBox(0,"Migration Completed","You may need to reboot to see the new printers")

exit
Link to comment
Share on other sites

  • Developers

how do i pass the selection to the script though?

What did the Helpfile tell you about that question?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...