srikanthreddy29

how to create GUI window for connecting network file share and adding in the list box

7 posts in this topic

Hi,

I'm new to Script.

-want to create GUI window,it should have drop down list.
-want to add network folder path and save in the list
and.should have  connect button,and it should connect to specified  n/w path using windows credentials.
 
-Tell now i just created GUI window,Below is the script i tried.Want to know how to enable add button for network path and connect to it.
 
#include <GUIConstantsEx.au3>
#include <GuiListBox.au3>
#include <MsgBoxConstants.au3>
Main()
Func Main()
 
Local $iGUIWidth = 600, $iGUIHeight = 500
Local$Add
Local $idListBox,$Add,$Connect
GUICreate("New GUI", $iGUIWidth, $iGUIHeight)
$idListBox = GUICtrlCreateList("List", 10, 10, 400, 200)
$Connect = GUICtrlCreateButton("Connect", 500, 10, 70, 25)
$Add = GUICtrlCreateButton("Add", 500, 40, 70, 25)
 
GUISetState(@SW_SHOW)
 
; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
 
        EndSwitch
    WEnd
EndFunc
 

Share this post


Link to post
Share on other sites



srikanthreddy29,

Welcome to the AutoIt forum. :)

But please pay attention to where you post - the "Dev Chat" section where you started this thread is not for general support questions. I have moved it for you, but would ask you to be more careful in future. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

i once made a simple GUI to connect to predefined network shares:

post-47848-0-07006300-1425387414_thumb.p

the shares are hard-coded in the script, but you can easily have them stored in a text file, and customize the GUI as you see fit. i used a list instead of a combo because it allows for multiple selection.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ListviewConstants.au3>
#include <EditConstants.au3>

; init application data
Dim $aServers[4][3] ; columns: server name | LVitem ControlID | drive letter
$aServers[0][0]=3
$aServers[1][0]='server1\share'
$aServers[2][0]='server2\share'
$aServers[3][0]='server3\share'
$aServers[1][2]='X:'
$aServers[2][2]='Y:'
$aServers[3][2]='Z:'

Global $sUserName=''
Global $sPassword=''

; init GUI-related data
Global Const $GUI_W=400
Global Const $GUI_H=300
Global $msg=0

; buid GUI
GUICreate("Connect to External Servers",$GUI_W,$GUI_H)
GUISetBkColor(0x444444)
$gServers=GUICtrlCreateListView('Drive|Server',10,10,$GUI_W-20,$GUI_H-120,Default,$LVS_EX_CHECKBOXES)
GUICtrlCreateLabel('User Name:',50,$GUI_H-100+2)
GUICtrlSetColor(-1,0xFFFFFF)
GUICtrlCreateLabel('Password:',50,$GUI_H-70-2)
GUICtrlSetColor(-1,0xFFFFFF)
$gUserName=GUICtrlCreateInput('',110,$GUI_H-103+2,$GUI_W-220,20)
$gPassword=GUICtrlCreateInput('',110,$GUI_H-73-2,$GUI_W-220,20,BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
For $i=1 To $aServers[0][0]
    $aServers[$i][1]=GUICtrlCreateListViewItem($aServers[$i][2]&'|'&$aServers[$i][0],$gServers)
Next
$gButtonOK=GUICtrlCreateButton('Connect',110,$GUI_H-40,$GUI_W-220,30)
GUICtrlSetState($gButtonOK,$GUI_DEFBUTTON)
GUISetState()

; main function
Do
    $msg=GUIGetMsg()
    If $msg=$gButtonOK Then
        $sUserName='EXTERNALDOMAIN\'&GUICtrlRead($gUserName)
        $sPassword=GUICtrlRead($gPassword)
        For $i=1 To $aServers[0][0]
            If BitAND(GUICtrlRead($aServers[$i][1],1),$GUI_CHECKED) Then DriveMapAdd($aServers[$i][2],$aServers[$i][0],Default,$sUserName,$sPassword)
        Next
        Exit
    EndIf
Until $msg=$GUI_EVENT_CLOSE
Edited by orbs

Share this post


Link to post
Share on other sites

how can i add and save the network share path

-when ever i connect to any of the share path,windows should open up without mapping to drive letter.

-I already have access to all the paths,so my windows login works with out user name and pwd window.

Share this post


Link to post
Share on other sites

do you need anything else done except opening a shared folder? if not, it sounds like you do not need a script or GUI at all - just put a few shortcuts on your desktop.

Share this post


Link to post
Share on other sites

Actually i'm looking for GUI window,which i can add share folder path names in the list and when ever i need i should connect to selected path by clicking connect button.
-I'm nt sure wht function should i add to connect.

I attached the screen shot.

Basically i'm looking to add all the network share path in the list,which i have access .so that i can connect easily. 

post-38870-0-42308900-1425533848_thumb.p

Share this post


Link to post
Share on other sites

Hey orbs ...can u help me...

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