Exectute External Program and Global Variables
-
- Posts: 9
- Joined: Tue Jan 09, 2007 8:15 am
Exectute External Program and Global Variables
Execution of global variables does not seem to work when you execute a external program.
Can this be confirmed?
I am trying to use &Fullpath&. I have all my test structured as such that top folder is ofcourse ROOT, but next one is my Customer Code, and Third is location. So with the passing of this variable i will be able to create tickets by customer, location, server, test.
Thanks,
Can this be confirmed?
I am trying to use &Fullpath&. I have all my test structured as such that top folder is ofcourse ROOT, but next one is my Customer Code, and Third is location. So with the passing of this variable i will be able to create tickets by customer, location, server, test.
Thanks,
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
Re: Exectute External Program and Global Variables
Do you have problems with Global macro variables ( http://www.ks-soft.net/hostmon.eng/mfra ... m#udvmacro ) or with test ralated varibles ( http://www.ks-soft.net/hostmon.eng/mfra ... .htm#macro )r00t-shell wrote:Execution of global variables does not seem to work when you execute a external program.
Sorry, could not reproduce the problem. Everything should work if you specify string like this:r00t-shell wrote:Can this be confirmed?
Code: Select all
C:\Temp\some_program.exe %udv_some_global_variable% %TestName% %Reply%
Could you provide an example of the string, you have specified into "Command Line" box of "Action properties" window? What parameters do you want to pass to this program? Does it work if you run it from the command line? What exact macro variables do you use?r00t-shell wrote:I am trying to use &Fullpath&. I have all my test structured as such that top folder is ofcourse ROOT, but next one is my Customer Code, and Third is location. So with the passing of this variable i will be able to create tickets by customer, location, server, test.
Regards,
Max
-
- Posts: 9
- Joined: Tue Jan 09, 2007 8:15 am
Problem is with test related variables.
Here is what i am entering for the test with external program:
C:\Master-ReadLog.exe %Fullpath% mastertest
I have tested this with command line with the following:
C:\Master-ReadLog.exe root\TEST\MAIN mastertest
It will return what i exepect,ed and it's returning the proper error level ( tested with batch )
Now, if i use:
C:\Master-ReadLog.exe \root\TEST\MAIN mastertest
I will return the proper error code for the reply.
It's like it won't accept the test varible for the argument. I've tried everything with or without quotes.
Thanks,
Here is what i am entering for the test with external program:
C:\Master-ReadLog.exe %Fullpath% mastertest
I have tested this with command line with the following:
C:\Master-ReadLog.exe root\TEST\MAIN mastertest
It will return what i exepect,ed and it's returning the proper error level ( tested with batch )
Now, if i use:
C:\Master-ReadLog.exe \root\TEST\MAIN mastertest
I will return the proper error code for the reply.
It's like it won't accept the test varible for the argument. I've tried everything with or without quotes.
Thanks,
-
- Posts: 9
- Joined: Tue Jan 09, 2007 8:15 am
Followup:
I cut all code out of the program and made it do the following.
Take the argument passed to the program, and write it to a test file.
It will just return the variable name passed, not the contents of the variable.
"C:\MASTER-READLOG.EXE" %FullPath%
The above is the path to the external program test. In my output.txt file i just receieve %FullPath%, rather than \root\TESST\main as i would have hoped.
Any ideas?
I cut all code out of the program and made it do the following.
Take the argument passed to the program, and write it to a test file.
It will just return the variable name passed, not the contents of the variable.
"C:\MASTER-READLOG.EXE" %FullPath%
The above is the path to the external program test. In my output.txt file i just receieve %FullPath%, rather than \root\TESST\main as i would have hoped.
maybe i wasn't clear in this part at first. What i'm doing is not part of the "Action Properties" window. I am trying to pass these Test Varibles to a external program as a TEST Itself - NOT as an action which is a result of a bad test.Could you provide an example of the string, you have specified into "Command Line" box of "Action properties" window? What parameters do you want to pass to this program? Does it work if you run it from the command line? What exact macro variables do you use?
Any ideas?
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
So, are we talking about External Test ( http://www.ks-soft.net/hostmon.eng/mfra ... m#execheck )? Sorry, I thouht You have problems with "Execute external program" action.
Macro varables are not allowed in "External program" test method. You should specify exact values as parameters, not variables. However, you may use macro variables in "Execute external program" action ( http://www.ks-soft.net/hostmon.eng/mfra ... htm#actPrg ).
Regards,
Max
Macro varables are not allowed in "External program" test method. You should specify exact values as parameters, not variables. However, you may use macro variables in "Execute external program" action ( http://www.ks-soft.net/hostmon.eng/mfra ... htm#actPrg ).
Regards,
Max
-
- Posts: 9
- Joined: Tue Jan 09, 2007 8:15 am
Is this just something that can't be added? I think it would serve many benefits.
The reason i'm looking for this is so that i can know where my exectued program should look for a log file without having to create a different master test for every customer.
What my program does it this. It takes the folder path, splits it, removes root, takes the next folder as the customer id, and the next as the customer location.
It then takes those variables and checks a specific folder structure for each customer looking for a log file. If there is a logfile, it raises error level to 1 which triggers a seperate program that will enumerate all the failed tests in that log file and create a single ticket for all issues.
Anyhow,
The reason i'm looking for this is so that i can know where my exectued program should look for a log file without having to create a different master test for every customer.
What my program does it this. It takes the folder path, splits it, removes root, takes the next folder as the customer id, and the next as the customer location.
It then takes those variables and checks a specific folder structure for each customer looking for a log file. If there is a logfile, it raises error level to 1 which triggers a seperate program that will enumerate all the failed tests in that log file and create a single ticket for all issues.
Anyhow,
Where do i find the specification of the parameters for the "external test" elsewhere as in row "External Program"? I don't see anything related to parameters?!KS-Soft wrote:You cannot use variables as parameters of the test because you may specify such parameters directly in Test Properties dialog.
I'm also interested in passing of macro variables to an external program to deliver the current date to a program which returns an errorlevel when finding a specific text in a logfile.
External Program:
"D:\embit\Batch\Tools\CEBuildTools.exe" FindInFile2 "D:\embit\_PRODUKTIVSYSTEM_\_WebDaten_\RDF_aktuell\_Status_.txt" "FTP-Transfer fertig: %dd%.%mm%.%yyyy%"
(by the way: cannot be done with "Text Log" test, as some re-calculation of the date is necessary, which is done in CEBuildTools.exe)
Regards
Chris
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
There is nothing special in "External Program" test parameters. You just should specify external program name into "External program" input box and add parameters, separated by space, like:apoxxo wrote:Where do i find the specification of the parameters for the "external test" elsewhere as in row "External Program"? I don't see anything related to parameters?!
Code: Select all
some_program.exe param1 param2 ... etc.
As Alex wrote above, you cannot use any variables as parameters of the "External Program" test. However, I would suggest you following solution. You should create simple .bat file like the following:apoxxo wrote:I'm also interested in passing of macro variables to an external program to deliver the current date to a program which returns an errorlevel when finding a specific text in a logfile.
External Program:
"D:\embit\Batch\Tools\CEBuildTools.exe" FindInFile2 "D:\embit\_PRODUKTIVSYSTEM_\_WebDaten_\RDF_aktuell\_Status_.txt" "FTP-Transfer fertig: %dd%.%mm%.%yyyy%"
Code: Select all
@echo off
rem %1 - Log file name
call C:\get_date.bat
D:\embit\Batch\Tools\CEBuildTools.exe FindInFile2 "%~1" "FTP-Transfer fertig: %Day%.%Month%.%Year%"
Code: Select all
D:\bat_file_name.bat "D:\embit\_PRODUKTIVSYSTEM_\_WebDaten_\RDF_aktuell\_Status_.txt"
Code: Select all
REM get_date.bat Script retrieves system date and parse it.
REM Output variables:
REM %Year%, %Month%, %Day%
REM %iDate%,%sDate% - Date Separators from registry
rem Select date
:: Export registry's date format settings to a temporary file
START /W REGEDIT /E _TEMP.REG "HKEY_CURRENT_USER\Control Panel\International"
:: Read the exported data
FOR /F "tokens=2* delims==" %%A IN ('TYPE _TEMP.REG ^| FIND /I "iDate"') DO SET iDate=%%A
FOR /F "tokens=2* delims==" %%A IN ('TYPE _TEMP.REG ^| FIND /I "sDate"') DO SET sDate=%%A
DEL _TEMP.REG
SET iDate=%iDate:"=%
SET sDate=%sDate:"=%
IF %iDate%==0 FOR /F "TOKENS=1-4* DELIMS=%sDate%" %%A IN ('DATE/T') DO (
SET Year=%%C
SET Month=%%A
SET Day=%%B
)
IF %iDate%==1 FOR /F "TOKENS=1-4* DELIMS=%sDate%" %%A IN ('DATE/T') DO (
SET Year=%%C
SET Month=%%B
SET Day=%%A
)
IF %iDate%==2 FOR /F "TOKENS=1-4* DELIMS=%sDate%" %%A IN ('DATE/T') DO (
SET Year=%%A
SET Month=%%B
SET Day=%%C
)
:: Remove the day of week if applicable
FOR %%A IN (%Year%) DO SET Year=%%A
FOR %%A IN (%Month%) DO SET Month=%%A
FOR %%A IN (%Day%) DO SET Day=%%A
If you explain how exactly you want to parse log file, I will suggest you the appropriate solution.apoxxo wrote:(by the way: cannot be done with "Text Log" test, as some re-calculation of the date is necessary, which is done in CEBuildTools.exe)
Regards,
Max