Restoring focus to an explorer window doesn't quite work?

Get help with using AutoHotkey and its commands and hotkeys
Posts: 1
Joined: 24 Jan 2019, 19:23

Restoring focus to an explorer window doesn't quite work?

24 Jan 2019, 19:38

I've created a script which copies a file (image) from the current Explorer Window into Word - it works fine (I've removed a lot of error checking for demo purposes) - but it only works once.

Script is

Code: Select all

SetTitleMatchMode, 2
SetTitleMatchMode, slow
WinGetTitle, Title, A ; store the current Window title
clipboard = ; clear Clipboard
Send ^c ; copy the current file
WinActivate, Word ; Switch to Word
Send ^v{Down} ; paste the file and move down 1 line
WinActivate, %Title% ; return to the original Window
Send {Right} ; move one file right 
First time you use it, the image is copied into Word and you're returned to the Explorer Window with the next file selected - which is great!

However, if you attempt to run the macro again (or even just Ctrl-C) - Windows "Bongs" as if you're not focussed on anything!?

If you click the mouse you can then repeat the script AOK - adding a 'Click' to the script makes no difference tho, so it's clearly not that simple...

What am I missing here?


Return to “Ask For Help”

Who is online

Users browsing this forum: Chunjee and 115 guests