appleaday3k Posted March 4, 2006 Share Posted March 4, 2006 I am new to coding and want to make a simple app that asks for user name and password then maps a drive based on that info. I am close to getting it but i don't know enough to fix my app. Any help would be great. ; Script generated by AutoBuilder 0.5 Prototype #include <GuiConstants.au3> If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 GuiCreate("MyGUI", 392, 316,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Input_1 = "$user" $Input_2 = "$pass" $Input_1 = GuiCtrlCreateInput("username", 90, 110, 230, 30) $Input_2 = GuiCtrlCreateInput("password", 90, 170, 230, 30) $Button_3 = GuiCtrlCreateButton("Submit", 290, 260, 70, 30) GUICtrlSetOnEvent($Button_3, "OKPressed") GuiSetState() While 1 Sleep(10) WEnd exit Func OKPressed() $MapReturn = DriveMapAdd("Z:", "\\server\folder", 1, "domain\$user", "$pass") EndFunc Func SpecialEvents() If @GUI_CTRLID = $GUI_EVENT_CLOSE Then Exit EndFunc Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted March 4, 2006 Share Posted March 4, 2006 (edited) doesnt give me any errors... try this out And your putting your variables in quotes to make it simpler #include <GuiConstants.au3> GuiCreate("MyGUI", 392, 316,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $user = GuiCtrlCreateInput("username", 90, 110, 230, 30) $pass = GuiCtrlCreateInput("password", 90, 170, 230, 30) $Button_3 = GuiCtrlCreateButton("Submit", 290, 260, 70, 30) Do $msg = GUIGetMsg () Select Case $msg = $Button_3 $MapReturn = DriveMapAdd("Z:", "\\server\folder", 1, "domain\" & $user, $pass) EndSelect Until $msg = $GUI_EVENT_CLOSE Edited March 4, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
appleaday3k Posted March 4, 2006 Author Share Posted March 4, 2006 Thanks for the help! I did a little editing but when i hit the submit, i get nothing? #include <GuiConstants.au3> GuiCreate("MyGUI", 392, 316,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $user = GuiCtrlCreateInput("username", 90, 110, 230, 30) $pass = GuiCtrlCreateInput("password", 90, 170, 230, 30) $Button_3 = GuiCtrlCreateButton("Submit", 290, 260, 70, 30) Do $msg = GUIGetMsg () Select Case $msg = $Button_3 $MapReturn = DriveMapAdd("Z:", "\\computername\sharename", 0, "Domain\" & $user, $pass) EndSelect Until $msg = $GUI_EVENT_CLOSE Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted March 4, 2006 Share Posted March 4, 2006 that is because you didnt supply a computername drive sharenmae or domain u must do all that, cuz idk what ur comp name and all that stuff is u got to get it urself Link to comment Share on other sites More sharing options...
appleaday3k Posted March 4, 2006 Author Share Posted March 4, 2006 that is because you didnt supply a computername drive sharenmae or domain u must do all that, cuz idk what ur comp name and all that stuff is u got to get it urselfnono i did i just took it out. It's strange, =/If there is a delay in when it sends the request to connect to the share and the request for the username and password will it mess it up? Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted March 4, 2006 Share Posted March 4, 2006 (edited) WOW AM I STUPID OR WHAT I FORGOT THE GUICTRLREADS HOLY CRAP AHHAHA #include <GuiConstants.au3> GuiCreate("MyGUI", 392, 316,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $user = GuiCtrlCreateInput("username", 90, 110, 230, 30) $pass = GuiCtrlCreateInput("password", 90, 170, 230, 30) $Button_3 = GuiCtrlCreateButton("Submit", 290, 260, 70, 30) Do $msg = GUIGetMsg () Select Case $msg = $Button_3 $MapReturn = DriveMapAdd("Z:", "\\computername\sharename", 0, "Domain\" & Guictrlread($user), Guictrlread($pass)) EndSelect Until $msg = $GUI_EVENT_CLOSE Edited March 4, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
appleaday3k Posted March 4, 2006 Author Share Posted March 4, 2006 aaaa you almost had me there.. still hangs at submit. can the password box handle: 1234567890!@#$%^&*()A-Z? Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted March 4, 2006 Share Posted March 4, 2006 (edited) yes im pretty sure it can, try this it will give you a number and check the help file for the error your getting When the function fails (returns 0) @error contains extended information: 1 = Undefined / Other error 2 = Access to the remote share was denied 3 = The device is already assigned 4 = Invalid device name 5 = Invalid remote share 6 = Invalid password use the new one changed the msgbox to MsgBox (0, 'Title', $MapReturn) #include <GuiConstants.au3> GuiCreate("MyGUI", 392, 316,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $user = GuiCtrlCreateInput("username", 90, 110, 230, 30) $pass = GuiCtrlCreateInput("password", 90, 170, 230, 30) $Button_3 = GuiCtrlCreateButton("Submit", 290, 260, 70, 30) Do $msg = GUIGetMsg () Select Case $msg = $Button_3 $MapReturn = DriveMapAdd("Z:", "\\computername\sharename", 0, "Domain\" & Guictrlread($user), Guictrlread($pass)) if @error Then MsgBox(0, 'Title', $MapReturn) endif EndSelect Until $msg = $GUI_EVENT_CLOSE Edited March 4, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
appleaday3k Posted March 4, 2006 Author Share Posted March 4, 2006 when i hit the submit with that one, the app stays open, and no error pops up! I checked my computer and i dont have a Z: drive Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted March 4, 2006 Share Posted March 4, 2006 (edited) could i ask what you are even trying to do?, add a drive? Edited March 4, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
appleaday3k Posted March 4, 2006 Author Share Posted March 4, 2006 (edited) could i ask what you are even trying to do?, add a drive?correct. have it add a drive then open a app on that drive then wait till the app closes then disconnectdisconnect is not needed. I think it should be simple to make it pop open a exe after i get the mapped drive up Edited March 4, 2006 by appleaday3k Link to comment Share on other sites More sharing options...
appleaday3k Posted March 4, 2006 Author Share Posted March 4, 2006 Any comments on this one? #include <GuiConstants.au3> GuiCreate("MyGUI", 392, 316,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $user = GuiCtrlCreateInput("username", 90, 110, 230, 30) $pass = GuiCtrlCreateInput("password", 90, 170, 230, 30) $Button_3 = GuiCtrlCreateButton("Submit", 290, 260, 70, 30) Do $msg = GUIGetMsg () Select Case $msg = $Button_3 _RunDOS("net use Z: \\ComputerName\Share /USER:Domain\" & $user & \ & $pass) EndSelect Until $msg = $GUI_EVENT_CLOSE I think i am close Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now