HostMonitor v 14.20
The funny things is this is very similar to a "bug report" I posted in 2013.
https://www.ks-soft.net/cgi-bin/phpBB/v ... php?t=7131
That one end up not being a bug, but I'm getting bit by a similar problem with HMS SetFolderVariable and %AckComment%. This time however I'm unable to determine a viable workaround. So I'm going to loosely call it a bug but will admit it's probably best called a "feature request".
NOTE: I've tried both with and without the hostmon.ini parameter of:
[Logging]
KeepAckCommentNDays=1
There was no significant change in result.
Below is a very verbose description of the testing and steps to reproduce the "problem".
I'm having trouble saving acknowledgements into a Folder Variable (fvar) using HMS due to the source having spaces and/or multiple lines (CR/LF).
The reason I'm tying to capture this data is part of a bigger project but to keep this topic shorter I've built a sample test for just this piece that I cannot get to work.
The setup is as follows:
Take any test and make it go Warning or Bad so you have the ability to acknowledge it. Then set it with an Action Profile that runs an HMS using Advanced Mode %AcknowledgedJustNow%
#HMS Example 1 (This one was just to check my Syntax)
ResolveMacros Yes <-- I know this is already the default but I forced it anyway.
SetCurrentFolder %FullPath%
SetFolderVariable fvar_ackcomment WORD1 WORD2 WORD3 -inheritpartly
RESULT: %fvar_ackcomment% = WORD1
#HMS Example 2 (This one was just to check my Syntax)
ResolveMacros Yes
SetCurrentFolder %FullPath%
SetFolderVariable fvar_ackcomment 'WORD1 WORD2 WORD3' -inheritpartly
RESULT: %fvar_ackcomment% = WORD1 WORD2 WORD3
#HMS Example 3 (This one was just to check my Syntax)
ResolveMacros Yes
SetCurrentFolder %FullPath%
SetFolderVariable fvar_ackcomment "WORD1 WORD2 WORD3" -inheritpartly
RESULT: %fvar_ackcomment% = WORD1 WORD2 WORD3
#HMS Example 4 (This one is what I'm trying to do but fails due to lack of proper single or double quotes)
ResolveMacros Yes
SetCurrentFolder %FullPath%
SetFolderVariable fvar_ackcomment %AckComment% -inheritpartly
RESULT: Only the characters up to the first space are included
#HMS Example 5 (This one fails as shown in the system log)
ResolveMacros Yes
SetCurrentFolder %FullPath%
SetFolderVariable fvar_ackcomment '%AckComment%' -inheritpartly
RESULT: %fvar_ackcomment% = blank
RESULT:
[09.30.2023 22:48:07] Sys Error: Unterminated string, ' missing (line # 3:1, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command -ClearedAt (line # 3:2, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command [testuser] (line # 3:3, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command [testuser] (line # 3:4, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command [testuser] (line # 3:5, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command [testuser] (line # 3:6, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command [testuser] (line # 3:7, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command [testuser] (line # 3:8, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command -ClearedAt (line # 3:9, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command [testuser] (line # 3:10, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command [testuser] (line # 3:11, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command [testuser] (line # 3:12, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command [testuser] (line # 3:13, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command [testuser] (line # 3:14, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command [testuser] (line # 3:15, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command [testuser] (line # 3:16, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:48:07] Sys Error: Wrong command [testuser] (line # 3:17, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
#HMS Example 6 (This one fails as shown in the system log)
ResolveMacros Yes
SetCurrentFolder %FullPath%
SetFolderVariable fvar_ackcomment "%AckComment%" -inheritpartly
RESULT: %fvar_ackcomment% = blank
RESULT:
[09.30.2023 22:50:11] Sys Error: Unterminated string, " missing (line # 3:1, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:2, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command -ClearedAt (line # 3:3, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:4, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:5, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:6, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:7, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:8, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:9, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command -ClearedAt (line # 3:10, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:11, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:12, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:13, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:14, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:15, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:16, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:17, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
[09.30.2023 22:50:11] Sys Error: Wrong command [testuser] (line # 3:18, script: d:\shares\HM_Scripts\set_fvar_ackcomment.hms)
#HMS Example 4 (This time I entered a quoted string in the ACK comment screen)
ResolveMacros Yes
SetCurrentFolder %FullPath%
SetFolderVariable fvar_ackcomment %AckComment% -inheritpartly
I entered the Acknowledgment string with quotes "WORD1 WORD2 WORD3"
RESULT: Those quotes are passed to the HMS and the entire string ends up in the folder variable.
I realize %AckComment% could contain multi-line text if operators append acknowledgements to an already ack'd text (or if we have KeepAckCommentNDays=1 set). And I realize the fvar can only contain one line.
Therefore I think we need a way for applicable commands in HMS (e.g. SetFolderVariable and others) to account for this by either capturing just the first line of any multi-line variable or stripping out the CR/LF, and of course handing the quotes for strings with spaces. Perhaps a new HMS command that lets us select the treatment of multi-line variables. This way we don't break the current logic but we get to choose how we want each script to handle these scenarios. Kind of like how ResolveMacros changes script behavior.
Thoughts, or am I completely missing the basics?
![:roll:](./images/smilies/icon_rolleyes.gif)