; #NoTrayIcon ; скрыть иконку в трее HotKeySet("{F2}", "_Rename") ; переименование файлов не затрагивая расширение HotKeySet("{F9}", "_CreateFT") ; создаём папку $CrTx="{F10}" HotKeySet($CrTx, "_CreateFT") ; создаём файл текстовый HotKeySet('!{ESC}', "_Quit") ;по желанию выход по ALT+ESC $langdef = RegRead("HKCU\Keyboard Layout\Preload", "1") ; читаем язык по умолчанию While 1 Sleep(20) WEnd Func _Rename() HotKeySet("{F2}"); prevent infinite loop gotcha Send("{F2}") If (_WinGetClass(WinGetTitle('')) = "CabinetWClass") Or (_WinGetClass(WinGetTitle('')) = "Progman") Then $oldClipboard = ClipGet() Sleep(100) Send("^{insert}") $sFilename = ClipGet() $iExtPosition = StringInStr($sFilename, ".", 0, -1) If $iExtPosition <> 0 Then $iPosition = StringLen($sFilename) - $iExtPosition+1 $i = 0 Do Send("+{LEFT}") $i += 1 Until $i = $iPosition Send("{SHIFTDOWN}{SHIFTUP}") EndIf ClipPut($oldClipboard) EndIf HotKeySet("{F2}", "_Rename"); re-enable hotkey EndFunc Func _WinGetClass($hWnd) ; credit = SmOke_N from post http://www.autoitscript.com/forum/index.php?showtopic=41622&view=findpost&p=309799 If IsHWnd($hWnd) = 0 And WinExists($hWnd) Then $hWnd = WinGetHandle($hWnd) Local $aGCNDLL = DllCall('User32.dll', 'int', 'GetClassName', 'hwnd', $hWnd, 'str', '', 'int', 4095) If @error = 0 Then Return $aGCNDLL[2] Return SetError(1, 0, '') EndFunc Func _CreateFT() $window=WinGetTitle('') If $window <> "" And $window <> "Program Manager" And StringRight(_ProcessGetPath(WinGetProcess($window)), 13)='\explorer.exe' Then $adrPath= ControlGetText ( $window, '', "[CLASS:Edit; INSTANCE:1]") $win_handle = WinGetHandle ($window) _SetKeyboardLayout("00000419", $win_handle) Send("!{ф}") Sleep(100) Send("{а}") If @HotKeyPressed=$CrTx Then Send("{т}") ; текстовый документ _Rename() Else Send("{п}") ; папка EndIf _SetKeyboardLayout($langdef, $win_handle) ; возвращаем язык по умолчанию EndIf EndFunc ;извлечь путь процесса зная PID Func _ProcessGetPath($PID) If IsString($PID) Then $PID = ProcessExists($PID) $Path = DllStructCreate('char[1000]') $dll = DllOpen('Kernel32.dll') $handle1 = DllCall($dll, 'int', 'OpenProcess', 'dword', 0x0400 + 0x0010, 'int', 0, 'dword', $PID) $ret = DllCall('Psapi.dll', 'long', 'GetModuleFileNameEx', 'long', $handle1[0], 'int', 0, 'ptr', DllStructGetPtr($Path), 'long', DllStructGetSize($Path)) $ret = DllCall($dll, 'int', 'CloseHandle', 'hwnd', $handle1[0]) DllClose($dll) Return DllStructGetData($Path, 1) EndFunc ;==>_ProcessGetPath Func _SetKeyboardLayout($sLayoutID, $hWnd) Local $ret = DllCall("user32.dll", "long", "LoadKeyboardLayout", "str", $sLayoutID, "int", 0) DllCall("user32.dll", "int", "SendMessage", "hwnd", $hWnd, "int", 0x50, "int", 1, "int", $ret[0]) EndFunc Func _Quit() Exit EndFunc |