| | #1 (permalink) |
| Autoit İle Yazılmış Yeni Klasör Uygulaması Güzel bi örnek ufkunuzu açar ![]() Kod: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; AutoIt Version: 3.1.1.0 ;;
;; ;;
;; Template AutoIt script. ;;
;; ;;
;; AUTHOR: TheSaint <thsaint@ihug.com.au> ;;
;; ;;
;; SCRIPT FUNCTION: Create folder/s in the active folder/window ;;
;; ;;
;; THANKS: To Uten (Class Idea, advice), Jon & team (AutoIt), Forum ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#include <GUIConstants.au3>
Dim $Button_C, $Button_D, $Button_F, $Button_g, $Button_i, $Button_r, $Button_s, $Button_x
Dim $Checkbox1, $Checkbox2, $Checkbox3, $Combo1
Dim $Form1, $Group1, $Group2, $Group3, $Group4, $Input1, $Input2, $Input3
;
Dim $icoC, $icoI, $icoX, $icofle, $shell, $user
;
Dim $auth, $class, $comb, $desk, $favs, $handle, $hot, $i, $inifle, $keep, $key, $name, $names, $new
Dim $path, $pthnm, $res, $scriptname, $shtcut, $shtfld, $tit, $top, $wins
$shell = @SystemDir & "\shell32.dll"
$user = "User.exe"
$icoX = 6
$icofle = $user
If StringLeft(@OSVersion, 5) = "WIN_9" Or @OSVersion = "WIN_ME" Then
; This is unconfirmed for WIN_95
;$class = "CabinetWClass"
ElseIf @OSVersion = "WIN_2000" Then
;$class = "ExploreWClass"
Else ; WIN_NT4, WIN_XP, WIN_2003
; This is only confirmed for WIN_XP
;$class = "CabinetWClass"
$user = "User32.dll"
$icofle = $shell
$icoX = 27
EndIf
$inifle = @ScriptDir & "\Options.ini"
$auth = " - © TheSaint (July 2006)"
$scriptname = "New Folders v1.1"
GetActiveWindow()
If $pthnm <> "" Then
CreateDialog()
EndIf
Exit
; Dialog Function
Func CreateDialog()
$width = 500
$height = 335
; == GUI generated with Koda ==
$Form1 = GUICreate($scriptname & $auth, $width, $height, _
(@DesktopWidth-$width)/2, (@DesktopHeight-$height-30)/2, -1, $WS_EX_TOPMOST)
;CONTROLS
$Group1 = GUICtrlCreateGroup("Current Path", 16, 16, 465, 65)
$Input1 = GUICtrlCreateInput("", 32, 40, 380, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetState($Input1, $GUI_DISABLE)
$Button_F = GUICtrlCreateButton("Refresh", 420, 40, 45, 20)
GUICtrlSetFont($Button_F, 7, 400)
GUICtrlSetTip($Button_F, "Refresh the path!")
;
$Group2 = GUICtrlCreateGroup("New Folder Name/s", 16, 96, 369, 65)
$Input2 = GUICtrlCreateInput("", 32, 120, 305, 21, -1, $WS_EX_CLIENTEDGE)
$Button_D = GUICtrlCreateButton("C", 344, 120, 20, 20, $BS_ICON)
GUICtrlSetTip($Button_D, "Delete Text!")
;
$Button_C = GUICtrlCreateButton("CREATE", 400, 102, 81, 59, $BS_DEFPUSHBUTTON)
GUICtrlSetFont($Button_C, 8, 800, 0, "MS Sans Serif")
GUICtrlSetTip($Button_C, "Create folder/s!")
;
$Checkbox1 = GUICtrlCreateCheckbox("Keep Open", 16, 184, 81, 25)
GUICtrlSetTip($Checkbox1, "Keep the program open after creating folder/s!")
$Checkbox2 = GUICtrlCreateCheckbox("Keep On Top", 120, 184, 89, 25)
GUICtrlSetTip($Checkbox2, "Keep the program on top of all other windows!")
$Checkbox3 = GUICtrlCreateCheckbox("If no folder open, then use Desktop", 16, 216, 193, 25)
GUICtrlSetTip($Checkbox3, "Default to the desktop, if no folder open!")
;
$Group3 = GUICtrlCreateGroup("Hotkey", 232, 184, 105, 57)
GUICtrlCreateLabel("Ctrl + Alt +", 248, 208, 52, 17)
$Input3 = GUICtrlCreateInput("", 300, 206, 17, 21, -1, $WS_EX_CLIENTEDGE)
;
$Button_i = GUICtrlCreateButton("Info", 360, 184, 49, 57, $BS_ICON)
GUICtrlSetTip($Button_i, "Program Information!")
$Button_x = GUICtrlCreateButton("EXIT", 432, 184, 49, 57, $BS_ICON)
GUICtrlSetTip($Button_x, "Close the program!")
;
$Group4 = GUICtrlCreateGroup("Favourites", 16, 256, 465, 62)
$Combo1 = GUICtrlCreateCombo("", 32, 280, 217, 100, $WS_VSCROLL + $CBS_SORT + $CBS_DROPDOWN)
GUICtrlSetTip($Combo1, "Select a favourite!")
$Button_g = GUICtrlCreateButton("Get", 271, 280, 40, 20)
GUICtrlSetTip($Button_g, "Get text from the New Folder Name/s!")
$Button_s = GUICtrlCreateButton("Store", 331, 280, 45, 20)
GUICtrlSetTip($Button_s, "Store the current favourite!")
$Button_r = GUICtrlCreateButton("Remove", 396, 280, 65, 20)
GUICtrlSetTip($Button_r, "Remove the current favourite!")
; SETTINGS
$icoI = 4
$icoD = 31
GUICtrlSetImage($Button_D, $shell, $icoD, 0)
GUICtrlSetImage($Button_i, $user, $icoI, 1)
GUICtrlSetImage($Button_x, $icofle, $icoX, 1)
;
GUICtrlSetData($Input1, $pthnm)
;
$keep = IniRead($inifle, "Keep Open", "program", "")
If $keep = "" Then
$keep = 1
IniWrite($inifle, "Keep Open", "program", $keep)
EndIf
GUICtrlSetState($Checkbox1, $keep)
;
$top = IniRead($inifle, "Keep On Top", "program", "")
If $top = "" Then
$top = 4
IniWrite($inifle, "Keep On Top", "program", $top)
EndIf
If $top = 1 Then
WinSetOnTop($scriptname, "", 1)
ElseIf $top = 4 Then
WinSetOnTop($scriptname, "", 0)
EndIf
GUICtrlSetState($Checkbox2, $top)
;
$favs = IniRead($inifle, "Favourites", "names", "")
If $favs = "" Then
$favs = "|"
IniWrite($inifle, "Favourites", "names", $favs)
EndIf
$name = IniRead($inifle, "Favourites", "name", "")
GUICtrlSetData($Combo1, $favs, $name)
;
$desk = IniRead($inifle, "Default To", "desktop", "")
If $desk = "" Then
$desk = 4
IniWrite($inifle, "Default To", "desktop", $desk)
EndIf
GUICtrlSetState($Checkbox3, $desk)
;
$hot = IniRead($inifle, "Hotkey", "key", "")
If $hot <> "" Then GUICtrlSetData($Input3, $hot)
GUISetState(@SW_SHOW)
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
; QUIT / CLOSE / EXIT
ExitLoop
Case $msg = $Button_x
; QUIT / CLOSE / EXIT
HotkeyCheck()
GUIDelete()
ExitLoop
Case $msg = $Button_s
; Store currently selected combo entry
$comb = GUICtrlRead($Combo1)
If $comb <> "" Then
$favs = IniRead($inifle, "Favourites", "names", "")
If StringInStr($favs, "|" & $comb & "|") < 1 Then
$favs = $favs & $comb & "|"
IniWrite($inifle, "Favourites", "names", $favs)
GUICtrlSetData($Combo1, "")
GUICtrlSetData($Combo1, $favs, $comb)
EndIf
EndIf
Case $msg = $Button_r
; Remove currently selected combo entry
$comb = GUICtrlRead($Combo1)
If $comb <> "" Then
$favs = IniRead($inifle, "Favourites", "names", "")
If StringInStr($favs, "|" & $comb & "|") > 0 Then
$favs = StringReplace($favs, "|" & $comb & "|", "|")
IniWrite($inifle, "Favourites", "names", $favs)
GUICtrlSetData($Combo1, "")
GUICtrlSetData($Combo1, $favs, "")
IniWrite($inifle, "Favourites", "name", "")
EndIf
EndIf
Case $msg = $Button_i
; Program Information
MsgBox(262208, "Program Information", _
"The new folder/s will be created within the current path." & @LF & @LF & _
"Use backslashes to create any sub-folders, i.e." & @LF & _
" New Folder\sub-folder\etc" & @LF & _
"Use pipes (|) to create multiple folders, i.e." & @LF & _
" New Folder 1|New Folder 2|New Folder 3|etc" & @LF & _
"Pipes & Backslashes can be combined, i.e." & @LF & _
" New Folder 1\sub-folder\etc|New Folder 2|etc" & @LF & @LF & _
"If you want to store a favourite, then use the 'Get'" & @LF & _
"button to retrieve the text in the 'New Folder Name'" & @LF & _
"textbox, or manually type an entry into the combo" & @LF & _
"box for favorites. Then use the 'Store' button." & @LF & @LF & _
"To remove a favorite, select it's entry in the combo" & @LF & _
"box, then use the 'Remove' button." & @LF & @LF & _
"If text is entered/changed in the 'Hotkey' textbox," & @LF & _
"then the program settings will be updated on exit." & @LF & _
"(Ctrl + Alt + F is probably a good choice!)" & @LF & @LF & _
"If you want the program to close immediately after" & @LF & _
"creating folder/s, then de-select 'Keep Open'." & @LF & @LF & _
"Thanks to - Jon & team, Uten, others at Forum." & @LF & @LF & _
"(Created using the amazing & free - AutoIt v3" & @CRLF & _
"programming language!)")
Case $msg = $Button_g
; Get current name from input 2 for combo
$name = GUICtrlRead($Input2)
GUICtrlSetData($Combo1, "")
GUICtrlSetData($Combo1, $favs & $name, $name)
Case $msg = $Button_F
; Refresh the current path
WinSetState($scriptname, "", @SW_HIDE)
GetActiveWindow()
GUICtrlSetData($Input1, $pthnm)
;MsgBox(262144, "New Path", $pthnm)
WinSetState($scriptname, "", @SW_SHOW)
Case $msg = $Button_D
; Delete Text
GUICtrlSetData($Input2, "")
Case $msg = $Button_C
; CREATE FOLDER/S
$name = GUICtrlRead($Input2)
If $name <> "" Then
CheckForIllegals()
If StringInStr($name, "|") > 0 Then
$names = StringSplit($name, "|")
For $i = 1 To $names[0]
$res = DirCreate($pthnm & "\" & $names[$i])
If $res = 0 Then
MsgBox(262160, "Creation Error", "The folder -" & @LF _
& $pthnm & "\" & $names[$i] & @LF _
& "could not be created!")
EndIf
Next
Else
$res = DirCreate($pthnm & "\" & $name)
If $res = 0 Then MsgBox(262160, "Creation Error", "Directory could not be created!")
EndIf
EndIf
If $keep <> 1 Then
GUIDelete()
ExitLoop
EndIf
Case $msg = $Checkbox3
; If no folder open, then use Desktop folder as current
If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then
$desk = 1
Else
$desk = 4
EndIf
IniWrite($inifle, "Default To", "desktop", $desk)
Case $msg = $Checkbox2
; Keep Program On Top of other windows
If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then
$top = 1
WinSetOnTop($scriptname, "", 1)
Else
$top = 4
WinSetOnTop($scriptname, "", 0)
EndIf
IniWrite($inifle, "Keep On Top", "program", $top)
Case $msg = $Checkbox1
; Keep program open
If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
$keep = 1
Else
$keep = 4
EndIf
IniWrite($inifle, "Keep Open", "program", $keep)
Case $msg = $Combo1
; Select a favourite folder name
$comb = GUICtrlRead($Combo1)
If $comb <> "" Then
$name = GUICtrlRead($Input2)
If $name <> "" Then $name = $name & "\"
$name = $name & $comb
IniWrite($inifle, "Favourites", "name", $name)
GUICtrlSetData($Input2, $name)
EndIf
Case Else
;;;;;;;
EndSelect
WEnd
EndFunc ; => CreateDialog
Func CheckForIllegals()
$name = StringReplace($name, "<", " ")
$name = StringReplace($name, ">", " ")
$name = StringReplace($name, "/", " ")
$name = StringReplace($name, ":", " ")
$name = StringReplace($name, "?", " ")
$name = StringReplace($name, '"', " ")
$name = StringReplace($name, "*", " ")
EndFunc ; => CheckForIllegals
Func GetActiveWindow()
opt("WinTitleMatchMode", 4)
$tit = ""
$wins = WinList()
For $i = 1 to $wins[0][0]
; Only display visible windows that have a title
If $wins[$i][0] <> "" AND IsActive($wins[$i][1]) Then
If WinActive("classname=CabinetWClass") Or WinActive("classname=ExploreWClass") _
Or WinActive("classname=Progman") Then
$tit = $wins[$i][0]
$hnd = $wins[$i][1]
;MsgBox(262144, "Text read was:", $tit)
ExitLoop
EndIf
EndIf
Next
;
$desk = IniRead($inifle, "Default To", "desktop", "")
If $desk = "" Then $desk = 1
;
If $tit <> "" Then
;$path = ControlGetText($tit, "", "Edit1")
$path = ControlGetText($hnd, "", "Edit1")
Else
; No active window
$path = ""
EndIf
;MsgBox(262144, "Text read was:", $path)
;opt("WinTitleMatchMode", 4)
If WinActive("classname=CabinetWClass") Or WinActive("classname=ExploreWClass") Then
If $path <> "" Then
If StringMid($path, 2, 1) = ":" Then
$pthnm = $path
ElseIf $path = "My Documents" Then
; This could be incorrect if folder settings are wrong, and this represents
; a folder named the same, but is not actually the default My Documents folder
$pthnm = @MyDocumentsDir
ElseIf $path = "Desktop" Then
; This could be incorrect if folder settings are wrong, and this represents
; a folder named the same, but is not actually the default Desktop folder
$pthnm = @DesktopDir
ElseIf $path = "My Computer" Or $path = "My Network Places" Or $path = "Recycle Bin" Then
; Thess could be incorrect if folder settings are wrong, and any of these represent
; a folder named the same, but is not actually that default Desktop location
MsgBox(262160, "Folder Path Error", "This is not a folder, you must select a folder!" & @LF & _
$path)
Else
MsgBox(262160, "Folder Path Error", _
"The path for the currently active folder, cannot be obtained" & @LF & _
"because your 'Folder Options' settings do not have -" & @LF & _
"'display the full path in the address bar' selected." & @LF & _
"To fully utilise this program, that setting must be changed." & @LF & @LF & _
"To change this setting, open any folder window, select the" & @LF & _
"'Tools' menu, select 'Folder Options', select the 'View' tab," & @LF & _
"then enable (put a tick in the checkbox of) the right item.")
EndIf
Else
If $desk = 1 Then $pthnm = @DesktopDir
EndIf
ElseIf WinActive("classname=Progman") Or $tit = "" Then
; This value is confirmed for 98, ME & XP
If $desk = 1 Then $pthnm = @DesktopDir
Else
MsgBox(262160, "Folder Path Error", "A program needs to be minimised, for the" & @LF & _
"active folder window to be recognised, i.e." & @LF & @LF & _
$tit)
EndIf
EndFunc ; => GetActiveWindow
Func HotkeyCheck()
$hot = IniRead($inifle, "Hotkey", "key", "")
$new = GUICtrlRead($Input3)
If $hot <> $new Then
IniWrite($inifle, "Hotkey", "key", $new)
$key = "^!" & StringLower($new)
;MsgBox(262160, "Hotkey", $key)
HotkeySettings()
EndIf
EndFunc ; => HotkeyCheck
Func HotkeySettings()
$shtfld = @ProgramsDir & "\Tools\New Folders"
$shtcut = $shtfld & "\New Folders.lnk"
If FileExists($shtfld) <> 1 Then
DirCreate($shtfld)
EndIf
FileCreateShortcut(@ScriptFullPath, $shtcut, @ScriptDir, "", "Create new folders!", @ScriptFullPath, $key, "0")
EndFunc ; => HotkeySettings
Func IsActive($handle)
If BitAnd(WinGetState($handle), 8) Then
If BitAnd(WinGetState($handle), 16) Then
Return 0
Else
Return 1
EndIf
Else
Return 0
EndIf
EndFunc ; => IsActive
__________________ ![]() ![]() Asker Olmuşuz !!! | |
| | |
| | #2 (permalink) | |||||||||
| Senior Member ![]() Üyelik tarihi: Aug 2007
Mesajlar: 4.232
Uye No:166
![]() ![]() ![]() ![]() ]Paylasım: 1609 / 1788 | ellerine sağlık !!
__________________ βєn SαdєÂ¢є Sєηĩ "Ħєр Sєηĩ" Sєטdĩм.. derman@vuslat.info !! ![]() Kendini Billmez Dengesiz Insanlara En Güzel Cevap Susmaktir.. Aklımla kötümserim İrademle iyimser ... | |||||||||
| | |
![]() |
| Seçenekler | |
| Stil | |
| |