Add another column
Re: Add another column
@garry. Perfect. Thanks again for all your help. Cheer's
Re: Add another column
@garry
1. It doesn't account for the taskbar.
If the intent is to fill the useable space of a monitor, you can use Sysget to get the workarea. It is easy to understand the docs in this case (take it from one dummy to another) so you shouldn't have any problem writing the code to get the work area of the monitor you want to display the Gui on.
2. It doesn't account for the window border. ( title, close button, etc...)
if I remember correctly, the offset for x is around 10px and around 35px for the y?
At any rate, the best approach to having your gui fill the screen in most cases would be to let the gui size itself by not using a width or height when you show the gui, and then you simply maximize it to get it to fill the screen.
Here is a simple example.
Press the hotkey a few times
I think I see where the issue is. Your calculations set the gui size to the screen size. There is two issues that come from that.I calculated x y w h with procent depending screensize , should work for 4K , FullHD , etc ...
1. It doesn't account for the taskbar.
If the intent is to fill the useable space of a monitor, you can use Sysget to get the workarea. It is easy to understand the docs in this case (take it from one dummy to another) so you shouldn't have any problem writing the code to get the work area of the monitor you want to display the Gui on.
2. It doesn't account for the window border. ( title, close button, etc...)
if I remember correctly, the offset for x is around 10px and around 35px for the y?
At any rate, the best approach to having your gui fill the screen in most cases would be to let the gui size itself by not using a width or height when you show the gui, and then you simply maximize it to get it to fill the screen.
Here is a simple example.
Press the hotkey a few times
Code: Select all
#SingleInstance, Force
return
GuiClose:
GuiContextMenu:
*ESC::ExitApp
;*****************************************************************************************************************************************************************
;*****************************************************************************************************************************************************************
;*****************************************************************************************************************************************************************
Numpad1::
Gui, New, +Resize hwndGuihwnd
Gui, Add, Button, xm ym w200 r1 ,Button
Gui, Add, Button, x+10 yp w200 r1 ,Button
Gui, Add, Button, x+10 yp w200 r1 ,Button
Gui, Add, Button, xm w200 r1 ,Button
Gui, Add, Button, x+10 yp w200 r1 ,Button
Gui, Add, Button, x+10 yp w200 r1 ,Button
Gui, Show, ;will autosize :::::: Note :::::: if you change the size of the gui at some point and call "gui, show" again, you will need to include the word "AutoSize".
;The reason is because the gui will use whatever size you last set the size to. So the first time it uses "AutoSize" without having to
;type it out, but after that, the size is set. So "AutoSize" after the first time
sleep, 2000
WinMaximize, % "ahk_id " Guihwnd
return
;*****************************************************************************************************************************************************************
;*****************************************************************************************************************************************************************
;*****************************************************************************************************************************************************************
Re: Add another column
@garry. Yes I'm back. But this should be last time. AHave everything almost done but after numerous stabs at trying to relocate window via the ha and wa numbers nothing works. I will say that before we got into the button color and text change thing the movement did work. Any ideas?
Re: Add another column
@garry. Hi Garry. Please belay previous comment. I solved it by restarting my computer. All good now. Once again Thank you for all your help.
Re: Add another column
@Hellbent thank you for help
I not often use fullsize , easiest way was to define Gui-height to 95 % ( if taskbar is at bottom )
I must try to define fontsize depending > A_ScreenDPI/96*100 , at the moment I have 175 %
( Here a test script )
I not often use fullsize , easiest way was to define Gui-height to 95 % ( if taskbar is at bottom )
I must try to define fontsize depending > A_ScreenDPI/96*100 , at the moment I have 175 %
( Here a test script )
Code: Select all
; screen guisize check / example 4K 3840*2160 or other screensize
;-----------------------------------
#warn
setworkingdir,%a_scriptdir%
SetFormat, float, 0.0
WA:=A_screenwidth,HA:=A_screenheight,xx:=100
;Gui,2: -dpiscale +Alwaysontop ;- NOT OK GuiHeight is = 2136 , it covers Taskbar depending header / menu
Gui,2: -dpiscale -caption +Alwaysontop ;- OK GuiHeight is = 2090 / Taskbar height is = 70 , Total 2160 ( 4K )
Gui,2: Color,teal
;-
;- case-1 without calculating taskbarheight ( define height, example 95% )
;x:=(wa*0)/xx,y:=(ha*0)/xx,w:=(wa*100)/xx,h:=(ha*95)/xx ;- GUI x y w h without calculation from taskbarheight
;--------------------------------------------------------
;-
;- case-2 with calculating taskbarheight ( bottom )
WinGetPos,,,, TaskBarHeight, ahk_class Shell_TrayWnd
hx:=HA-TaskBarHeight
w:=(wa*100)/xx,h:=hx ;- GUI x y w h
;--------------------------------------------------------
Gui,2:Show, x0 y0 h%h% w%w%,TEST
WinGetPos, posX, posY, posW, posH, A
aac:=A_ScreenDPI/96*100
msgbox, 262208, ,SCREENHEIGHT=%ha%`nSCREENWIDTH=%wa%`nGUIHEIGHT=%posh%`nTASKBARHEIGHT=%TaskBarHeight%`nGUIWIDTH=%posw%`n`nProcent windows screen setting 100-350= %aac% `%`n------`nUse button ESC
ifmsgbox,OK
exitapp
return
;-------------------------------------------------------------------------
2Guiclose:
exitapp
;------------
esc::exitapp
;------------
;=========================================================================
Re: Add another column
@garry
Unless you are doing something that would require you to use -DPIScale, I would suggest that you don't use it. It just complicates things.
At any rate, I just thought that you should know about the issue of your gui being a bit too big and covering / being covered by the task bar.
I'm not just speaking about now, I don't think I can remember a gui of yours that wasn't just a little bit too big.
You might want to do a pass at how you make your calculations or let the window size itself.
I hope that helps.
Unless you are doing something that would require you to use -DPIScale, I would suggest that you don't use it. It just complicates things.
At any rate, I just thought that you should know about the issue of your gui being a bit too big and covering / being covered by the task bar.
I'm not just speaking about now, I don't think I can remember a gui of yours that wasn't just a little bit too big.
You might want to do a pass at how you make your calculations or let the window size itself.
I hope that helps.
Re: Add another column
@Hellbent thank you , your example works fine
yes i have a lot of bad scripts , only know basics
I used FullHD ( now 4K ) and didn't think that it wouldn't work with other resolutions
But the example above works fine with -dpiscale
Without -dpiscale the GUI is too big
yes i have a lot of bad scripts , only know basics
I used FullHD ( now 4K ) and didn't think that it wouldn't work with other resolutions
But the example above works fine with -dpiscale
Without -dpiscale the GUI is too big
Last edited by garry on 19 Sep 2021, 15:42, edited 1 time in total.
Re: Add another column
@garry
How does this look for you? Anything off about it?
Mind taking a screenshot of this?
Press Numpad1 or change it.
How does this look for you? Anything off about it?
Mind taking a screenshot of this?
Press Numpad1 or change it.
Code: Select all
#SingleInstance, Force
return
GuiClose:
GuiContextMenu:
*ESC::ExitApp
;*****************************************************************************************************************************************************************
;*****************************************************************************************************************************************************************
;*****************************************************************************************************************************************************************
Numpad1::
Gui, New, +Resize hwndGuihwnd
Gui, Add, Button, xm ym w200 r1 ,Button
Gui, Add, Button, x+10 yp w200 r1 ,Button
Gui, Add, Button, x+10 yp w200 r1 ,Button
Gui, Add, Button, xm w200 r1 ,Button
Gui, Add, Button, x+10 yp w200 r1 ,Button
Gui, Add, Button, x+10 yp w200 r1 ,Button
Gui, Show,
return
;*****************************************************************************************************************************************************************
;*****************************************************************************************************************************************************************
;*****************************************************************************************************************************************************************
Re: Add another column
@Hellbent yes I tried your example , works fine
I too often used to define x y w h , which was most useless , and I see when I change fontsize , button-height and yp is correct ...
I too often used to define x y w h , which was most useless , and I see when I change fontsize , button-height and yp is correct ...
Re: Add another column
Yes, best not to define absolute values unless you are prepared to deal with all the noise that comes with it.
I only found out about DPI about 3 years ago and I have been using ahk for about 6 years now.
Only remembered dpi being a printer setting for the "dots per inch" from when I had made these stupid banners and cards way back in the 80's,
but screens are made of pixels which are units of any size.
Anyway, yeah, try to stop using -DPIscale and just start letting the gui do it's own thing for spacing.
In regards to this
Unless you define (set) the margin yourself, it will use the font and font size to determine the margins for you.button-height and yp is correct ...
Change the font => Change the margin
That is if you don't set it.
Code: Select all
Gui, Margin, 10 , 10
Re: Add another column
@Hellbent thank you for help , I will work with your suggestions
Re: Add another column
Have you tried this
viewtopic.php?f=6&t=93513
I'm not sure if it is only for buttons or not (haven't tried it and the examples are all buttons) but it might be worth checking out.
Perhaps it helps with your positioning.
Re: Add another column
@Hellbent thank you for the link , script from CapnOdin / GridGUI > viewtopic.php?f=6&t=93513
my examples with percent positioning works, have only problem with FontSize depending windows screen resolution and selection scaling 100%--- 350% ( I use 175% for my 4K Monitor )
maybe just don't define the fontsize or try to calculate fontsize ( depending screen resolution / scaling ) , here I get 175% > A_ScreenDPI/96*100
my examples with percent positioning works, have only problem with FontSize depending windows screen resolution and selection scaling 100%--- 350% ( I use 175% for my 4K Monitor )
maybe just don't define the fontsize or try to calculate fontsize ( depending screen resolution / scaling ) , here I get 175% > A_ScreenDPI/96*100
Re: Add another column
@garry. Hi Garry. One quick question. Everything is working like a charm but am having an issue with a few ahk scripts. 2 are working no problem gmail login and gmail relogin but when I try gmail logout it doesn't work the way it should. IE the mousemove goes to different positions. but when I press F8 that it is attached to it works fine. Easy out would be to Add send F8 to my guide but I can not figure out how to do that. Just want to press F8 and have script run. Any ideas? Tk's
Re: Add another column
@jrachr aargh , don't ask ME ... I'm not so good in programming ..
maybe I don't understand what you want
This example start another script with F8
( if you run a 2nd-script in another place with a link , script should begin with 'setworkingdir,%a_scriptdir%' )
maybe I don't understand what you want
This example start another script with F8
( if you run a 2nd-script in another place with a link , script should begin with 'setworkingdir,%a_scriptdir%' )
Code: Select all
#Warn
setworkingdir,%a_scriptdir%
file=%a_desktop%\Test1.ahk
HK1=$F8
Hotkey,%hk1%,A1,ON
Gui,Color,Black,Black
Gui,Font,s12 cYellow,Lucida Console
Gui,add,text,x20 y20,F8 > start charmap [Test1.ahk]
Gui,Show,x100 y100 w400 h100,Test
;- create a 2nd ahk-script for test :
e=
(Ltrim join`r`n `%
setworkingdir,%a_scriptdir%
run,charmap
)
ifnotexist,%file%
fileappend,%e%,%file%,utf-8
e=
return
;-------------
Guiclose:
exitapp
;-------------
A1:
try
run,%file%
return
;==============================
Re: Add another column
@garry. Tk's garry. I guess I could have been a little more clear. Instead of using an exe . IE notepad++. exe. What I want to do is have Gmail-Logout;Send, F8; because for some reason the gmail logout does not recognize the mousemove numbers when E:\PortableApps\PortableApps\AutoHotkeyPortable\AHK Scripts\Gmail Logout.ahk. is added.
All my url's and exe's work fine. Even my gmail login and Gmail relogin work fine but for some reason the gmail logout does not recognize the mousemove numbers. But when I press F8 it works fine. So at end of day Have Gmail-Logout;Send F8 which should work fine. Tk's
All my url's and exe's work fine. Even my gmail login and Gmail relogin work fine but for some reason the gmail logout does not recognize the mousemove numbers. But when I press F8 it works fine. So at end of day Have Gmail-Logout;Send F8 which should work fine. Tk's
Re: Add another column
@garry. Well I got it but still need a little help. Logout script works but not when gui is still open. IE. I have it open for 5 secs and logout won't work because gui is on top. Need to find way to close as soon as url or exe is chosen. Know you are not a programmer but if anyone out there knows how to get gui to close after url or exe is chosen I would be grateful. Cheer's
Re: Add another column
in last example script with buttons > viewtopic.php?p=420888#p420888
you can minimize the GUI and then starts URL/program
and show GUI again if click in tray to the icon from ahk-script
you can minimize the GUI and then starts URL/program
and show GUI again if click in tray to the icon from ahk-script
Code: Select all
;.............
;--------------- start --------------------------
start1:
gui,2:submit,nohide
Mousegetpos,,,,Ctrl ;- Button1
r:= a_guicontrol ;- vVar ( Buttonname )
stringtrimleft,ct,ctrl,6 ;- Button-(1)
clm2:= m%ct%
clm3:= n%ct%
;msgbox, 262208, ,R=%r%`nCT=%ct%`nCTRL=%ctrl%`nURL1=%clm2%`nURL2=%clm3%
try
{
Gui,2:minimize
run,%clm2%
}
try
{
Gui,2:minimize
run,%clm3%
}
return
;=================== END SCRIPT =============================================
Re: Add another column
@garry. Couldn't figure your example out but I will make due. Tk's for your help. Cheer's
Re: Add another column
... or use exitapp instead of return if don't want use the GUI after you started the program or url ....