Jump to content

Autoit Yeni Klasör Oluşturma (Hotkey)


unquiet
 Share

Recommended Posts

Autoit te belirlenen bit klavye kısayolu ile kullanıcının komutu gönderdiği dizinde yeni klasör nasıl oluşturulur. Örneğin Win 7 deki shift + ctrl + N
komutu gibi xp ve vista da bunu autoit ile nasıl yapabiliriz!! Edited by unquiet
Link to comment
Share on other sites

@unquiet

Bir örnek hazırladım, denersin...

[codebox]HotKeySet("+^n", "_Blue_Create_NewFolder") ;Shift-Ctrl-n
While 1
Sleep(100) ;Cpu Save
WEnd

Func _Blue_Create_NewFolder()
Local $WinGetActive = WinGetHandle("[active]") ;Active Title
;Local $WinGetActive = WinGetHandle("System (C:)")
Local $DesktopHwnd = WinGetHandle("[Class:Progman]")
If $DesktopHwnd = $WinGetActive Then
If _CreateNewFolder(@DesktopDir) = 0 Then Return SetError(3, 0, 0)
Return 1
EndIf
; -----------
Local $Window_Location
Local $oShell = ObjCreate("shell.application") ; Get the Windows Shell Object
Local $oShellWindows = $oShell.windows ; Get the collection of open shell Windows

If IsObj($oShellWindows) = 0 Then Return SetError(1, 0, 0)
For $Window In $oShellWindows ; Count all existing shell windows
If $Window.hwnd = $WinGetActive Then
$Window_Location = $Window.LocationURL
$aRet = DllCall('shlwapi.dll', 'long', 'PathCreateFromUrlW', 'wstr', $Window_Location, 'wstr', '', 'dword*', 65534, 'dword', 0)
If Not @error And $aRet[0] = 0 Then $Window_Location = $aRet[2]
ExitLoop
EndIf
Next
If $Window_Location = "" Or FileExists($Window_Location) = 0 Then Return SetError(2, 0, 0)
If _CreateNewFolder($Window_Location) = 0 Then Return SetError(3, 0, 0)
Return 1
EndFunc ;==>_Blue_Create_NewFolder


Func _CreateNewFolder($Location, $FolderName = "Yeni Klasör")
If StringRight($Location, 1) <> "\" Then $Location &= "\"

Local $OldFolderName = $FolderName, $I = 1
While FileExists($Location & $FolderName)
$FolderName = $OldFolderName & " (" & $I & ")"
$I += 1
WEnd
If DirCreate($Location & $FolderName) = 0 Then Return SetError(1, 0, 0)
Return 1
EndFunc ;==>_CreateNewFolder
[/codebox]

Link to comment
Share on other sites

[quote name='blue_life' date='20 February 2012 - 11:05 ' timestamp='1329728731' post='1157789']
@unquiet

Bir örnek hazırladım, denersin...

[codebox]HotKeySet("+^n", "_Blue_Create_NewFolder") ;Shift-Ctrl-n
While 1
Sleep(100) ;Cpu Save
WEnd

Func _Blue_Create_NewFolder()
Local $WinGetActive = WinGetHandle("[active]") ;Active Title
;Local $WinGetActive = WinGetHandle("System (C:)")
Local $DesktopHwnd = WinGetHandle("[Class:Progman]")
If $DesktopHwnd = $WinGetActive Then
If _CreateNewFolder(@DesktopDir) = 0 Then Return SetError(3, 0, 0)
Return 1
EndIf
; -----------
Local $Window_Location
Local $oShell = ObjCreate("shell.application") ; Get the Windows Shell Object
Local $oShellWindows = $oShell.windows ; Get the collection of open shell Windows

If IsObj($oShellWindows) = 0 Then Return SetError(1, 0, 0)
For $Window In $oShellWindows ; Count all existing shell windows
If $Window.hwnd = $WinGetActive Then
$Window_Location = $Window.LocationURL
$aRet = DllCall('shlwapi.dll', 'long', 'PathCreateFromUrlW', 'wstr', $Window_Location, 'wstr', '', 'dword*', 65534, 'dword', 0)
If Not @error And $aRet[0] = 0 Then $Window_Location = $aRet[2]
ExitLoop
EndIf
Next
If $Window_Location = "" Or FileExists($Window_Location) = 0 Then Return SetError(2, 0, 0)
If _CreateNewFolder($Window_Location) = 0 Then Return SetError(3, 0, 0)
Return 1
EndFunc ;==>_Blue_Create_NewFolder


Func _CreateNewFolder($Location, $FolderName = "Yeni Klasör")
If StringRight($Location, 1) <> "\" Then $Location &= "\"

Local $OldFolderName = $FolderName, $I = 1
While FileExists($Location & $FolderName)
$FolderName = $OldFolderName & " (" & $I & ")"
$I += 1
WEnd
If DirCreate($Location & $FolderName) = 0 Then Return SetError(1, 0, 0)
Return 1
EndFunc ;==>_CreateNewFolder
[/codebox]
[/quote]

Çok Teşekkür Ederim @blue_life uzun süredir uğraşıyordum :dribble:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...