- Try this, although I would advise using it with caution, and I would avoid using such a script.
- (I would rename files manually, or use an AHK script for complicated renaming: Loop File and FileMove. Also, I use timestamps in file names to avoid name collisions: FormatTime and SendInput.)
- To test properly: uncomment the ControlSend line and comment out the SoundPlay line.
Code: Select all
;clicks Yes every time an Explorer 'Rename File' dialog appears
OnRenameFileDlg(hWinEventHook, vEvent, hWnd)
{
local
;EVENT_OBJECT_SHOW := 0x8002
static vFunc := "OnRenameFileDlg", _ := DllCall("user32\SetWinEventHook", UInt,0x8002, UInt,0x8002, Ptr,0, Ptr,RegisterCallback(vFunc), UInt,0, UInt,0, UInt,0, Ptr)
WinGetTitle, vWinTitle, % "ahk_id " hWnd
if !(vWinTitle = "Rename File")
return
WinGet, vPName, ProcessName, % "ahk_id " hWnd
if !(vPName = "explorer.exe")
return
SoundPlay, *64
;ControlSend, Button1, y, % "ahk_id " hWnd
}