Xichael Posted October 27, 2009 Share Posted October 27, 2009 Here are a few examples of this being done in AutoHotkey: http://lifehacker.com/355580/mimic-vistas-file-rename-feature-in-xp http://www.donationcoder.com/Software/Skrommel/TheEnd/TheEnd.ahk Could someone here make this happen in AutoIt? I'm clueless in this regard. Since I already have a multipurpose AutoIt script running, I'd rather have this function pasted in there, than have a whole other program running... Thanks! Link to comment Share on other sites More sharing options...
exodius Posted October 27, 2009 Share Posted October 27, 2009 Looking at this code (Oh my God this is a ridiculous language): #IfWinActive ahk_class CabinetWClass ~F2:: Gosub, AnalyzeRename return #IfWinActive ahk_class Progman ~F2:: Gosub, AnalyzeRename return #IfWinActive AnalyzeRename: OldClipboard = %Clipboard% sleep 100 Send, ^c StringGetPos,ExtensionPos, Clipboard,.,R if (ExtensionPos != -1) { Position := StrLen(Clipboard) - ExtensionPos Send, +{Left %Position%} } Clipboard = %OldClipboard% return These are the functions you're going to want to use (pretty much in this order) HotKeySet ClipGet Sleep Send StringInStr (be sure to set Occurrence to -1) StringLeft Send ClipPut Give it a try and post what you come up with. Is there a reason why (like one of the commentors in that first link said) you don't use "Hide extensions for known file types." ? Link to comment Share on other sites More sharing options...
ame1011 Posted October 27, 2009 Share Posted October 27, 2009 #include <file.au3> $file = "C:\hello.txt" $new_name = "test" Local $szDrive, $szDir, $szFName, $szExt Local $filepath = _PathSplit($file, $szDrive, $szDir, $szFName, $szExt) ConsoleWrite($szDrive & $szDir & $new_name & $szExt & @CRLF) [font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font] Link to comment Share on other sites More sharing options...
rajeshontheweb Posted October 27, 2009 Share Posted October 27, 2009 (edited) hmm, one thing is that i leave the hide known extensions unchecked, i like to know all the files.... in some cases i have liked this extension being kept intact if possible, which i felt was nice to see in windows vista, but i thought we had it in autoit already. this essentially involves monitoring selection , then listing file name, then use something like _pathsplit() described above then change the selection with area less the extension Edited October 27, 2009 by rajeshontheweb Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet Link to comment Share on other sites More sharing options...
ProgAndy Posted October 27, 2009 Share Posted October 27, 2009 Here: http://www.autoitscript.com/forum/index.php?showtopic=88903&view=findpost&p=638874 *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Xichael Posted October 27, 2009 Author Share Posted October 27, 2009 (edited) Here: #638874 Thanks ProgAndy! It works like a charm. Now, how to get it incorporated into my current always-on script? I've tried, and failed... I'll post it here, if someone more adept than I would care to figure out how to get ProgAndy's script working inside of it: expandcollapse popup#NoTrayIcon HotKeySet("#x", "MonitorOff") HotKeySet("#v", "ToggleWaveVolume") HotKeySet("#h", "ToggleHiddenFiles") Opt("WinTitleMatchMode", 4) ;For MonitorOff Global $LastWaveVolume = 0 ;For ToggleWaveVolume Global $LastFileState = 0 ;For ToggleHiddenFiles While 1 Sleep(50) WEnd ;===============MonitorOff================ Func MonitorOff() Sleep(500) Local $HWND = WinGetHandle("classname=Progman") Local $WM_SYSCommand = 274 Local $SC_MonitorPower = 61808 DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", $SC_MonitorPower, "int", 2) EndFunc ;=============ToggleWaveVolume=============== Func ToggleWaveVolume() If $LastWaveVolume = 0 Or $LastWaveVolume = 1 Then WaveVolumeDown() $LastWaveVolume = 2 Else WaveVolumeUp() $LastWaveVolume = 1 EndIf EndFunc Func WaveVolumeDown() Run("sndvol32.exe") WinWaitActive("Volume Control", "Volume Control") Send("{TAB}") Sleep(100) Send("{TAB}") Sleep(100) Send("{TAB}") Sleep(100) Send("{TAB}") Sleep(100) Send("{END}") Send("{UP 40}") Sleep(200) Send("!{F4}") EndFunc Func WaveVolumeUp() Run("sndvol32.exe") WinWaitActive("Volume Control", "Volume Control") Send("{TAB}") Sleep(100) Send("{TAB}") Sleep(100) Send("{TAB}") Sleep(100) Send("{TAB}") Sleep(100) Send("{HOME}") Sleep(200) Send("!{F4}") EndFunc ;==============ToggleHiddenFiles=============== Func ToggleHiddenFiles() If $LastFileState = 0 Or $LastFileState = 1 Then ShowFiles() $LastFileState = 2 Else HideFiles() $LastFileState = 1 EndIf EndFunc Func ShowFiles() Run("control folders") WinWaitActive("Folder Options") Send("^{TAB}") Sleep(300) Send("{TAB}") Send("{DOWN 10}") Send("{SPACE}") Send("{DOWN 2}") Send("{SPACE}") WinWaitActive("Warning") Send("{LEFT}") Send("{ENTER}") WinWaitActive("Folder Options") Send("{TAB 2}") Send("{ENTER}") EndFunc Func HideFiles() Run("control folders") WinWaitActive("Folder Options") Send("^{TAB}") Sleep(300) Send("{TAB}") Send("{DOWN 9}") Send("{SPACE}") Send("{DOWN 3}") Send("{SPACE}") Send("{TAB 2}") Send("{ENTER}") EndFunc ***EDIT*** I just noticed that ProgAndy's script prevents explorer windows from being closed via a double-click on the icon in the top left corner (my preferred way of closing windows)... I'll try some of the other scripts in that thread, unless someone can come up with a fix for ProgAndy's script. Edited October 27, 2009 by Xichael Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now