Jump to content

_EnterSetName issues...


Recommended Posts

Good day,
In a similar manner as that of a previous posting entitled, "FileSelectFolder Issues", I am having a similar issue here...though possibly...in reverse!?

Here is the script:

; -----------------------------------------------
#include <MsgBoxConstants.au3>
; -----------------------------------------------
Opt("MustDeclareVars", 1)
; -----------------------------------------------
Global $g_SetName = ""
; -----------------------------------------------
_EnterSetName()
_DoesFolderExist()
; -----------------------------------------------
Func _EnterSetName()
    $g_SetName = InputBox("Notice!", "Enter the Type_# Set_Name...", "", " M", 200, 130)
    ConsoleWrite("1st: $g_SetName= " & $g_SetName & @CRLF)
    ; -----------------
    If @error Then
        MsgBox($MB_ICONWARNING, "Notice!", "The operation was cancelled. Exiting!")
        Exit
    Else
        _DoesFolderExist()
    EndIf
EndFunc   ;==>_EnterSetName
; -----------------------------------------------
Func _DoesFolderExist()
    Local $_DoesFolderExist = FileExists($g_SetName)
    Local $_sTypeFolder = StringMid($g_SetName, 10, 6)
    Local $_sSubFolder = StringMid($g_SetName, 17)
    ; -----------------------------------------------
    If $_DoesFolderExist Then
        ; This will never occur, thus the sole purpose of _EnterSetName()
        ;MsgBox($MB_TOPMOST, "Success!", "The [" & $_sTypeFolder & "] subfolder [" & $_sSubFolder & "] already exists!")
    Else
        _CreateFolder()
    EndIf
EndFunc   ;==>_DoesFolderExist
; -----------------------------------------------
Func _CreateFolder()
    MsgBox($MB_TOPMOST, "NOTICE!", "Made it to _CreateFolder!")
EndFunc   ;==>_CreateFolder
; -----------------------------------------------

The issue:
As with the FileSelectFolder Issues, the path must always consist of the following: F:\Audio\TypeName\SetName.
However, I found that it IS possible, for me to enter F:\Audio\TypeName - which is an error, and yet the script continues.
The very same anomaly occurs if I happen to enter: F:\Audio\TypeName\SetName\wav - which is also an error!

As can be observed, after the path has been entered, the _DoesFolderExist function is called...and I would assume that it would be within this function that all of the necessary error trapping would occur?!

Thus, I require the "ways-and-means" of being able to trap these errors before continuing on with the _CreateFolder() function.

Any assistance in this matter would be greatly appreciated!

UPDATE!!!
It is not so much that the SetName folder exists, but rather, that the path is correct!! I do hope that this makes sense?

 

Edited by mr-es335
Added Update!!
Link to comment
Share on other sites

hello mr-es335;

i did read your topic and i did understand little bit so what you did say that you want to:

Thus, I require the "ways-and-means" of being able to trap these errors before continuing on with the _CreateFolder() function.

 

here is my solution for you:

Func _DoesFolderExist()
    Local $_DoesFolderExist = FileExists($g_SetName)
    Local $_sTypeFolder = StringMid($g_SetName, 10, 6)
    Local $_sSubFolder = StringMid($g_SetName, 17)
    ; -----------------------------------------------
    If $_DoesFolderExist Then
        ; This will never occur, thus the sole purpose of _EnterSetName()
        ;MsgBox($MB_TOPMOST, "Success!", "The [" & $_sTypeFolder & "] subfolder [" & $_sSubFolder & "] already exists!")
    Else
     _beforeProc()
        _CreateFolder()
    EndIf
EndFunc   ;==>_DoesFolderExist
; -----------------------------------------------
Func _beforeProc()
    ;type here your script
EndFunc

 

iam ِAutoit programmer.

best thing in life is to use your Brain to

Achieve

everything you want.

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   2 members

×
×
  • Create New...