remove lines of #If-statement from history of executed lines Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Haswell
Posts: 90
Joined: 21 Feb 2016, 17:11

remove lines of #If-statement from history of executed lines

24 Dec 2023, 05:36

how to remove lines of #If-statement from history of executed lines?

Code: Select all

ListLines Off
#If, some_func()
~LButton Up::
   ListLines Off
   outputdebug hello world
return
#If

some_func()
{
   ListLines Off
   outputdebug 11
   return 1
}
Is it possible to get rid of "some_func()" in history of lines? I tried "ListLines off" everywhere but it doesn't work
Focusing our efforts on non-productive and non-creative endeavours wastes lives as surely as war.
Jacque Fresco / The best that money can't buy
User avatar
andymbody
Posts: 950
Joined: 02 Jul 2017, 23:47

Re: remove lines of #If-statement from history of executed lines

24 Dec 2023, 12:40

It works for me (if I understand what you are trying to do). Using your script records nothing in the event logger (since ListLines Off is the first command. And depending on where I place the ListLines Off command, I can turn logging on/off successfully, exactly where I place it.

Which version of AHK are you using?
Haswell
Posts: 90
Joined: 21 Feb 2016, 17:11

Re: remove lines of #If-statement from history of executed lines

24 Dec 2023, 15:12

I use version 1.1.37.1.
Here is more accurate example:

Code: Select all

#SingleInstance force
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

;some code in autoexection section...

return  ;end of autoexecution section (I need this return)


;section with hotkeys and timer-routines started...

;I want to show lines for that #If-statement
ListLines On
#If, some_func1()
~1::
   outputdebug hello 1
return
#If

some_func1()
{
   return 1
}

;I don't want to show lines for that #If-statement
ListLines Off
#If, some_func2()
~2::
   outputdebug hello 2
return
#If

some_func2()
{
   return 1
}
Focusing our efforts on non-productive and non-creative endeavours wastes lives as surely as war.
Jacque Fresco / The best that money can't buy
User avatar
andymbody
Posts: 950
Joined: 02 Jul 2017, 23:47

Re: remove lines of #If-statement from history of executed lines  Topic is solved

24 Dec 2023, 16:45

Would this work as an alternative? Remove the #IF entirely and handle the condition check manually after the ListLines is turned off. Especially since you are allowing pass-thru of the keys to the rest of the system anyway...

This is what you would have to do if the #IF directive was not available (I think it's really just a convenience command).

Code: Select all

;I want to show lines for that #If-statement
~1::
	ListLines On
	if (!some_func1())
		return
	outputdebug hello
	return

some_func1()
{
   return 1
}

;I don't want to show lines for that #If-statement
~2::
	ListLines Off
	if (!some_func2())
		return
	outputdebug hello
	return

some_func2()
{
   return 1
}

Haswell
Posts: 90
Joined: 21 Feb 2016, 17:11

Re: remove lines of #If-statement from history of executed lines

26 Dec 2023, 02:47

Oh! Thank you :xmas:
Focusing our efforts on non-productive and non-creative endeavours wastes lives as surely as war.
Jacque Fresco / The best that money can't buy

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: pgeugene and 78 guests