Extend Your Firefox iMacros
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
Extend Your Firefox iMacros
Hi All,
I want to share my little work on imaros mods.
Add some useful functions:
1. file read/write
2. register function: remember the status of your script
3. sqlite function: extract web data into database
4. delay play your imacros
The more useful I think is: extension support. Write your extension and place it into Exts directory adn load it in code.
For example, there is a jquery extension in attach. You can use jquery like this:
iimLoadExt('jquery.js');
alert(jQuery.trim(' abcd '));
iimPlay("CODE:URL GOTO=http://www.baidu.com");
$("#su").val('Google');
-----------------------------------------------------------------------------------------------------------------
This is how:
First download the attachment, and extract to your imacros working directory. It looks like this:
imacros
-- Macros
-- Datasources
-- Datasources
-- Exts
Then open the imacros.jar, find the file browserOverlay.xul, add:
<script type="application/x-javascript;version=1.7" src="chrome://imacros/content/ext.js"/>
Save it!
Last, drop file "ext.js" into the imacros.jar.
Now it should work.
I want to share my little work on imaros mods.
Add some useful functions:
1. file read/write
2. register function: remember the status of your script
3. sqlite function: extract web data into database
4. delay play your imacros
The more useful I think is: extension support. Write your extension and place it into Exts directory adn load it in code.
For example, there is a jquery extension in attach. You can use jquery like this:
iimLoadExt('jquery.js');
alert(jQuery.trim(' abcd '));
iimPlay("CODE:URL GOTO=http://www.baidu.com");
$("#su").val('Google');
-----------------------------------------------------------------------------------------------------------------
This is how:
First download the attachment, and extract to your imacros working directory. It looks like this:
imacros
-- Macros
-- Datasources
-- Datasources
-- Exts
Then open the imacros.jar, find the file browserOverlay.xul, add:
<script type="application/x-javascript;version=1.7" src="chrome://imacros/content/ext.js"/>
Save it!
Last, drop file "ext.js" into the imacros.jar.
Now it should work.
- Attachments
-
- Exts.rar
- (51.39 KiB) Downloaded 561 times
Re: Extend Your Firefox iMacros
Hmmm!
What a nice library, so pity that i've come across it only now.
I checked the iimPlayExt function and now wondering what's the reason behind this function.
it just prepends the code with "CODE:"
it would be great if it could at least convert handle " " spaces to "<SP>" where appropriate, e.g. "TAG POS=1 ... ATTR=CLASS:some<SP>classes"
I've found iimSqlite functions in ext.js, but is it possible to connect to some NoSQL Database like MongoDB?
Will jQuery work in different contexts once loaded?
How about the famous "TypeError: can't access dead object"?
Thanks for your hard work
What a nice library, so pity that i've come across it only now.
Code: Select all
//Execute imacro command directly, can use [SP] - ' ', [LF] - '\r', [BR] - '\n'
//eg. iimPlayExt('URL GOTO=http://www.iopus.com/');
function iimPlayExt(command) {
return iimPlay('code:' + command);
}
it just prepends the code with "CODE:"
it would be great if it could at least convert handle " " spaces to "<SP>" where appropriate, e.g. "TAG POS=1 ... ATTR=CLASS:some<SP>classes"
I've found iimSqlite functions in ext.js, but is it possible to connect to some NoSQL Database like MongoDB?
Will jQuery work in different contexts once loaded?
How about the famous "TypeError: can't access dead object"?
Thanks for your hard work
Re: Extend Your Firefox iMacros
This should be made a sticky!
It would also be great if there were some more documentation, in particular for those less experienced with programming.
I tried to use the delay function, but I couldn't get it to work
1. I followed the installation instructions above; when re-saving the jar file, I saved it as imacros.zip and then simply renamed it to imacros.jar
2. I then created a macro and javascript:
A. junk.iim
b. junk.js
Executing junk.iim works fine, but when I try to execute junk.js, I get an error:
ReferenceError: iimTaskDelayExt is not defined, line: 1 (Error code: 991)
I guess that I did not install the extension properly, but I cannot figure out what I did wrong....
I use FF22 & iMacros v8.3.0
It would also be great if there were some more documentation, in particular for those less experienced with programming.
I tried to use the delay function, but I couldn't get it to work
1. I followed the installation instructions above; when re-saving the jar file, I saved it as imacros.zip and then simply renamed it to imacros.jar
2. I then created a macro and javascript:
A. junk.iim
Code: Select all
PROMPT ("Hello")
Code: Select all
iimTaskDelayExt(junk.iim, 5);
ReferenceError: iimTaskDelayExt is not defined, line: 1 (Error code: 991)
I guess that I did not install the extension properly, but I cannot figure out what I did wrong....
I use FF22 & iMacros v8.3.0
-
- Posts: 22
- Joined: Sat May 07, 2011 6:12 am
Re: Extend Your Firefox iMacros
Thanks blueX324 for such a nice library. I started using sqlite for my work and it is good alternative for csv file to store and retrieve data.blueX324 wrote: I want to share my little work on imaros mods.
As long as I use simple query, it works. But I could not get parameterized query working with it. Please find my code below
Code: Select all
var db=new iimSqlite("test_v1.sqlite");
db.exec('create table if not exists test ([ID] text primary key,[col 1] text,[col 2] number,[col 3] text);');
alert("create table ok");
sql='insert or replace into test ([ID],[col 1],[col 3],[col 2]) values(:id, :col1, :col3, :col2);';
param=[{name:"id",value:"255"},{name:"col1",value:"col1 text"},{name:"col2",value:458752},{name:"col3",value:"col3 text"},]
alert(sql);
db.exec(sql,param);
alert("insert ok");
db.close();
Thanks.
-
- Posts: 22
- Joined: Sat May 07, 2011 6:12 am
Re: Extend Your Firefox iMacros
I have solved this issue. There was problem in binding parameter inside the library (iimext.js). I am posting the modified code here so that people need not solve it again.
I have commented old code for reference purpose.
A small change in approach now.
In earlier code, parameter was passed as param=[{name:"paramname1",value:"paramvalue1"},{name:"paramname2",value:"paramvalue2"},...]
In my modified code, I use param={paramname1:paramvalue1,paramname2:paramvalue2,...}
Similar change is required in query function also.
My code is here
I have commented old code for reference purpose.
A small change in approach now.
In earlier code, parameter was passed as param=[{name:"paramname1",value:"paramvalue1"},{name:"paramname2",value:"paramvalue2"},...]
In my modified code, I use param={paramname1:paramvalue1,paramname2:paramvalue2,...}
Similar change is required in query function also.
My code is here
Code: Select all
iimSqlite.prototype.exec = function(sql, params)
{
//this.dbConn.executeSimpleSQL(sql);
var stmt = this.dbConn.createStatement(sql);
if (typeof(params) =="object")
{
var bp;
var _params = stmt.newBindingParamsArray();
if(typeof(params.length)=="undefined")
{
bp = _params.newBindingParams();
for(var prm in params) bp.bindByName(prm, params[prm]);
_params.addParams(bp);
}
else
{
alert("error");
}
//for (var i = 0, j = params.length; i < j; i++)
//{
// var bp = _params.newBindingParams();
// bp.bindByName(params[i].name, params[i].value);
// _params.addParams(bp);
//}
stmt.bindParameters(_params);
}
stmt.execute();
stmt.finalize();
}
//params: {name1: value1,name2:value2,...}
iimSqlite.prototype.query = function(sql, params)
{
var stmt = this.dbConn.createStatement(sql);
var results = new Array();
if (typeof(params) =="object")
{
var bp;
var _params = stmt.newBindingParamsArray();
if(typeof(params.length)=="undefined")
{
bp = _params.newBindingParams();
for(var prm in params) bp.bindByName(prm, params[prm]);
_params.addParams(bp);
}
else
{
}
}
var colNames = new Array();
var i = 0;
while(1)
{
try
{
var colName = stmt.getColumnName(i++);
colNames.push(colName);
}
catch(e)
{
break;
}
}
try
{
while(stmt.executeStep())
{
var aRow = new Object();
for (var i = 0, j = colNames.length; i < j; i++)
{
aRow[colNames[i]] = stmt.row[colNames[i]];
}
results.push(aRow);
}
}
catch(aError)
{
iimDisplay("Error: " + aError.message);
}
stmt.finalize();
if (results.length == 0)
{
return null;
}
else if (results.length == 1)
{
return results[0];
}
return results;
}
Re: Extend Your Firefox iMacros
My Env: Win10 X64 FF53 iMacros8.9.7
The iMacros plugin disappeared after modified. Which version dose this method supported?
The iMacros plugin disappeared after modified. Which version dose this method supported?
Re: Extend Your Firefox iMacros
Yep, it should work in your FCI, I think, as I used it a bit recently (for some similar Customization) a few months ago on v10.0.2 for FF ('Free') + FF63 (I think), and it was still working... (Except that FF63 I was using is now "tighter" on Security and the "Model" for Add-ons got completely revamped with WebExtensions like you must know, and I had to use the Developer's Mode to be able to add/use "my own" Add-on, and I didn't bother to self-sign it as it was just for a "Test"...)
I don't understand your "disappeared"...?, or do you mean you tried to modify the 'imacros.jar' "directly" from the Add-on already installed to FF in your FF Profile...?
I'm not sure that would work indeed, and I've never tried, but that wouldn't be the "best" Method anyway, because if you ever update the Add-on and/or want to reinstall v8.9.7, your Changes will get lost.
The Method I use myself is to first download locally the '.xpi' File for the Add-on.
Make a Copy to keep the "Original".
Using '7Zip', unpack the '.xpi. File (=> 'Open Archive'), and do any Modification to any File from inside '7Zip' (=> 'Edit') before saving the/each '.xul' or '.js' File(s), and the whole '.xpi' "Container" still from '7Zip'.
Then add that new '.xpi'/Add-on to FF by drag&drop onto the Add-ons Page. Both the "original" and your customized Version can "live" together in a same FF Profile if you want, I usually customize also stg "visual" from the Side Panel to know which one is which one(!), or you may sometimes click on the "wrong" Icon to start iMacros.
And you keep your customized '.xpi' if you ever need to reinstall it, or to install it to different FF Profiles.
And if you ever update iMacros to some later Version, your Customization(s) get lost and you need to customize again the new Version. But that shouldn't really apply anymore with v8.9.7 as iMacros would then update directly to v10.0.2 with WebExtensions (provided you also update FF to v60/65) but the Content of the '.xpi' is now pretty different..., and v10.0.2 doesn't support '.js' Scripts anyway...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Re: Extend Your Firefox iMacros
chivracq wrote: ↑Fri Apr 19, 2019 1:45 pmzhedielj wrote: ↑Fri Apr 19, 2019 9:48 amThank you so much. I have modified the xpi file with your method, but I can't use the extension command.
When I use function iimLoadExt,i got a error message "ReferenceError: iimLoadExt is not defined, line: 1 (Error code: 991)
I only give one line command : iimLoadExt('jquery.js');
I saved that one line command file as test.js, and I have extract Exts.rar to my imacros working directory.
I found the 3rd floor have the same problem with me.
Re: Extend Your Firefox iMacros
zhedielj wrote: ↑Sat Apr 20, 2019 8:47 am"... and I have extract Exts.rar to my imacros working directory."zhedielj wrote: ↑Fri Apr 19, 2019 9:48 amThank you so much. I have modified the xpi file with your method, but I can't use the extension command.
When I use function iimLoadExt,i got a error message "ReferenceError: iimLoadExt is not defined, line: 1 (Error code: 991)
I only give one line command : iimLoadExt('jquery.js');
I saved that one line command file as test.js, and I have extract Exts.rar to my imacros working directory.
I found the 3rd floor have the same problem with me.
=> No, this is not correct, it is "ext.js" and not "Exts.rar" and you must place it at the exact Location in 'imacros.jar' that you specify in the 'browserOverlay.xul', and that will be: "//imacros/content/" and not your "imacros working directory.
It's 'jquerry.js' that you need to place/copy in your 'iMacros' Working Directory, in the '\Exts\' Folder... Read the Instructions from the 1st Post in this Thread...
Last edited by chivracq on Sun Apr 21, 2019 3:24 am, edited 1 time in total.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Re: Extend Your Firefox iMacros
chivracq wrote: ↑Sat Apr 20, 2019 4:00 pmzhedielj wrote: ↑Sat Apr 20, 2019 8:47 amYes, I have followed the 1 post and your's instructions to modify that xpi file.zhedielj wrote: ↑Fri Apr 19, 2019 9:48 am
"... and I have extract Exts.rar to my imacros working directory."
=> No, this is not correct, it is "ext.js" and not "Exts.rar" and you must place it at the exact Location in 'imacros.jar' that you specify in the 'browserOverlay.xul', and that will be: "//imacros/content/" and not your "imacros working directory.
It's 'jquerry.js' that you need to place/copy in your 'iMacros' Working Directory, in the '\Exts\' Folder... Read the Instructions from the 1 Post in this Thread...
1. Add two line commands in browserOverlay.xul
2.add ext.js into imacros.jar\content\
3.extract exts.rar to imacros working directory
But all the extension commands will get "* is not defined, line 1 (Error code: -991)"
Re: Extend Your Firefox iMacros
Ah OK, I had not downloaded and checked the Content of the 'Exts.rar' File attached to the 1st Post which indeed contains some 'jquery.js' Library... (from 2011 btw, must be some "old" Version, you might still want to replace it with a "newer" Version actually...)zhedielj wrote: ↑Sat Apr 20, 2019 8:47 amYes, I have followed the 1 post and your's instructions to modify that xpi file.
1. Add two line commands in browserOverlay.xul
2.add ext.js into imacros.jar\content\
3.extract exts.rar to imacros working directory
But all the extension commands will get "* is not defined, line 1 (Error code: -991)"
Your Setup now looks correct to me, I would think... Then I don't know, I've never tried this Setup as I don't use '.js' Scripts... You would need to wait/hope for sbd using this Method to hopefully be of more assistance than me then...
Last edited by chivracq on Sun Apr 21, 2019 1:23 pm, edited 1 time in total.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Re: Extend Your Firefox iMacros
chivracq wrote: ↑Sun Apr 21, 2019 3:36 amYou have given lots of help, thanks again.zhedielj wrote: ↑Sat Apr 20, 2019 8:47 am
Ah OK, I had not downloaded and checked the Content of the 'Exts.rar' File attached to the 1st Post which indeed contains some 'jquery.js' Library...
Your Setup now looks correct to me, I would think... Then I don't know, I've never tried this Setup as I don't use '.js' Scripts... You would need to wait/hope for sbd using this Method to hopefully be of more assistance than me then...