Sign in to follow this  
Followers 0
Silvinho

Create directory from the Inputbox

4 posts in this topic

I need do the following When the user execute autoit is going to an inputbox appear with the following question:

"type the month", after the user type February is going to be created the following directory: c :\Fevereiro, then, it, is going to, appear, other, , msg, , asking, :

" type the week?", the user types: "week 07" it will be created the following dir: c:\Fevereiro\Semana 07

Share this post


Link to post
Share on other sites



I need do the following When the user execute autoit is going to an inputbox appear with the following question:

"type the month", after the user type February is going to be created the following directory: c :\Fevereiro, then, it, is going to, appear, other, , msg, , asking, :

" type the week?", the user types: "week 07" it will be created the following dir: c:\Fevereiro\Semana 07

Try this:

#include <Date.au3>

Dim $CurMon

Switch @MON
Case 01
    $CurMon = "January"
Case 02
    $CurMon = "February"
Case 03
    $CurMon = "March"
Case 04
    $CurMon = "April"
Case 05
    $CurMon = "May"
Case 06
    $CurMon = "June"
Case 07
    $CurMon = "July"
Case 08
    $CurMon = "August"
Case 09
    $CurMon = "September"
Case 10
    $CurMon = "October"
Case 11
    $CurMon = "November"
Case 12
    $CurMon = "December"
EndSwitch

Do
    $GetMonth = InputBox("Message", "Please type the month", $CurMon)
Until $GetMonth = $CurMon

DirCreate("c:\" & $GetMonth)

Do
    $GetWeek = InputBox("Message", "Please type the week", _WeekNumberISO())
Until $GetWeek = _WeekNumberISO()

DirCreate("c:\" & $GetMonth &"\"& $GetWeek)

:)

Share this post


Link to post
Share on other sites

Hi,

#include <GUIConstants.au3>

Global $EnMonth = "January|Febuary|March|April|May|June|July|August|September|October|November|December"
Global $BrMonth = "Janeiro|Fevereiro|Março|Abril|Maio|Junho|Julho|Agost|Setembro|Outubro|Novembro|Dezembro"
Global $mDir, $wDir

$Gui = GUICreate("Select Month & Week", 355, 30)
$Drive = GUICtrlCreateLabel(@HomeDrive & "\", 5, 10, 20, 15) 
$Month = GUICtrlCreateCombo("Select Month", 30, 5, 100, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, $EnMonth, "Select Month")
$Week = GUICtrlCreateCombo("", 150, 5, 100, 20, BitOR($WS_VSCROLL, $CBS_DROPDOWNLIST))
GUICtrlSetData(-1, _Week(), "Select Week")
GUICtrlCreateLabel("\", 135, 10, 10, 15)
$Create = GUICtrlCreateButton("Create Directory", 255, 5, 95, 20)
GUISetState(@SW_SHOW, $Gui)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Month
            If GUICtrlRead($Month) <> "Select Month" Then
                Local $EM = StringSplit($EnMonth, "|"), $MM = StringSplit($BrMonth, "|")
                For $i = 1 To $EM[0]
                    If GUICtrlRead($Month) = $EM[$i] Then $mDir = $MM[$i]
                Next
            Else
                $mDir = ""
            EndIf   
        Case $Week
            If GUICtrlRead($Week) <> "Select Week" Then 
                $wDir = StringReplace(GUICtrlRead($Week), "Week", "Semana", 1)
            Else
                $wDir = ""
            EndIf   
        Case $Create
            If $mDir <> "" And $wDir <> "" And DirCreate(@HomeDrive & "\" & $mDir & "\" & $wDir) Then 
                ShellExecute("explorer.exe", "/e," & @HomeDrive & "\" & $mDir & "\" & $wDir)
            EndIf    
    EndSwitch
WEnd

Func _Week()
    Local $iWeek = "Select Week" & "|"
    For $i = 1 To 52
        $iWeek &= "Week " & StringFormat("%02i", $i) & "|"
    Next    
    Return StrinGTrimRight($iWeek, 1)
EndFunc

Cheers

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi, your welcome.

I know this isn't exactly what you asked, but since your providing no code to work with then try this.

#include <GUIConstants.au3>

Global $EnMonth = "January|Febuary|March|April|May|June|July|August|September|October|November|December"
Global $BrMonth = "Janeiro|Fevereiro|Março|Abril|Maio|Junho|Julho|Agost|Setembro|Outubro|Novembro|Dezembro"
Global $mDir, $wDir, $psDir = "PS", $aDir = "\Artefato Inspected\", $pcDir = "PCC" 

$Gui = GUICreate("Select Month & Week & MIG# & PS & PCC", 665, 30)
$Drive = GUICtrlCreateLabel(@HomeDrive & "\", 5, 10, 20, 15)
$Month = GUICtrlCreateCombo("Select Month", 30, 5, 100, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, $EnMonth, "Select Month")

GUICtrlCreateLabel("\", 135, 10, 10, 15)
$Week = GUICtrlCreateCombo("", 150, 5, 100, 20, BitOR($WS_VSCROLL, $CBS_DROPDOWNLIST))
GUICtrlSetData(-1, _Week(), "Select Week")

GUICtrlCreateLabel("\MIG", 255, 10, 25, 15)
$Mig = GUICtrlCreateInput(41328, 285, 5, 45, 20, $ES_NUMBER)

GUICtrlCreateLabel("\", 335, 10, 15, 15)
$Ps = GUICtrlCreateCombo($psDir, 350, 5, 45, 20, BitOR($WS_VSCROLL, $CBS_DROPDOWNLIST))

GUICtrlCreateLabel($aDir, 400, 10, 100, 15)
$PCC = GUICtrlCreateCombo("", 505, 5, 50, 20, BitOR($WS_VSCROLL, $CBS_DROPDOWNLIST))
GUICtrlSetData(-1, "PCC|IPU|ECP|PST|PC|PSF|INV|EES", "PCC")

$Create = GUICtrlCreateButton("Create Directory", 565, 5, 95, 20)
GUISetState(@SW_SHOW, $Gui)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Month
            If GUICtrlRead($Month) <> "Select Month" Then
                Local $EM = StringSplit($EnMonth, "|"), $MM = StringSplit($BrMonth, "|")
                For $i = 1 To $EM[0]
                    If GUICtrlRead($Month) = $EM[$i] Then $mDir = $MM[$i]
                Next
            Else
                $mDir = ""
            EndIf   
        Case $Week
            If GUICtrlRead($Week) <> "Select Week" Then
                $wDir = StringReplace(GUICtrlRead($Week), "Week", "Semana", 1)
            Else
                $wDir = ""
            EndIf
        Case $Ps
            If GUICtrlRead($Ps) <> $psDir Then $psDir = GUICtrlRead($Ps)
        Case $PCC
            If GUICtrlRead($PCC) <> $pcDir Then $pcDir = GUICtrlRead($PCC)
        Case $Create
            GUICtrlRead($Mig)
            If $mDir <> "" And $wDir <> "" And GUICtrlRead($Mig) <> "" And DirCreate(@HomeDrive & _
                                                                                    "\" & $mDir & "\" & _
                                                                                    $wDir & "\MIG " & _
                                                                                    GUICtrlRead($Mig) & _
                                                                                    "\" & $psDir & _
                                                                                    $aDir & $pcDir) Then
                ShellExecute("explorer.exe", "/e," & @HomeDrive & "\" & $mDir & "\" & $wDir & "\MIG " & _
                                                                    GUICtrlRead($Mig) & "\" & $psDir & _
                                                                    "\Artefato Inspected\" & $pcDir)
            EndIf   
    EndSwitch
WEnd

Func _Week()
    Local $iWeek = "Select Week" & "|"
    For $i = 1 To 52
        $iWeek &= "Week " & StringFormat("%02i", $i) & "|"
    Next   
    Return StrinGTrimRight($iWeek, 1)
EndFunc

Cheers

Edited by smashly

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  
Followers 0