Jump to content

How can i check gave directory is wright or not?in brows input.


Go to solution Solved by Melba23,

Recommended Posts

How can i check gave directory is wright or not?in browse input.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <process.au3>

$COMPANY_NAME = "HM-LINK" ; name of the pppoe icon, friendly description
$SERVICE_NAME = "HM" ; name of the pppoe service configured in NAS/Mikrotik
Local $font
$DELAY = 300
$frmInformation = GUICreate($COMPANY_NAME, 287, 230, 193, 115)
$btnOK = GUICtrlCreateButton("&GO!", 208, 200, 68, 25, 0)
$btnbrw = GUICtrlCreateButton("&Browse", 208, 164, 68, 25, 0)
$txtbrw = GUICtrlCreateInput("", 118, 164, 80, 21)
$lblbrw = GUICtrlCreateLabel("Select Icon:", 16, 169, 80, 17)
GUISetState(@SW_SHOW)
While 1
$uMsg = GUIGetMsg()
Switch $uMsg
Case $btnbrw
Local $message = "Hold down Ctrl or Shift to choose multiple files."

Local $var = FileOpenDialog($message, @WindowsDir & "\", "Icon (*.Ico;*.bmp)", 1 + 4)

If @error Then
MsgBox(0, "", "No Icon chosen")
Else
$var = StringReplace($var, "|", @CRLF)
EndIf
ControlSetText($COMPANY_NAME,"","[CLASS:Edit; ID:11]",$var)
Case $btnOK
$txtbrwr = GUICtrlRead($txtbrw)
If StringLen($txtbrwr)=0 Then
MsgBox(64,$COMPANY_NAME &" 03216592390","Please Choose Hm5 Icon.")
Else
$txtbrwr = GUICtrlRead($txtbrw)
ExitLoop
EndIf
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
GUISetState(@SW_HIDE)
Run("control ncpa.cpl")
Sleep($DELAY)
WinClose("Network Connections")
Edited by adnanbaloch

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Link to comment
Share on other sites

How can i check gave directory is wright or not? in browse input.

What do you mean by "is right or not"?

That the directory exists or that you have specific permissions (e.g. write) on the directory?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

What do you mean by "is right or not"?

That the directory exists or that you have specific permissions (e.g. write) on the directory?

I want to check that directory is exists or not>>>>A Gift of thanks For all..... Edited by adnanbaloch

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Link to comment
Share on other sites

Have you tried this search "get directory permissions"

Yes i tried it. But it could not help me..........

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Link to comment
Share on other sites

  • Moderators

adnanbaloch,

I want to check that directory is exists or not

If this is the directory returned from FileOpenDialog then the directory must exist if it is chosen from the tree. If you allow the user to enter a filepath and name in the dialog input field, then you can ensure the path (and even file) exists by using the "options flag - you can also ask for the file and path to be created if they do not exist. ;)

I hope that amswers your question. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Melba23 if the User Browse and find icon for softwhere from FileOpenDialog than it cannot create problem. but when someone type location in dialog input field than it can be go wrong.Therefore i need a command line that can check directory is exists or not, or how can i stope User to type directory in dialog input field?

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Link to comment
Share on other sites

  • Moderators
  • Solution

adnanbaloch,

Read what I said in my post above:

If you allow the user to enter a filepath and name in the dialog input field, then you can ensure the path (and even file) exists by using the "options flag

And look at the FileOpenDialog page in the Help file:

options

[optional] Dialog Options: To use more than one option, add the required values together.
  1 = File Must Exist (if user types a filename)
  2 = Path Must Exist (if user types a path, ending with a backslash)
  4 = Allow MultiSelect
  8 = Prompt to Create New File (if does not exist)

So using 1 + 2 will prevent the user from manually entering a non-existent path/filename - using 8 will create the file if it does not exist. It sounds as though you want the former. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...