Need Help To Save Varibale To .Ini File
Forum rules
iMacros EOL - Attention!
The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely,
The Progress Team
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
iMacros EOL - Attention!
The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely,
The Progress Team
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
-
- Posts: 12
- Joined: Wed Jul 01, 2009 11:14 am
Need Help To Save Varibale To .Ini File
hi, I am in a problem and need help,
I want to save the variable ({{!LOOP}}) to a .ini file (guess c:\test.ini", under "Loop" section and key Name "Current Loop". But I can't i tried this :
--------------------------------------------------------------
ADD !EXTRACT {{!LOOP}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=URL.CSV
--------------------------------------------------------------
But the problem is it does always add a new line with new value.
But i want to set the value to a specific line, just like .ini file.
so, is there a way to save variable to .ini file.
So, Please guys help me out, it is very urgent....
I want to save the variable ({{!LOOP}}) to a .ini file (guess c:\test.ini", under "Loop" section and key Name "Current Loop". But I can't i tried this :
--------------------------------------------------------------
ADD !EXTRACT {{!LOOP}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=URL.CSV
--------------------------------------------------------------
But the problem is it does always add a new line with new value.
But i want to set the value to a specific line, just like .ini file.
so, is there a way to save variable to .ini file.
So, Please guys help me out, it is very urgent....
-
- Posts: 12
- Joined: Wed Jul 01, 2009 11:14 am
Re: Need Help To Save Varibale To .Ini File
hi, Where is Tech Support , I need this solution very urgent... please help me out?
Re: Need Help To Save Varibale To .Ini File
If you need priority help, please cf. http://www.iopus.com/service/support/options.htm for our Gold Level Support Package.
(Note that replying to your own post drops your topic from the list of unanswered topics.)
SAVEAS always appends using a new line. However, when calling the macro from a script, you can use the script's means to place the !LOOP number wherever you want. But then - in case you do use a script, you should run the macro in a script's loop and write the script's loop variable to your .ini file.
(Note that replying to your own post drops your topic from the list of unanswered topics.)
SAVEAS always appends using a new line. However, when calling the macro from a script, you can use the script's means to place the !LOOP number wherever you want. But then - in case you do use a script, you should run the macro in a script's loop and write the script's loop variable to your .ini file.
Re: Need Help To Save Varibale To .Ini File
Client side file loading and saving: Click here. Note: This requires JAVA.
This includes tips on how to load and save files, so you could load an existing .ini file, or a template with tags, then insert your data and save.
Example: -
C:\templates\myApp.ini.template
Example.js
This includes tips on how to load and save files, so you could load an existing .ini file, or a template with tags, then insert your data and save.
Example: -
C:\templates\myApp.ini.template
Code: Select all
username=[user]
password=[pass]
url=[url]
Code: Select all
// Insert functions needed below, like loadFile() and writeFile()
// Insert functions needed above
iimPlay("myMacro"); //Play the macro that extracts the data
// Put the data into JavaScript variables
var userName = iimGetLastExtract(1);
var password = iimGetLastExtract(2);
var url = iimGetLastExtract(3);
var content = loadFile('C:\\templates\\myApp.ini.template'); // Load the template
// Replace the [tags] with the values
content = content.replace('[user]', userName);
content = content.replace('[pass]', password);
content = content.replace('[url]', url);
writeFile("C:\\Windows\myApp.ini", content); // Save the file
-
- Posts: 12
- Joined: Wed Jul 01, 2009 11:14 am
Re: Need Help To Save Varibale To .Ini File
Thanks ABooth, I will give it a try, but it looks like kinda complex... if you don't mind could you please give me a example for my following requirement..
Say, i run 3 Macros at the same time with loop (3 separate Firefox Window).
I want to update a single .ini file (Loop.ini). Infi File Details :
[CurrentLoop]
Loop1=Value Macro1
Loop2=Value Macro2
Loop3=Value Macro3
So, I want to update loop.ini according to current loop status for the 3 running macro.
Would you please enough kind to help me out...
Say, i run 3 Macros at the same time with loop (3 separate Firefox Window).
I want to update a single .ini file (Loop.ini). Infi File Details :
[CurrentLoop]
Loop1=Value Macro1
Loop2=Value Macro2
Loop3=Value Macro3
So, I want to update loop.ini according to current loop status for the 3 running macro.
Would you please enough kind to help me out...
Re: Need Help To Save Varibale To .Ini File
C:\Windows\Loop.ini
Note: running 3 separate instances of iMacros may cause a few issues, such as file locking, where all 3 are trying to write to the file and the possibility of 1 macro call, overwriting the status of another because one manages to save the ini file in between another loading and saving.
Code: Select all
[CurrentLoop]
Loop1=
Loop2=
Loop3=
Code: Select all
const Key = "Loop1="; // Change this for each macro.
const iniFile = 'C:\\Windows\\Loop.ini';
// Insert functions needed below
//replace below with the actual function
function loadFile(...)
{
...
}
//replace below with the actual function
function writeFile(...)
{
//
}
// Load ini file, replace text, then save ini file.
function updateStatus(value)
{
var content = loadFile(iniFile); // Load the windows initialization file
content = setKeyPairValue(content, Key, value);
writeFile(iniFile, content);
}
//Changes the value (if any) of a key pair in the target string.
function setKeyPairValue(target, key, value)
{
const newLine = '\n';
var returnValue = target;
var index = target.indexOf(key);
if (-1 != index)
{
var endOfTag = index + key.length;
var startBlock = target.substring(0, endOfTag); // Get the text before the insert
var endBlock = '';
var endOfLine = target.indexOf(newLine, index); // find the end of the line for the line with the key.
if (-1 != endOfLine)// If there's no line feed, it's the last line
endBlock = target.substring(endOfLine); // Get the end block
returnValue = startBlock + value + endBlock;
}
return returnValue;
}
// Insert functions needed above
// This is where the execution begins
updateStatus("Start");
iimPlay("part1");
updateStatus("Part 1 complete. Starting part 2");
iimPlay("part2");
updateStatus("All Done");