AHK Counter Gui does not have title

0

On trying to make a small counter in AutoHotkey AHK to count some stuff, when I press Page down and Up for + and minus, all work well with a small problem the GUI that it opens is so small and I can't move it unless I use the arrows from keyboard and windows does not remember its last position when reopening it.

This is what I have until now. I tried a lot of stuff over the course of the weekend but I don't seem to figure it out how to make the window that opens to show the window title or set a title for it to be able to move it as I please

Gui, Add, Text, vCount w100, PgDn pressed 0 times.
Gui, Show,

Count := 0

$PgDn::   ;Default behavior is to block keystroke, ~ allows it to pass through
  Count := Count + 1
  GuiControl,,Count, PgDn pressed %Count% times.
  KeyWait, PgDn  ;Wait for PgDn to be released
return

$PgUp::   ;Default behavior is to block keystroke, ~ allows it to pass through
  Count := Count - 1
  GuiControl,,Count, PgUp pressed %Count% times.
  KeyWait, PgUp  ;Wait for PgUp to be released
return

GuiClose:
  ExitApp
return

Any help would be appreciated.

Fate Averruncus

Posted 2018-09-03T10:13:48.323

Reputation: 42

Answers

0

Finally got it right!

x := (A_ScreenWidth/2)-(Width/2)
y := (A_ScreenHeight/2)-(Height/2)
Gui, Show, %x% %y% w200 h50
Gui, Add, Text, vCount w150, PgDn pressed 0 times.
Count := 0

$PgDn::   ;Default behavior is to block keystroke, ~ allows it to pass through
  Count := Count + 1
  GuiControl,,Count, PgDn pressed %Count% times.
  KeyWait, PgDn  ;Wait for PgDn to be released
return

$PgUp::   ;Default behavior is to block keystroke, ~ allows it to pass through
  Count := Count - 1
  GuiControl,,Count, PgUp pressed %Count% times.
  KeyWait, PgUp  ;Wait for PgUp to be released
return

GuiClose:
  ExitApp
return

Fate Averruncus

Posted 2018-09-03T10:13:48.323

Reputation: 42