Normally we can use variable in imacro using SET tag, such as
SET myDelay 10
WAIT SECONDS={{myDelay}}
I need to know, is there any way to use 5-10 lines in a variable. Such as:
WAIT SECONDS=25
URL GOTO=........
WAIT SECONDS=15
SET !TIMEOUT_STEP 15
I want to use whole the above code in a variable. Cause i need to use those line many times in a macro script and i need to change also those lines. So its tough to change every line every time. If i could use a variable then it will easier for me to change only the variable and all the rest data will be working according to this variable.
OR if you have any idea how to do it?
Related
I have a value I am trying to increment by 1 in a DynamoDB row. The first time this is executed, the parameter does not exist, so it would be set to one. However, I want it to fail if it gets up to a specific value so it can only be updated so many times.
I am using the correct Expected syntax, but I can't seem to figure out a way to allow this currently without a double update: One to update if it's not there, and one do it if it is there and below the threshold. Is this possible in a single update command?
Please note, this is not the same thing as simply wanting a value to be set to 1 or add up from there as suggested in the comments below, but instead, this single expression must handle the property being there or a number, and then continue to add up a certain threshold, and then fail and not allow an update once the threshold is met.
Ok, I believe that this is possible, but only if you switch the whole update command over to using expressions instead of using the "Expected" and "AttributeUpdates" field. This does make it much harder to use, but then you should be able to make compound conditions such as
params.ConditionExpression = 'attribute_not_exists(#A) OR #A < ' + maxValue.toString();
For testing a POST request to an API, I'm using postman. What I'm trying to achieve is that every request I do selects some data from a big file (randomly) and uses this data to populate the body of the request.
What I would like is that I can select for example 10 iterations and have every one of this iterations pick some random data out of the file I would provide.
I have this working for 1 iteration.
The problem is that in Postman I can't find a way to use the data for the first iteration for all iterations.
A workaround could be to copy-paste the data for every iteration I would like to do, but since this will be a rather large dataset I would like to avoid this.
In short, I'm looking for a way to provide a file to the postman runner and use the data in that file for every iteration I would run.
You can try and call your request in a while function with pm.setNextRequest('nameOfYourRequest');
function reccurrentCall(iterations){
while(iterations !== 0){
postman.SetNextRequest('nameOfYourRequest');
iterations--;
};
And call the function with number of Iterations you want to make
recurrentCall(5);
I am given a config file that looks like this for example:
Start Simulator Configuration File
Version/Phase: 2.0
File Path: Test_2e.mdf
CPU Scheduling Code: SJF
Processor cycle time (msec): 10
Monitor display time (msec): 20
Hard drive cycle time (msec): 15
Printer cycle time (msec): 25
Keyboard cycle time (msec): 50
Mouse cycle time (msec): 10
Speaker cycle time (msec): 15
Log: Log to Both
Log File Path: logfile_1.lgf
End Simulator Configuration File
I am supposed to be able to take this file, and output the cycle and cycle times to a log and/or monitor. I am then supposed to pull data from a meta-data file that will tell me how many cycles each of these run (among other things) and then im supposed to calculate and log the total time. for example 5 Hard drive cycles would be 75msec. The config and meta data files can come in any order.
I am thinking I will put each item in an array and then cycle through waiting for true when the strings match(This will also help detect file errors). The config file should always be the same size despite a different order. The metadata file can be any size so I figured i would do a similar thing but in a vector.
Then I will multiply the cycle times from the config file by the number of cycles in the matching metadata file string. I think the best way to read the data from the vector is in a queue.
Does this sound like a good idea?
I understand most of the concepts. But my data structures is shaky in terms of actually coding it. For example when reading from the files, should I read it line by line, or would it be best to separate the int's from the strings to calculate them later? I've never had to do this that from a file that can change before.
If i separate them, would I have to use separate arrays/vectors?
Im using C++ btw
Your logic should be:
Create two std::map variables, one that maps a string to a string, and another that maps a string to a float.
Read each line of the file
If the line contains :, then, split the string into two parts:
3a. Part A is the line starting from zero, and 1-minus the index of the :
3b. Part B is the part of the line starting from 1+ the index of the :
Use these two parts to store in your custom std::map types, based on the value type.
Now you have read the file properly. When you read the meta file, you will simply look up the key in the meta data file, use it to lookup the corresponding key in your configuration file data (to get the value), then do whatever mathematical operation is required.
What I'm really doing is trying to set a watchpoint on the setting or clearing of a single bit. I do that by setting a watchpoint on the word containing the bit, then making it conditional on *word & mask (for setting, or (~*word) & mask for clearing.)
The problem is that some other bit in the same word may be modified, and the condition may happen to already match. If I had the old and new values, I could set a condition of (($old ^ $new) & mask).
I looked at the python gdb.Breakpoint class, but it doesn't seem to receive this information either.
I suppose I could go crazy and set a command list that records the current value whenever the value of *word changes, and use that as $old. But half the time I'm using this, I'm actually using it through rr, so I might be going backwards.
There's no direct way to get these values in gdb; it's been a wish-list bug (with your exact case as the example...) for years.. The information is stored in the old_val field of the struct bpstats object associated with the breakpoint; but this is only used to print the old value and not exposed elsewhere.
One option might be to change gdb to expose this value via a convenience variable or via Python.
I suppose I could go crazy and set a command list that records the current value whenever the value of *word changes, and use that as $old. But half the time I'm using this, I'm actually using it through rr, so I might be going backwards.
This seems doable. Your script could check the current execution direction. The main difficulty is remembering to reset the saved value when making this watchpoint, or after disabling and then re-enabling it.
I want to create a script, where the users inputs in the beginning something, and this variable input should be used for the rest of the loop (without asking for input again).
The best way i could come up with was to create two iMacros, one which asks for the input, and the other one who uses the input and loops it.
The major problem is, i can't save the input in Downloads/Datasource because the same iMacros should be used with other firefox instances. Which means, if the user inputs A on the first instance and on the next B then after the second loop of both all instances are using the varaible B. And i can't make multiple scripts since the user should have the ability to use unlimited times this script.
You can save easy the input in ‘Downloads/Datasource’. However make your second macro read this input only once:
SET !LOOP 1
SET !DATASOURCE inputs.csv
SET input EVAL("('{{!LOOP}}' == 1) ? '{{!COL1}}' : '{{input}}';")
' your further code here '