Search code examples
perlgui-testing

Win32::GuiTest - simulate Windows+E to start explorer


I am using Win32::GuiTest to automate some processes. When I needed to open the file explorer using Windows+E, I first tried SendKeys('{LWI}e');, SendKeys('{LWI}+e'); and SendKeys('{LWI}(e)'); yet without it doing what I wanted.

I was able to get what I needed with

SendRawKey(VK_LWIN , 0);
SendRawKey(ord('E'), 0);

SendRawKey(ord('E'), KEYEVENTF_KEYUP);
SendRawKey(VK_LWIN , KEYEVENTF_KEYUP);

Yet, I wondered if there is a less verbose way to achieve the same goal.


Solution

  • Interesting. I am not sure if there is any shorter way to do it, but, if all you want is an Explorer window, it might be sufficient to just use:

    system start => 'explorer';