View previous topic :: View next topic |
Author |
Message |
plambrecht
Joined: 19 May 2004 Posts: 151 Location: Belgium
|
Posted: Wed Aug 25, 2004 7:37 am Post subject: Macrovars not translated in params field of Shellscript |
|
|
Hi,
I'm having troubles with a shellscript...
I'm creating a script that return a deltavalue between result and lastresult.
it needs to run on RMA's so i'm creating it as a shell script (windows).
I have a test called "Cdrive" that checks the freespace.
Next I created a new test, that has these settings
Params %::Cdrive::LastReply% %::Cdrive::Reply% 10
Enabled Translate Macros
and runs this script:
Code: | Option Explicit
const statusAlive = "Host is alive:"
const statusDead = "No answer:"
const statusUnknown = "Unknown:"
const statusNotResolved = "Unknown host:"
const statusOk = "Ok:"
const statusBad = "Bad:"
const statusBadContents = "Bad contents:"
If cStr("%LastReply%") = cStr("%" & "LastReply" & "%") then
WScript.StdOut.Write "scriptres:" & StatusBad & "Please enable \'Translate Macros\' on the Test Properties"
WScript.Quit(0)
End If
Set objArgs = WScript.Arguments
If objArgs.Count<3 Then
WScript.StdOut.Write "scriptres:" & statusUnknown & "Unsufficient Parameters"
Else
LastReply=objArgs(0)
Reply=objArgs(1)
MaxDelta=objArgs(2)
WScript.StdOut.Write "scriptres:OK:(" & LastReply & ")(" & Reply & ")(" & MexDelta & ")"
If LastReply>0 Then
Delta=(LastReply-Reply)/LastReply*100
If cInt(Delta) > cInt(MaxDelta) Then
WScript.StdOut.Write "scriptres:BAD:" & Delta & " %"
Else
WScript.StdOut.Write "scriptres:OK:" & Delta & " %"
End If
Else
WScript.StdOut.Write "scriptres:Bad contents:LastReply can't be zero"
End If
End If
Set objArgs = Nothing |
The problem now is, that the macrovars in the params field are not translated to their values, but they remain the text.
Can you try to reproduce this ?
I'm using v4.60, testing it localy without RMA
thx
Pieter |
|
Back to top |
|
|
Marcus
Joined: 18 Nov 2002 Posts: 367
|
Posted: Thu Aug 26, 2004 1:50 am Post subject: |
|
|
The macro's are translated, and passed to your script. But since vbscript does not know anything about HostMonitor, your have to read the values as if they are passed from the command line |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12795 Location: USA
|
Posted: Thu Aug 26, 2004 1:59 am Post subject: |
|
|
Quote: | But since vbscript does not know anything about HostMonitor, your have to read the values as if they are passed from the command line |
You are right.
But there is another problem - HostMonitor does not support test related variables in the "Params" field, it supports global macro variables.
Probably we can improve this.. I will check tomorrow
Regards
Alex |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12795 Location: USA
|
Posted: Thu Aug 26, 2004 9:15 pm Post subject: |
|
|
Ok, update available at www.ks-soft.net/download/hm461.zip
Now you may use test related variables as params.
Do not forget to change your script (it should use command line parameters).
Regards
Alex |
|
Back to top |
|
|
plambrecht
Joined: 19 May 2004 Posts: 151 Location: Belgium
|
Posted: Wed Sep 01, 2004 2:31 am Post subject: |
|
|
great ! thx for the quick fixes |
|
Back to top |
|
|
|