Jump to content

Recommended Posts

Posted (edited)

Hello,

Windows 10

latest AutoIt (v3.3.14.5)

I use @HotKeyPressed to open folders fine, but Win+W does not work.

Any ideas why it does not work?

I won't put all my script here, not necessary I think. But here's an example of what does not work:

        Case @HotKeyPressed = "#w"
            ShellExecute("C:\Program Files")


Whereas something like this works fine:

        Case @HotKeyPressed = "#]"
            ShellExecute("C:\Program Files")


Is there something about "#w" that is used by Windows system perhaps?

I think I disabled all Win keys in some policies settings many months ago or something like that,

so that I could use AutoIt to open folders rather than having to work with Windows winkey combinations.

Basically some Win key combinations I can use fine as in examples above, but some do not work.

Thanks for any ideas about why it appears that AutoIt may not be catching the "#w".

Edited by frew
Posted

Key WIN+w is reserved by Windows Whiteboard.

It is always a good idea to check return code of hotkeyset()

Here my solution:

_HotKey("+{ESC}")
_HotKey("#w")
Func _HotKey($hotkey = "")
;       ! ALT  + SHIFT  ^ CONTROL  # WinKey
    Switch @HotKeyPressed
        Case "+{ESC}" ; Shift + ESC to exit
            Exit 0*MsgBox(64 + 262144, Default, "Exit", 1)
        Case "#w"    ; occupied by Windows 10 Whiteboard
            Beep()
        Case Else
            If Not IsDeclared("hotkey") Then Return MsgBox(16 + 262144, Default, "No CASE statement defined for hotkey " & @HotKeyPressed)
            If HotKeySet($hotkey, "_Hotkey") = 0 Then Return MsgBox(16 + 262144, Default, "Hotkey " & $hotkey & " invalid or set by another application.")
    EndSwitch
EndFunc   ;==>_HotKey

While Sleep(100)     ; here should be your application.
WEnd                 ; meanwhile, here is a dummy loop.

 

App: Au3toCmd              UDF: _SingleScript()                             

Posted
9 hours ago, Exit said:
Quote

Key WIN+w is reserved by Windows Whiteboard.

Interesting, I did not know about any Whiteboard.

Not sure what that is.

So I guess I'll just stop trying to use Win+W in ways that I wish to use it.

I appreciate the script you present.

I'm still pretty simplistic in my scripting, but I'll check to see how your script works.

Here's an example of where I'm at with my scripts for opening folders at this time:
 

;this shows basically what I'm interested in at this point with this kind of script

;I make simple scripts like this sometimes, to help me open folders faster,
;it works, but may not have some elements I'm not familiar with yet

#include <Misc.au3>;not sure why this is needed, but script does not work without it


HotKeySet("#1", "_UDF1") ;C:\
HotKeySet("#2", "_UDF1") ;C:\Program Files

Func _UDF1()
    While _IsPressed("10") Or _IsPressed("11") Or _IsPressed("12");somebody at forum showed me this years ago, still not sure why it's needed
        Sleep(50)
    WEnd

    Select
        Case @HotKeyPressed = "#1"
            ShellExecute("C:\")
        Case @HotKeyPressed = "#2"
            ShellExecute("C:\Program Files")

    EndSelect

EndFunc   ;==>_UDF1

 

 

Posted
1 hour ago, frew said:

Interesting, I did not know about any Whiteboard.

Not sure what that is.

and how about typing WIN + w on the desktop?
You will see the small whiteboard window on the bottom right.
Just try it. Or make yourself smart in Wkipedia.

1 hour ago, frew said:

I appreciate the script you present.

and why do not you use it then?

1 hour ago, frew said:

Here's an example of where I'm at with my scripts for opening folders at this time:

And your script is scrap.
1. It ends immediately because there is no loop at the end.
2. The keys WIN + 1 and WIN + 2 are also occupied by Windows.
You never tested the script. 

 

Just try this script: 

_HotKey("+{ESC}")   ; Shift + ESC to exit script
_HotKey("#1")       ; WIN + 1 reserved by Windows. Calls leftmost icon in Taskbar
_HotKey("#2")       ; WIN + 2 reserved by Windows. Calls second to leftmost icon in Taskbar
_HotKey("+{F1}")    ; Shift + F1 calls ShellExecute("C:\")
_HotKey("+{F2}")    ; Shift + F2 calls ShellExecute("C:\Program Files")
Func _HotKey($hotkey = "")
    ;       ! ALT  + SHIFT  ^ CONTROL  # WinKey
    Switch @HotKeyPressed
        Case "+{ESC}" ; Shift + ESC to exit
            Exit 0 * MsgBox(64 + 262144, Default, "Exit", 1)
        Case "#1", "#2"    ; reseved by Windows
            Beep()
        Case "+{F1}"        ; Shift + F1 calls ShellExecute("C:\")
            ShellExecute("C:\")
        Case "+{F2}"        ; Shift + F2 calls ShellExecute("C:\Program Files")
            ShellExecute("C:\Program Files")
        Case Else
            If Not IsDeclared("hotkey") Then Return MsgBox(16 + 262144, Default, "No CASE statement defined for hotkey " & @HotKeyPressed)
            If HotKeySet($hotkey, "_Hotkey") = 0 Then Return MsgBox(16 + 262144, Default, "Hotkey " & $hotkey & " invalid or set by another application.")
    EndSwitch
EndFunc   ;==>_HotKey

While Sleep(100)     ; here should be your application.
WEnd                 ; meanwhile, here is a dummy loop.

 

App: Au3toCmd              UDF: _SingleScript()                             

Posted

Exit, thanks so much for the feedback, ideas, and this script.

Quote

Just try this script:

 

I like how this script works.

I'm studying it.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...