Imacro Browser HELP ME PLS

Discussions and Tech Support specific to the iMacros Firefox add-on.
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
Post Reply
ABooth
Posts: 223
Joined: Mon Aug 10, 2009 4:25 pm

Imacro Browser HELP ME PLS

Post by ABooth » Fri Aug 14, 2009 2:55 pm

Hallo. Ich komme aus England. Verzeihung mein herr, mein Deutsch ist nicht gut. Ich würde 2 Makro verursachen und Javascript verwenden.

Javascript würde einen Timer benutzen, um die Makro durchzuführen.

Das erste Makro erhält den Bildnamen
Das zweite Makro klickt das entsprechende Bild an

Javascript extrahiert den Bildnamen vom ersten Makro
Javascript schickt den Bildnamen zum zweiten Makro

Verstehen Sie bitte, die folgenden Informationen ist ein Beispiel. Ich habe nicht dieses geprüft, weil ich nicht die Sicherheitsseite habe

Ist hier das Javascript (security.js)

const TIMER = 10; // Seconds to wait between retries
const SUCCESS = 1; // Macro completed successfully.
const EXTRACT_SEPARATOR = "[EXTRACT]"; //The EXTRACT command separates each extracted value with this string
const TAG_NOT_FOUND = "#EANF#"; //When an extract attempt was made on a tag that could not be found, this is returned

function main(){
startChecking();

// Do some other scripting here

// Stop (Halt) the Loop
checkSecurity(true);
}

function startChecking(){
setTimeout("checkSecurity()", TIMER * 1000 );
}

/*
Perform a check to see if the security check appears and click the image that corresponds to the test image
Note: Prevent perpetual retries by calling this function, setting stop to true
*/
function checkSecurity(stop){
if (true == stop) return;


// Look for the check.
if (SUCCESS == iimPlay("check.iim")){

var returnImage = "";
var data = iimGetLastExtract();

if (data.length > 0){
var values = data.split(EXTRACT_SEPARATOR).sort(); //Convert to an array and put all the result at the bottom of the array

//Get the image name to return if the last item in the array is not #EANF#
//Note: As the images have the same name, except the "text pic" image has a '2', I'm returning the "text pic" name with the 2 trimmed
returnImage = (TAG_NOT_FOUND == values[values.length -1])? "": values[values.length -1].replace("2", "");
}

// We found an image, so click it.
if (returnImage.length > 0 ){
iimSet("result", returnImage); // Pass this variable to the macro
iimPlay("check return.iim"); // Run the macro that clicks the image button
}
}

startChecking(); // Continue the process to check again (until this function is called with stop set to true)

}

main(); //This is where the script starts

Ist hier das erste Makro (check.iim)

'Default TimeOut
SET !VAR1 20

'Quick TimeOut
SET !VAR2 2

SET !TIMEOUT {{!VAR1}}

'Prevent EXTRACT from displaying a dialog box
SET !EXTRACT_TEST_POPUP NO

SET !TIMEOUT {{!VAR2}}
' Search for each image and if found, it will put it's SRC
' attribute into an array, returned to the calling script
TAG POS=1 TYPE=IMG ATTR=SRC:herz2.bmp EXTRACT=SRC
TAG POS=1 TYPE=IMG ATTR=SRC:sonne2.bmp EXTRACT=SRC
TAG POS=1 TYPE=IMG ATTR=SRC:dog2.bmp EXTRACT=SRC
TAG POS=1 TYPE=IMG ATTR=SRC:Flug2.bmp EXTRACT=SRC
TAG POS=1 TYPE=IMG ATTR=SRC:Schmett2.bmp EXTRACT=SRC
TAG POS=1 TYPE=IMG ATTR=SRC:tel2.bmp EXTRACT=SRC
TAG POS=1 TYPE=IMG ATTR=SRC:katze2.bmp EXTRACT=SRC
TAG POS=1 TYPE=IMG ATTR=SRC:feuer2.bmp EXTRACT=SRC
TAG POS=1 TYPE=IMG ATTR=SRC:kleeb2.bmp EXTRACT=SRC

Ist hier das zweite Makro (check return.iim)

SET !TIMEOUT 20

'Click the returned image
TAG POS=1 TYPE=IMG ATTR=SRC:{{result}}
iMacros for Firefox supports JavaScript Macros (Scripting)
JavaScript supports Java via LiveConnect

Therefore: You can write powerful macros with iMacros for Firefox. Have a look at this one

Post feature requests here. Maybe one day, they'll pin it?
Hannes, Tech Support

Re: Imacro Browser HELP ME PLS

Post by Hannes, Tech Support » Mon Aug 17, 2009 9:14 am

Hi,

I don't see anything suspicious in your JavaScript code. And the procedure is just right: try the TAG command, check the return value, then use a conditional on it.

However, I'm actually not sure whether macro names with blank spaces are handled, so you may need to rename "check return.iim".
Post Reply