Jump to content
Sign in to follow this  

I have the script, but need a function

Recommended Posts


Hi, i have scripted a little program that should help my users to connect to different networkshares with they domain user/password from a local user account.

But since i have several shares they can choose between, i want this script as a function... but i'm not so familiar with that. Can someone help me out?

case $msg = $networkshare1
        $ES_PASSWORD = 0x0020

        GUICreate("Logg inn", 230,100)

        $domainUser = GUICtrlCreateInput("",65,15,160,17)
        $domainpassword = GUICtrlCreateInput("",65,40,160,17,$ES_PASSWORD)
        $Login = GUICtrlCreateButton("Logg på",5,65,190)


        while 1
            $msg = GUIGetMsg()
                Case $msg = $Login
                _RunDOS("net use z: /delete /yes > nul")
                _RunDOS("net use z: \\server.domain.com\path " & GUICtrlRead($domainpassword) & " /USER:domain\" & GUICtrlRead($domainUser))
                MsgBox(64,$MsgTitle, "Kobler til z:\networkshare1 ",2) 
                Case $msg = $GUI_EVENT_CLOSE

Share this post

Link to post
Share on other sites

Hi lansti,

you could use one GUI and display a radio-button group where your users can choose the network share.

Then when you the $login button has been pressed, you could check for the state of the radio-buttons.

Check the helpfile for GUICtrlCreateRadio on how to create a radio-button (group).

You could create a function called _mapShare($share, $user, $password, $driveletter)

Func  _mapShare($share, $user, $password, $driveletter)
Edited by Hannes123

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post

Link to post
Share on other sites

An alternative to Hannes123 solution: you can always use a combobox to let the users select from the list.

Radio button OR Combobox = works for only 1 element at a time.

If you want the users to get acces to more than one share with a button press - consider using checkboxes for every share.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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