GUI show in different positions Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Barney15
Posts: 168
Joined: 12 Jan 2020, 14:18

GUI show in different positions

09 Apr 2020, 12:41

is there a smart way to show this simple gui in position 1 fade then 2 until position 8.
and keep looping until mouse move stop and show in center.
plz check the screenshot.

Code: Select all

F2::Reload
F1::
Gui, +LastFound +AlwaysOnTop
Gui, Add, Picture, x2 y-1 w210 h140 , C:\Users\PC\Desktop\Untitled-1.png
Gui, Add, Text, x22 y19 w150 h20 Center, mesage
Gui, Add, Radio, x22 y49 w150 h20 Center Checked, => Option 1
Gui, Add, Radio, x22 y69 w150 h20 Center, =>Option 2
Gui, Add, GroupBox, x12 y-1 w190 h100, % "Time - " . A_Hour . ":" . A_Min  " -"
Gui, Show, xCenter yCenter
return
Attachments
ahk move across the screen.png
ahk forum
ahk move across the screen.png (24.57 KiB) Viewed 457 times
Barney15
Posts: 168
Joined: 12 Jan 2020, 14:18

Re: GUI show in different positions

09 Apr 2020, 12:51

i'll understand better with an example plz
Barney15
Posts: 168
Joined: 12 Jan 2020, 14:18

Re: GUI show in different positions

09 Apr 2020, 13:06

tried this

Code: Select all

F2::Reload
F1::
Gui,  +LastFound +AlwaysOnTop
Gui, Add, Picture, x2 y-1 w210 h140 , C:\Users\PC\Desktop\Untitled-1.png
Gui, Add, Text, x22 y19 w150 h20 Center, mesage
Gui, Add, Radio, x22 y49 w150 h20 Center Checked, => Option 1
Gui, Add, Radio, x22 y69 w150 h20 Center, =>Option 2
Gui, Add, GroupBox, x12 y-1 w190 h100, % "Time - " . A_Hour . ":" . A_Min  " -"
MouseGetPos, Done_X, Done_Y
m := A_ScreenWidth - 210
Loop
	{
	 Gui, Show, x%m% y0
	 Sleep,1000
	 Gui, Show, xCenter y0
	 Sleep,1000
	 Gui, Show, x0 y0
	 Sleep,1000
	 Gui, Show, x0 yCenter
	 Sleep,1000
	 Gui, Show, x0 y800
	 Sleep,1000
	 Gui, Show, xCenter y800
	 Sleep,1000
	 Gui, Show, x%m% y800
	 Sleep,1000
	 Gui, Show, x%m% yCenter
	 Sleep,1000
	 MouseGetPos, New_X, New_Y
	 if(Done_X != New_X && Done_Y != New_Y)
		 {
		  Break
		 }
	}
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: GUI show in different positions  Topic is solved

09 Apr 2020, 15:14

Give this a try.

Code: Select all

#SingleInstance, Force
SetBatchLines, -1
CoordMode, Mouse, Screen
Positions := [], W := 190, H := 100
Positions[1] := { X: 50, Y: 50 }
Positions[2] := { X: 50, Y: Floor((A_ScreenHeight-H)/2) }
Positions[3] := { X: 50, Y: (A_ScreenHeight-H-50) }
Positions[4] := { X: Floor((A_ScreenWidth-W)/2), Y: (A_ScreenHeight-H-50) }
Positions[5] := { X: (A_ScreenWidth-(W+50)), Y: (A_ScreenHeight-H-50) }
Positions[6] := { X: (A_ScreenWidth-(W+50)), Y: Floor((A_ScreenHeight-H)/2) }
Positions[7] := { X: (A_ScreenWidth-(W+50)), Y: 50 }
Positions[8] := { X: Floor((A_ScreenWidth-W)/2), Y: 50 }
return
GuiClose:
*ESC::
	ExitApp
	
FadeIn:
	if((FadeValue+=5)<260){
		WinSet, Transparent, % FadeValue, % "ahk_Id " GuiHwnd
	}else{
		SetTimer, FadeIn, Off
		SetTimer, FadeWait, -1000
		FadeValue := 255
	}
	return
	
FadeWait:
	SetTimer, FadeOut, 30
	return

FadeOut:
	if((FadeValue-=5)>=0){
		WinSet, Transparent, % FadeValue, % "ahk_Id " GuiHwnd
	}else{
		SetTimer, FadeOut, Off
		SetTimer, MoveWindow, -200
		FadeValue := 0
	}
	return
	
MoveWindow:
	if(++Index>Positions.Length()){
		MouseGetPos, Nx, Ny
		Index := 1
		if(Nx!=Sx||Ny!=Sy){
			Gui, 1:Show, % "xCenter yCenter w" W " h" H " NA", Demo
			WinSet, Transparent, 255, % "ahk_Id " GuiHwnd
			return
		}
		
	}
	Gui, 1:Show, % "x" Positions[Index].X " y" Positions[Index].Y " w" W " h" H " NA", Demo
	SetTimer, FadeIn, 30
	return

F1::
	FadeValue := 0, Index := 1 
	Gui, 1:New, +AlwaysOnTop hwndGuiHwnd
	Gui, 1:Color, 222222
	WinSet, Transparent, % FadeValue, % "ahk_Id " GuiHwnd
	Gui, 1:Show, % "x" Positions[Index].X " y" Positions[Index].Y " w" W " h" H " NA", Demo
	MouseGetPos, Sx, Sy
	SetTimer, FadeIn, 30	
	return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: TAC109 and 329 guests