BlazeLondon Posted February 26, 2006 Share Posted February 26, 2006 im trying to split my script into two screens, first screen to allow you to browse folders on the local machine second screen to browse my network places So far on both screens all I can do is use this command $var = FileSelectFolder("Choose a folder !", "") And then this code on each screen to stop people being able to actually select items i dont want them to select. $drivetype = DriveGetType( $var ) if $drivetype = "Removable" Then It works but it would be nicer if on screen one I could only show local drives and on screen two only show my network places Is this possible by parsing a parameter to fileselectfolder to tell it what to display as a choice?? Link to comment Share on other sites More sharing options...
GaryFrost Posted February 26, 2006 Share Posted February 26, 2006 (edited) maybe something like this: expandcollapse popup#include <GUIConstants.au3> $gui_select = GUICreate("Select Folder", 359, 367) $lv_mapped = GUICtrlCreateListView("Mapped Drives", 32, 24, 121, 289) $var = DriveGetDrive( "NETWORK") If Not @error Then For $i = 1 To $var[0] GUICtrlCreateListViewItem($var[$i], $lv_mapped) Next EndIf $contextmenulv_mapped = GUICtrlCreateContextMenu($lv_mapped) $contextmenulv_mappeditem = GUICtrlCreateMenuItem("Choose a folder !", $contextmenulv_mapped) $lv_local = GUICtrlCreateListView("Local Drives", 192, 24, 121, 289) $var = DriveGetDrive( "FIXED") If Not @error Then For $i = 1 To $var[0] GUICtrlCreateListViewItem($var[$i], $lv_local) Next EndIf $contextmenulv_local = GUICtrlCreateContextMenu($lv_local) $contextmenulv_localitem = GUICtrlCreateMenuItem("Choose a folder !", $contextmenulv_local) $btn_ok = GUICtrlCreateButton("Ok", 136, 328, 65, 25, 0) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $btn_ok ExitLoop Case $msg = $contextmenulv_mappeditem If GUICtrlRead($lv_mapped) Then $var = FileSelectFolder("Choose a folder !", GUICtrlRead(GUICtrlRead($lv_mapped)) & "\") EndIf Case $msg = $contextmenulv_localitem If GUICtrlRead($lv_local) Then $var = FileSelectFolder("Choose a folder !", GUICtrlRead(GUICtrlRead($lv_local)) & "\") EndIf Case Else ;;;;;;; EndSelect WEnd Exit Edited February 26, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
BlazeLondon Posted February 26, 2006 Author Share Posted February 26, 2006 not really, more just like having the folder browse box appear but minus any network locations and vice versa being able to bring up the folder browse showing only Fixed type if this isnt possible easily i will just stay with the restrictions that throw up a message if the wrong type of drive is selected. one thing you may be able to help quickly with, im using this code to take $var which is \\nick\share\folder1\test\playtime to strip it down to this \\nick\share only problem is it strips it to this \\nick\share\ can i get this to strip the last "\" as well? $STR = StringSplit($var, "\") $var = StringTrimRight($var, StringLen($STR[$STR[0]])) Link to comment Share on other sites More sharing options...
GaryFrost Posted February 26, 2006 Share Posted February 26, 2006 (edited) not really, more just like having the folder browse box appear but minus any network locations and vice versa being able to bring up the folder browse showing only Fixed type if this isnt possible easily i will just stay with the restrictions that throw up a message if the wrong type of drive is selected. one thing you may be able to help quickly with, im using this code to take $var which is \\nick\share\folder1\test\playtime to strip it down to this \\nick\share only problem is it strips it to this \\nick\share\ can i get this to strip the last "\" as well? $STR = StringSplit($var, "\") $var = StringTrimRight($var, StringLen($STR[$STR[0]])) if your only wanting the first folder after the share then something like $var = StringSplit(StringTrimLeft("\\nick\share\folder1\test\playtime",2),"\") $var = "\\" & $var[1] & "\" & $var[2] MsgBox(0,"var",$var) Edited February 26, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
BlazeLondon Posted February 26, 2006 Author Share Posted February 26, 2006 if your only wanting the first folder after the share then something like $var = StringSplit(StringTrimLeft("\\nick\share\folder1\test\playtime",2),"\") $var = "\\" & $var[1] & "\" & $var[2] MsgBox(0,"var",$var) ahh! I seeee Thank ! You ! 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