Sign in to follow this  
Followers 0
cheeseslice

help with drivemapdel() please

3 posts in this topic

hi,

i have had a read through the posts but i can't seem to find an answer to my problem. i am trying to map a network drive but i am having real problems if the user has already logged on before.

#include <GuiConstants.au3>

GuiCreate("Network Drive Access", 215, 300)



GUICtrlCreateLabel("Name of Shared Drive",45,20,190,20)
GUICtrlCreateLabel("IP Address",45,70,190,20)
GUICtrlCreateLabel("Drive Letter",45,120,190,20)
GUICtrlCreateLabel("Username",45,170,190,20)
GUICtrlCreateLabel("Password",45,220,190,20)


$share=GuiCtrlCreateInput("", 45, 40, 120, 20)
$ip=GUICtrlCreateInput("10.131.132.107", 45, 90, 120, 20)
$drive=GUICtrlCreateInput("k:", 45, 140, 120, 20)
$username=GUICtrlCreateInput("",45,190,120,20)
$password=GUICtrlCreateInput("",45,240,120,20,$ES_PASSWORD)

$mapButton=GUICtrlCreateButton("Map Network Drive", 15,270,120,20)
$exitButton=GUICtrlCreateButton("Exit", 150,270,50,20)

GuiSetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $mapButton
            call("mapDrive")
        Case $msg = $exitButton
            Exit
    EndSelect
Wend

func mapDrive()
driveMapDel($drive)
DriveMapAdd(GUICtrlRead($drive),"\\"&GUICtrlRead($ip)&"\"&GUICtrlRead($share),1,GUICtrlRead($username),GUICtrlRead($password))
Exit

EndFunc

this works perfectly as long as it is the first time it is run, i can't seem to get drivemapdel() to get rid of the connetions if i want to log onto a different folder on the same NAS device.

any suggestions please?

Share this post


Link to post
Share on other sites



#include <GuiConstants.au3>
driveMapDel($drive)
DriveMapAdd(GUICtrlRead($drive),"\\"&GUICtrlRead($ip)&"\"&GUICtrlRead($share),1,GUICtrlRead($username),GUICtrlRead($password))

any suggestions please?

The error is right there, the funny thing is that you make the error in DriveMapDel but not in DriveMapAdd :whistle:

To be more specific, change driveMapDel($drive) to driveMapDel(GUICtrlRead($drive)) and you should be all set.

(You need to unmap the contents of the $drive label, but the ControlID to it... :P)


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

The error is right there, the funny thing is that you make the error in DriveMapDel but not in DriveMapAdd :whistle:

To be more specific, change driveMapDel($drive) to driveMapDel(GUICtrlRead($drive)) and you should be all set.

(You need to unmap the contents of the $drive label, but the ControlID to it... :P)

Can't see the forest for the trees!

Thanks for that.

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
Sign in to follow this  
Followers 0