Jump to content

Mapping To Drive GUI?


lyonrt
 Share

Recommended Posts

I am trying to get my GUI program to allow a user to map to a drive. The user on the network already has a username and password and its all he or she needs to enter in this program. After it is entered, I am trying to get the program to use the entered data to map to a drive as well as add "bc\" in front of the username so that it looks like this: "bc\usernamegoeshere" and the password in the password field below that. The drive that needs to be connected to is (also includes a dollar sign): \\phoenix\usernamegoeshere$

Please help. I attached the code and a screenshot.

-Thanks,

Tyler

#include <GuiConstants.au3>
#include <inet.au3>

GuiCreate("ResNet CD", 500, 600)


;************************************MENU***********************************************************

**
$filemenu = GuiCtrlCreateMenu("File")
$separator1 = GuiCtrlCreateMenuitem ("", $filemenu)
$fileitem = GuiCtrlCreateMenuitem ("Exit",$filemenu)

GuiCtrlCreateMenu("Options")

$helpmenu = GuiCtrlCreateMenu("Help")
$helpitem = GuiCtrlCreateMenuitem ("About",$helpmenu)

;************************************LABEL TOP*************************************************************
$Label = GUICtrlCreateLabel("Choose from the items below.",10,10)





;************************************ANTIVIRUS GROUP*************************************************************
GuiCtrlCreateGroup("Step 1 - Remove Virus(s)", 10, 30,260,100)
$STINGER = GUICtrlCreateButton("Run Stinger", 30, 50, 100, 50)
$AVG = GUICtrlCreateButton("Install AVG", 150, 50, 100, 50)
GUICtrlCreateGroup ("",-99,-99,1,1);close group




;************************************SPYWARE GROUP*************************************************************

GuiCtrlCreateGroup("Step 2 - Remove Spyware & Datamine(s)", 10, 150,260,100)
$SPYBOT = GUICtrlCreateButton("SpyBot Update or Install", 70,180,130,50)
GUICtrlCreateGroup ("",-99,-99,1,1);close group





;************************************OTHER APPS AND UPDATES*************************************************************

GuiCtrlCreateGroup("Step 3 - Misceleaneaous", 10, 270,260,100)
$SP2 = GUICtrlCreateButton("Service Pack 2", 30,300,100,50)
$ADAWARE = GUICtrlCreateButton("Adaware", 150, 300, 100, 50)
GUICtrlCreateGroup ("",-99,-99,1,1);close group


;************************************WINDOWS UPDATE*************************************************************

GuiCtrlCreateGroup("Step 4 - Windows Update", 10, 390,260,70)
$www = GUICtrlCreateLabel ("www.windowsupdate.com",30,419,140,15)
GuiCtrlSetColor($www,0x0000ff)
GuiCtrlSetCursor($www,0)
GUICtrlCreateGroup ("",-99,-99,1,1);close group


;************************************SYSTEM INFO*************************************************************
; GROUP: INPUT IP,ComputerName, MAC

GuiCtrlCreateGroup("System Info", 10, 482,480,70)

$LabelIP = GUICtrlCreateLabel("IP: " , 20, 500)
$PublicIP = @IPAddress1
GuiCtrlCreateInput(@IPAddress1, 40, 498, 95, 20)

$PublicNAME = @ComputerName

$LabelName = GUICtrlCreateLabel("Computer: ",140,500)
$PublicNAME = @ComputerName
GUICtrlCreateInput(@ComputerName,190,498,100,20)


$Warning = GUICtrlCreateLabel("***By Clicking On This Button You Agree That You Have Completed All Certification Steps*** ",20,530)
GuiCtrlSetColor($Warning,0x0000ff)

$MapDrive = GUICtrlCreateButton("Certify Me", 300,497,60,25)

GUICtrlCreateGroup ("",-99,-99,1,1);close group

;************************************RIGHT INFO PANEL*************************************************************

GuiCtrlCreateGroup("Please Follow Directions", 300, 10,190,320)




GUICtrlCreateGroup ("",-99,-99,1,1);close group


;************************************Right Student Drive Mapper*************************************************************
GuiCtrlCreateGroup("Map To Your Student Drive", 300, 340,190,140)

$Labellogin = GUICtrlCreateLabel("Username:",320,375)
$inputlogin= GUICtrlCreateInput("username",380,372,90,20)

$Labelpass = GUICtrlCreateLabel("Password:",320,415)
$inputlogin = GUICtrlCreateInput("********",380,412,90,20)

$MapDrive = GUICtrlCreateButton("Map Drive", 380,440,60,25)


GUICtrlCreateGroup ("",-99,-99,1,1);close group


;************************************FOOTER*********************************************************

****
$Labelfooter = GUICtrlCreateLabel("Created By Robert Tyler Lyon (c)2006  All Rights Reserved.",100,560)




GUISetState(); display the GUI

Do
    $msg = GUIGetMsg()
   
    Select
;************************************ABOUT BOX*************************************************************
;File Menu Below        
        Case $msg = $helpitem
            Msgbox(0,"About","Robert Tyler Lyon")

;************************************MENU FUNCTIONS*************************************************************
        
        Case $msg= $fileitem
            Exit

;************************************BUTTON FUNCTIONS*************************************************************

        Case $msg= $AVG
             Run("avg71free_375a691.exe")
        Case $msg= $STINGER
            Run("stinger_run.exe")
        Case $msg= $SPYBOT
            Run("Spybot_Install_or_run.exe")
        Case $msg= $SP2
            Run("WindowsXP-KB835935-SP2-ENU.exe")
        Case $msg= $ADAWARE
            Run("aawsepersonal.exe")
        
        Case $msg= $www
            Run(@ComSpec & " /c " & 'start www.windowsupdate.com', "", @SW_HIDE)


        
        Case $msg= $GUI_EVENT_CLOSE


            
    EndSelect
Until $msg = $GUI_EVENT_CLOSE

Posted Image

Link to comment
Share on other sites

You have $inputlogin twice! Its second declaration should be $inputpass or something

Case $msg = $MapDrive

    $username = GuiCtrlRead($inputlogin)
; Remove domain from username if user included it
    If StringLeft($username,3) = "bc\" Then $username= StringTrimLeft($username, 3)
    $password = GuiCtrlRead($inputpass)

    DriveMapAdd("X:", "\\phoenix\" & $username & "$", 8, "bc\" & $username, $password)

Case Else
Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Awesome help.... I made the changes but I cant get it to map.

; Try the following--make sure to put in the username and password--to see if you get an error....
$DriveLetter = "X:"
DriveMapDel($DriveLetter)
$result = DriveMapAdd($DriveLetter, "\\phoenix\someuser$", 8, "bc\someuser", 
"plaintextPassword")
MsgBox(0x1000, "error=" & @error, "result=" & $result)

If you still have problems and have Windows 200/XP, try the following from a command prompt

net use X: \\phoenix\theuser$ thePassword /USER:bc\theuser

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...