OSD Mouse Location and Cross Hair in same script issue... Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Rohwedder
Posts: 7647
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: OSD Mouse Location and Cross Hair in same script issue...

Post by Rohwedder » 11 Aug 2022, 08:35

DetectHiddenWindows, On
https://www.autohotkey.com/docs/commands/DetectHiddenWindows.htm
Turning on DetectHiddenWindows can make scripting harder in some cases since some hidden system windows might accidentally match the title or text of another window you're trying to work with. So most scripts should leave this setting turned off.
I had a Timer to close windows "Do you really want to slow down this 40 tons truck now?"
An application in my office (SAP MM tool) was very unhappy that one of its hidden windows was killed every 500 ms.

User avatar
Justin-TestBot101a
Posts: 33
Joined: 04 Aug 2022, 20:00

Re: OSD Mouse Location and Cross Hair in same script issue...

Post by Justin-TestBot101a » 05 Oct 2022, 01:48

Updated to add speed to the voice. Kept the other use, but needed to change the code a little to make the speed work.

Code: Select all

DesktopIcons( Show:=-1 ) ; By SKAN for ahk/ah2 on D35D/D495 @ tiny.cc/desktopicons
{
    Local hProgman := WinExist("ahk_class WorkerW", "FolderView") ? WinExist()
                   :  WinExist("ahk_class Progman", "FolderView")

    Local hShellDefView := DllCall("user32.dll\GetWindow", "ptr",hProgman,      "int",5, "ptr")
    Local hSysListView  := DllCall("user32.dll\GetWindow", "ptr",hShellDefView, "int",5, "ptr")

    If ( Show != Hidden := DllCall("user32.dll\IsWindowVisible", "ptr",hSysListView) )
         DllCall("user32.dll\SendMessage", "ptr",hShellDefView, "ptr",0x111, "ptr",0x7402, "ptr",0)
	return Hidden
}
; WindowsKey+D
#d::
oSPVoice := ComObjCreate("SAPI.SpVoice")
oSpVoice.Rate := 5
oSpVoice.Speak(DesktopIcons()?"Icons hide":"Icons reappear", 2) ;SVSFlagsAsync := 0x1
;ComObjCreate("SAPI.SpVoice").Speak(DesktopIcons()?"Icons hide":"Desktop icons reappear")
;DesktopIcons()
return ;AutoHotkey v2: ComObject("SAPI.SpVoice")[code]

User avatar
Justin-TestBot101a
Posts: 33
Joined: 04 Aug 2022, 20:00

Re: OSD Mouse Location and Cross Hair in same script issue...

Post by Justin-TestBot101a » 07 Oct 2022, 18:32

***********UPDATED SHOW AND HIDE DESKTOP ICON AND WIDGETS***********

This code is updated to hide and show all Desktop Icons and Widgets. (Tested on Windows 10 Pro 21H1 build 19043.2006)

You can adjust the code to make the voice sound faster or slower, but I still have not figured out how to change the voice type.
I will be changing this code, once I figure it out! Thanks for stopping by! Peace be with you...

-Justin

Code: Select all

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DesktopIcons( Show:=-1 ) ; By SKAN for ahk/ah2 on D35D/D495 @ tiny.cc/desktopicons
{
    Local hProgman := WinExist("ahk_class WorkerW", "FolderView") ? WinExist()
                   :  WinExist("ahk_class Progman", "FolderView")

    Local hShellDefView := DllCall("user32.dll\GetWindow", "ptr",hProgman,      "int",5, "ptr")
    Local hSysListView  := DllCall("user32.dll\GetWindow", "ptr",hShellDefView, "int",5, "ptr")

    If ( Show != Hidden := DllCall("user32.dll\IsWindowVisible", "ptr",hSysListView) )
    DllCall("user32.dll\SendMessage", "ptr",hShellDefView, "ptr",0x111, "ptr",0x7402, "ptr",0)
    return Hidden
}
; WindowsKey+D
#d::
st := !st
oSPVoice := ComObjCreate("SAPI.SpVoice")
oSpVoice.Rate := 5
if (mst := !mst)
{
oSpVoice.Speak(DesktopIcons()?"Hide Now":"Reappear Now", 1) ;SVSFlagsAsync := 0x1
process, close, % ( st ? "sidebar.exe" : "" ) ; <- Close Sidebar to Hide Widgets
;ComObjCreate("SAPI.SpVoice").Speak(DesktopIcons()?"Icons hide":"Desktop icons reappear")
;DesktopIcons()
} else {
oSpVoice.Speak(DesktopIcons()?"Hide Now":"Reappear Now", 1) ;SVSFlagsAsync := 0x1
run % ( !st ) ? a_programFiles "\windows sidebar\sidebar.exe " : "" ; <- Run Sidebar to Show Widgets
}
return ;AutoHotkey v2: ComObject("SAPI.SpVoice")
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
********* UPDATED CODE ON "OCT-11-2022" *********

Post Reply

Return to “Gaming Help (v1)”