Back To new line 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

Back To new line

14 Apr 2020, 09:29

How can i make this gui show each comment number in new line ?
like this :
comment 1
comment 2
.
.
.
comment 100

Code: Select all

F2::Reload
F1::
Gui, Add, GroupBox, x2 y9 w300 h280 , Script Comments
Gui, Add, Edit, x22 y59 w270 h220 Border readonly vscroll vComment_Bar
Gui, Show, xCenter yCenter h291 w310, Autohotkey
Gui +AlwaysOnTop
z = 0
while z != 100
{
	z ++
		GuiControl,,Comment_Bar, % "[ + ] This is comment " . A_Index . "`n"
	ifEqual z, 80
		{
		 Gui, Font, cRed
		 GuiControl, Font, Comment_Bar
		}
	ifEqual z, 50
		{
		 Gui, Font, cBlue
		 GuiControl, Font, Comment_Bar
		}
	ifEqual z, 10
		{
		 Gui, Font, cGreen
		 GuiControl, Font, Comment_Bar
		}
	Sleep,1000
}
GuiControl,,Comment_Bar, All don ! Exit AHK.
Return

GuiClose:
Reload
garry
Posts: 3844
Joined: 22 Dec 2013, 12:50

Re: Back To new line

14 Apr 2020, 14:11

Code: Select all

F2::Reload
F1::
Gui, Add, GroupBox, x2 y9 w300 h280 , Script Comments
Gui, Add, Edit, x22 y59 w270 h220 Border readonly vscroll vComment_Bar
Gui, Show, xCenter yCenter h291 w310, Autohotkey
Gui +AlwaysOnTop
z = 0
while z != 20
{
	z ++
    e .= "[ + ] This is comment " . A_Index . "`n"
	GuiControl,,Comment_Bar,%e%
    send, ^{end}
	ifEqual z, 80
		{
		 Gui, Font, cRed
		 GuiControl, Font, Comment_Bar
		}
	ifEqual z, 50
		{
		 Gui, Font, cBlue
		 GuiControl, Font, Comment_Bar
		}
	ifEqual z, 10
		{
		 Gui, Font, cGreen
		 GuiControl, Font, Comment_Bar
		}
	Sleep,1000
}
e .= "All done ! Exit AHK."
GuiControl,,Comment_Bar,%e%
send ^{end}
Return
GuiClose:
exitapp
esc::exitapp

Barney15
Posts: 168
Joined: 12 Jan 2020, 14:18

Re: Back To new line

15 Apr 2020, 08:31

garry wrote:
14 Apr 2020, 14:11

Code: Select all

F2::Reload
F1::
Gui, Add, GroupBox, x2 y9 w300 h280 , Script Comments
...
it's worked,
there is one little thing, how can we make it show the last line or scroll up automatically, this problem shows if i had chrome active or any other window.

Code: Select all

F2::Reload
F1::
Gui, Add, GroupBox, x2 y9 w300 h280 , Script Comments
Gui, Add, Edit, x22 y59 w270 h220 Border readonly vscroll vComment_Bar
Gui, Show, xCenter yCenter h291 w310, Autohotkey
Gui +AlwaysOnTop
z = 0
while z != 100
{
	z ++
    e .= "[ + ] This is comment " . A_Index . "`n"	;//what is the different between := and .= 
	GuiControl,,Comment_Bar,%e%
    send, ^{end}
	Sleep,400
}
e .= "All done ! Exit AHK."
GuiControl,,Comment_Bar,%e%
send ^{end}
Return
GuiClose:
exitapp
esc::exitapp
just me
Posts: 9738
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Back To new line  Topic is solved

15 Apr 2020, 10:33

Code: Select all

#NoEnv
Gui, +AlwaysOnTop
Gui, Add, Edit, w300 r20 vMyEdit hwndHED
Gui, Show, , Test

Loop, 25
{
   GuiEditAppend(HED, "Line " . A_Index . "`r`n") ; needs `r`n for a proper line break
   Sleep, 500
}
Return

GuiCLose:
ExitApp

GuiEditAppend(HED, Append) { ; an old (style) one
   SendMessage, 0x00B1, -2, -1, , ahk_id %HED%           ; EM_SETSEL (original idea by SKAN): sets the caret to the end of text
   SendMessage, 0x00C2, False, &Append, , ahk_id %HED%   ; EM_REPLACESEL
   ; The following command might be needed on some older versions of Windows to scroll the appended line into view
   ; SendMessage, 0x00B7, 0, 0, , ahk_id %HED%             ; EM_SCROLLCARET
}
garry
Posts: 3844
Joined: 22 Dec 2013, 12:50

Re: Back To new line

15 Apr 2020, 13:47

@just me , thanx for this function
Barney15
Posts: 168
Joined: 12 Jan 2020, 14:18

Re: Back To new line

16 Apr 2020, 13:10

just me wrote:
15 Apr 2020, 10:33

Code: Select all

#NoEnv
almost done, please two small thing needed
add color to the text
if it's possible add sleep in the same line as GuiEditAppend

Code: Select all

#NoEnv
F2::Reload
F1::
Gui, +AlwaysOnTop
Gui, Add, Edit, w300 r5 Border readonly vscroll vComment_Bar hwndHED
Gui, Show, x3 y870

GuiEditAppend(HED, Append) {
   ; SendMessage, 0x00B1, -2, -1, , ahk_id %HED%
   SendMessage, 0x00C2, False, &Append, , ahk_id %HED% ;//0x00C2
   ; SendMessage, 0x00B7, 0, 0, , ahk_id %HED%
}
Loop, 100
  {
   Sleep, 500 ;//ps is there a way to add sleep to GuiEditAppend command eg : GuiEditAppend(){Sleep 500}
   GuiEditAppend(HED, "[ < ] Try " . A_Index . "`r`n") ;//any color eg : blue
   Sleep, 500
   GuiEditAppend(HED, "[ > ] Loading in 3s......`r`n") ;//any color eg : red
   Sleep, 3000
   GuiEditAppend(HED, "[ + ] Send Alt + J`r`n") ;//any color eg : green
   Sleep, 500
   GuiEditAppend(HED, "[ + ] Sleep 1s`r`n") ;//any color
   Sleep, 1000
   GuiEditAppend(HED, "[ + ] Send Enter`r`n") ;//any color
  }
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Draken and 79 guests