C - Not reading the integer variable in GetProfileInt() function in windows 7 - capl

I am using the getprofileInt() function in C for CAPL scripting, but here it is not taking the variable value defined in ini file. Its taking only default value. This is my code:
int ESPV_hex,BCM1var,BCM1Hex;
Gateway_72_msgrequest()
{
BCM1var =getProfileInt("CONFIG_SIGNAL","BCM1_ASSUEN_TEMP_UNGEF",0xFF,"SIGNALvalue_list.INI");
write("BCM signal input value %d",BCM1var);
write("BCM signal input value %x",BCM1var);
Gateway_72_Dlc8.byte(7)=BCM1var;
output(Gateway_72_Dlc8);
}
; File: SIGNALvalue_list.ini
; Contains the list of all Signals values.
[CONFIG_SIGNAL]
BCM1_Waschwasser_Sensor=10

The name of the function is GetProfileInt, not getProfileInt as you have it in your code
GetProfileInt only takes three parameters, whereas you pass four parameters, so the signature is not compatible
GetProfileInt only works with the win.ini file. You might prefer using GetPrivateProfileInt which lets you specify the .ini file to use
If you are using GetPrivateProfileInt to specify the .ini file, you really should specify the full file path to the .ini file. Otherwise the system will only look for it in the Windows directory.

Related

How to get the sim-time-limit from result files?

Apparently, OMNeT++ (i.e. version 5.1) does write every parameter and attribute into the result files, except for sim-time-limit. I checked .sca, .vec and .vci files for it, but it is not included.
I was able to write the warmup-period into the files by making it a named iteration variable but this does not work for sim-time-limit (see Errors while variable arithmetic in configuration file).
Is there any possibility to get this value written into the result files? I coulnd't find anything in the manual.
I have successfully recorded it by defining it as an iteration variable
sim-time-limit = ${timelimit= 90min}
This will write out
itervar timelimit 90min
in the .sca file.
To get sim-time-limit as a double value at the runtime:
cConfigOption simTimeConfig("sim-time-limit", true,cConfigOption::Type::CFG_DOUBLE, "s", "300", "");
double maxSimTime = cSimulation::getActiveSimulation()->getEnvir()->getConfig()->getAsDouble(&simTimeConfig);
Source:
https://syntaxsugar.de/posts/omnetpp-reading-parameters/

nsis - How to set VIProductVersion at runtime

I have .ini file that contains a file version (like X.X.X.X).
So, I used ReadINIStr to get the version in 'var' format.
ReadINIStr $0 "C:\Users\a\Downloads\Info.ini" "Version" "VersionNumber"
StrCpy $varVersion $0
The above code results in the value of 'varVersion' being stored in the Version in the ini file.
So far, the values I want are well stored.
However, the value to be used for VIProductVersion must be a value using !define.
Can not use a variable other than !define?
If variable is not available, can I store the value of a particular entry in the ini file in !define?
I know that the contents of the file can be read using the !define /file command. However it is my intent to read only the entry value of the ini file.
VIProductVersion is an attribute stored in your installer .exe and can only be set at compile-time by makensis.
You can use any of the pre-processor instructions like !define and !searchparse to read/store the version but there is no instruction you can use to read .ini files. !searchparse can be used in a pinch if the .ini value name is only used once in the entire file because it does not understand .ini sections.

How do I pass in a parameter value to a vbscript I want to run

I am trying to write a script to create a flg file after a filemovement that is empty but just indicates the file moved before it has been sent successfully. Since this will be used repeately for many differnt file movements with many different destination locations and many differnt names for the flg file, I want to send in parameters to the script.
I have successfully gotten the script to create the file if I hardcode the directory and filename values. But I can't figure out how I would sent the variable values that my MoveIt task has already defined and populated into the script to be the values of strDirectory and strFile variables in the script.
I tried just setting the parameters for the process in MoveIt using the same name as the variables in the script and that didn't work.
I tried something called WScript.Arguments, and that didn't work:
strDirectory = Wscript.Arguments.Item(0)
strFile = Wscript.Arguments.Item(1)
Not sure what else to try.
Use MIGetTaskParam(ParamName) inside the VB script and pass the directory and file names as parameters on the script itself.
For example, on the process step add a parameter called "PATH" and populate it with the macro [FullPath].
Inside the script get the value with something like:
myfullpath = MIGetTaskParam(PATH)
Unfortunately there is not a macro that will give you just the full path without the filename, so you'll have to split it up in VB yourself.

How to add an exe path to the windows registry, to get executed on the native mode?

I have to run an exe file in the native mode so i guess adding it to the registry is the only option i am having.Please give some input how this can be done?
I believe you're thinking of the BootExecute value, located in this key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
This is a REG_MULTI_SZ value, i.e., it contains multiple strings. Each string contains an arbitrary identifier, the name of the executable to run, and the arguments to pass to the executable. For example, the default setting contains only one string:
autocheck autochk *
Here autocheck is an arbitrary label, autochk indicates that the executable to run is c:\windows\system32\autochk.exe, and * is the argument string passed to autochk.exe.

Using user defined variables in the path of a results file in JMeter

I want to write a results CSV file in JMeter which contains a variable in path of the file I write.
E.g.
C:\\Users\\User1\\test-results\\${output}.csv
But I only seem to be able to use predefined variables like ${__time(ddMMyyHHmmss)}
Is there a way to use user defined variables in the path? I have successfully done this to find input files by defining the variable in the test plan node as a User Defined Variable.
I managed to use user defined variable in the path of result file using JMeter 2.9. REPORT is a user defined variable with value REPORT. It gives me file named REPORT.csv
In JMeter 3.1(?) (or Windows?) a double slash is required in the path.
I have used the following successfully:
c:\\jmeter\\results\\${testId}\MyReport.csv
c:\\jmeter\\results\\${testId}\MyReport.csv
c:\\jmeter\\results\\${__time(yyyyMMddHHmm)}\MyReport.csv
c:\\jmeter\\results\\${__time(yyyyMMddHHmm)}.csv
${testId} is a User Defined Variable configured in the Test Plan and set to ${__time(yyyyMMddHHmm)}

Resources