Steam Utility Menu Autohotkey - autohotkey

I have looked thoroughly around the interwebs for this, but I was wondering if anyone had a way that I could remap Shift + Tab so that it brings up a context menu like you see in steam. This would have a transparent background, and no window icon. And just like the steam menu, I want it to have stuff that would be useful. I have tried to do this on my own, but I was not successful. Anyone have any ideas?

I feel like this is much more complicated than you make it out to be.
Here is some code to get the fade effect without a window icon. Use Shift+Tab.
#SingleInstance force
#NoTrayIcon
SetBatchLines, -1
SysGet, VirtualWidth, 78
SysGet, VirtualHeight, 79
Transparency := 0
Fade := 0
Settimer, GUI2AlwaysOnTop, 10 ; Keep gui 2 on top
Gui, 1: Default
Gui, Color, 0x000000 ; Color to black
Gui, +LastFound +AlwaysOnTop -Caption +E0x20 ; Click through GUI always on top.
Gui, 1: +owner
WinSet, Transparent, %Transparency%
Gui, Show, x0 y0 w%VirtualWidth% h%VirtualHeight% ; Cover entire screen, may have to adjust X if you have multiple monitors
Return
Shift & Tab::
If (Fade:=!Fade)
FadeIn(500, 40)
Else
FadeOut(500)
Return
FadeIn(TotalTime = 500, TransFinal = 255)
{
StartTime := A_TickCount
Loop
{
Transparency := Round(((A_TickCount-StartTime)/TotalTime)*TransFinal)
WinSet, Transparent, %Transparency%, ahk_class AutoHotkeyGUI
if (Transparency >= TransFinal)
break
Sleep, 10
}
}
FadeOut(TotalTime = 500)
{
StartTime := A_TickCount
Loop
{
Transparency := ((TimeElapsed := A_TickCount-StartTime) < TotalTime) ? 100*(1-(TimeElapsed/TotalTime)) : 0
WinSet, Transparent, %Transparency%, ahk_class AutoHotkeyGUI
if (Transparency = 0)
break
Sleep, 10
}
}
GUI2AlwaysOnTop:
Gui, 2: +AlwaysonTop
return
A good amount of the GUI code is from SmartBright. I've had these fade functions around, I know I modified someone else's script to my liking, but I cannot find the source.

Related

AHK Trouble getting my image to show when pressing GUI

I've been editing a code to make it more personal and can't seem to get the %crsLocation% image to open with it. The button presses, but nothing else happens. I have tried directly connecting the directory to no prevail. I'm not sure what else to do. I am still kinda new to AHK and besides some basic classes in college and Codecademy my knowledge is still limited.
I was wondering if anyone could see what I am doing wrong
#NoEnv
#SingleInstance Force
SetBatchLines, -1
SetWorkingDir, A_ScriptDir
; GUI Design
Gui Show, x600 y325 w481 h381, CrossHair Overlay
Gui, Color, Gray
Gui, Font, Caqua
; GUI Buttons
Gui Add, Button, vCrosshair gCrosshair Default w80, Crosshair
Gui Add, Button, vReload gReload Default w80, Reload
Gui Add, Button, vExit gExit Default w80, Exit
Return
; Labels
Reload:
Reload
return
Exit:
ExitApp
return
Crosshair:
If _Crosshair := ! _Crosshair
Loop
{
;Config
crsLocation := "crosshairdot.png"
crsHeight := "7"
crsWidth := "7"
invsColor := "ffffff"
locCompensator := "4"
locX := "960"
loxY := "540"
;End of config
diflocX := locX - locCompensator
diflocY := locY - locCompensator
setCross = 0
~XButton2::
if (setCross = 0) {
Gui, chscript: New
Gui, Add, Picture, x0 y0 h%crsHeight% w%crsWidth%, %crsLocation%
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow +E0x00000020
Gui, Show, x%diflocX% y%diflocY% h%crsHeight% w%crsWidth%
; Middle of Screen = 960 540
Gui, Color, %invsColor%
WinSet, TransColor, %invsColor%
setCross = 1;
}
else {
Gui, chscript: Destroy
setCross = 0
}
Return
}
Return
Return
First of all in the documents it states scriptdir with percents around it, even though it works without signs I'd stick with docs suggestions,
SetWorkingDir, %A_ScriptDir%
and then there is this typo,
loxY := "540"
should be locY I belive

Button automatically activating

I'm not quite sure why, but whenever I run the ahk file the button automatically activates. (I put the GuiClose: ExitApp so that it doesn't infinitely refresh). Also, is there a better way to do this?
#Persistent
#SingleInstance, force
ontop = 1
Gui, -Caption
Gui, Font,cPurple s10, Arial Bold
Gui, Add, Picture, x0 y0 gUImove, bg-1.jpg
Gui, Add, Picture, x0 y40, bg-1.jpg
If ontop = 1
{
Gui, +AlwaysOnTop
}
Gui, Add, Text, x190 y0 +BackgroundTrans,test
Gui, Add, Button, x100 y200 w120 h40 , disableOnTop
Gui, Show, w500 h340
TrayTip , Title, test, 20
UImove:
GuiClose:
ExitApp
disableOnTop:
{
If ontop = 0
{
ontop = 1
Reload
Sleep 5000
Return
}
Else If ontop = 1
{
ontop = 1
Reload
Sleep 5000
Return
}
}
Return
If you want the code following the disableOnTop label to run when clicking the GUI button, you need to put its name in the options of the button following a letter "g", like so:
Gui, Add, Button, x100 y200 w120 h40 gdisableOnTop , Click me
For proper functionality, you'll also need to put a Return after Gui, Show.
Note that variables are not saved when you reload. Also, note that the Sleep 5000 and Return are after Reload, which means it won't be executed. (Unless it can't reload, such as if there is a syntax error.)
I'm surprised that it's running your button code at all; it looks like it should run into ExitApp and all you'd see is a brief flash of the GUI before it exits.

Left Mouse Click Not Work if Gui Follow The Mouse Pointer Autohotkey

Left Mouse Click Not Work if Gui Follow The Mouse Pointer Autohotkey.
i Have a Ahk Script that is able that my Gui with Picture Follow the Mouse Pointer.
But The Left Mouse Click does not work. (i can click/run notepad but i can not select Text in notepad!)
i do not now why it does do that? (the Gui+Picture is not on the Mouse Pointer.)
Follow-Pointer.ahk
#SingleInstance force
CoordMode, Mouse, screen
CoordMode, ToolTip, screen
IfNotExist, c5sc29f.gif ;c5sc29f.gif File is roket.gif
URLDownloadToFile, https://i.imgur.com/c5sc29f.gif, c5sc29f.gif
Gui -Caption +LastFound +ToolWindow +AlwaysOnTop
Gui, Margin, 0, 0
Gui, Color, FFFFFF
Gui, Add, Picture, x100 y100 w-1 h50 +BackgroundTrans, c5sc29f.gif ;
;WinSet, Transcolor, FFFFFF
WinSet, ExStyle, +0x20 ; set click through style
gosub, F1
return
F1:: SetTimer Draw, % (switch:= !switch) ? "20" : "-20"
Draw:
MouseGetPos, x, y
y+=10, x+=10
If switch {
Gui Show, x%x% y%y%
;~ ToolTip,% "x" x " y" y,% x+0,% y+50
} else {
Gui Cancel
ToolTip,
}
return
esc::ExitApp
ExitApp
return
Try
Gui Show, x%x% y%y% NoActivate
NoActivate avoids deactivating the currently active window.

pixelsearch and click right pixel

IF NOT A_IsAdmin ; Runs script as Admin.
{
Run *RunAs "%A_ScriptFullPath%"
ExitApp
}
#MaxThreadsPerHotkey, 2
CoordMode, Pixel, Screen
#singleInstance, Force
toggle = 0
upperLeftX := 750
upperLeftY := 400
lowerRightX := 850
lowerRightY := 500
F8:: ; press F8 to toggle the loop on/off.
SoundBeep
Toggle := !Toggle
While Toggle
{ ;-- Begin of loop.
PixelSearch, X, Y,%upperLeftX%, %upperLeftY%, %lowerRightX%, %lowerRightY%, 0x000000, 0, Fast RGB
IF ErrorLevel = 1 ; IF NOTFound.
{
sleep, 100
}
IF ErrorLevel = 0 ; IF Found.
{
MouseClick, left
sleep, 300
}
} ;-- End of Loop.
return
F8 starts loop and this code checks specific pixel in rectangle and sends left click.
It works with [MouseClick, left, %X%, %Y%].But I want to know how can I use dllcall mouse event to click on specific pixel.
for example
DllCall("mouse_event",uint,1,int,%X%,int,%Y%,uint,0,int,0)
But its not working
I doubt that you actually want to do this via DLL calls. mouse_event doesn't even take coordinates, but values between 0-65535.
If you want to be able to click any pixel on the screen make sure you set it to be relative to the screen: CoordMode, Mouse, Screen
Then use ControlClick/PostMessage/SendMessage if you don't want to affect your mouse pointer by that click. Or use MouseClick/Click. Or MouseMove+Send, {LButton}.

Window transparency changing affecting active windows

I have a code for hiding a window with AutoHotKey:
NumpadEnter::
Trans:=255
Loop
{
WinSet, Transparent, %Trans%, A
Sleep, 20
Trans-=1
if(Trans <= 0)
Break
}
return
Works like a charm, but you can see that execution time of this function is about 4-5 seconds. I can't switch between other windows in these 4-5 seconds, because other windows will be affected with WinSet function.
I need to save window handle to variable before the loop. And use it on the line with WinSet function.
How can I do that?
One way is to use the winexist() function with the A option as the wintittle parameter, that will give you the ID of the active window so that you can use that.
Something like this
NumpadEnter::
hWnd := WinExist("A")
Trans:=255
Loop
{
WinSet, Transparent, %Trans%, Ahk_id %hWnd%
Sleep, 20
Trans-=1
if(Trans <= 0)
Break
}
return
Hope it helps
Edit:
The full documentation: http://www.autohotkey.com/board/topic/80577-how-to-animate-a-gui-window/
Edit 2:
You mentioned it didn't work for you. Here is a working example on Windows 8 machine using Ahk_L (aka. Autohotkey_L or Autohotkey_Lexiko):
DetectHiddenWindows, On ;//Allow hidden windows to be detectable
SetWinDelay, -1 ;//Make Window update very fast (smooth animation)
FADE := 524288
SHOW := 131072
HIDE := 65536
FADE_SHOW := FADE+SHOW
FADE_HIDE := FADE+HIDE
SetFormat, Integer, Hex
FADE_SHOW+=0 ;//Converts to 0xa0000
FADE_HIDE+=0 ;//Converts to 0x90000
SetFormat, Integer, d
Gui, Font, w500 s35 Center, Verdana
Gui, Add, Text, , Hello! This Window will hide in 5 Seconds.
Gui, Show, NA Hide, Test Window ; //Create the Window hidden
Gui, +LastFound
GUI_ID := WinExist() ;//Get Window ID
Duration := 3000 ;//Speed of Window showing/hiding
DllCall("AnimateWindow","UInt",GUI_ID,"Int",Duration,"UInt", FADE_SHOW) ;//Fade in Window
Sleep, 5000 ;//Pause for 5 seconds
DllCall("AnimateWindow","UInt",GUI_ID,"Int",Duration,"UInt", FADE_HIDE) ;//Fade out Window
Return