Search code examples
javascriptdomonloadimacrosonload-event

imacros javascript window.onload not working


Ive ran my script a couple of times and cant figure out why the window.onload isnt working. What am I not doing right ?

 var macro = "CODE:";
 macro += "VERSION BUILD=9002379" + "\n";
 macro += "TAB T=1" + "\n";
 macro += "TAB CLOSEALLOTHERS" + "\n";
 macro += "SET !EXTRACT_TEST_POPUP YES" + "\n";
 macro += "SET !TIMEOUT_STEP 60" + "\n";
 macro += "SET !TIMEOUT_PAGE 60" + "\n";
 macro += "SET !ERRORIGNORE YES" + "\n";
 macro += "SET !DATASOURCE C:\\imacros\\test.csv" + "\n";
 macro += "SET !DATASOURCE_COLUMNS 1" + "\n"
 macro += "SET !DATASOURCE_LINE 1" + "\n";
 macro += "URL GOTO={{!COL1}}" + "\n";
 function addlisteners(){
 window.alert("Boo !");
 }
 window.onload = addlisteners;

 iimPlay(macro);

Solution

  • I am not sure what you tried to do with the script above but this code works fine.
    
        var macro = "CODE:";
        macro += "VERSION BUILD=9002379" + "\n";
        macro += "TAB T=1" + "\n";
        macro += "TAB CLOSEALLOTHERS" + "\n";
        macro += "SET !EXTRACT_TEST_POPUP YES" + "\n";
        macro += "SET !TIMEOUT_STEP 60" + "\n";
        macro += "SET !TIMEOUT_PAGE 60" + "\n";
        macro += "SET !ERRORIGNORE YES" + "\n";
        macro += "SET !DATASOURCE C:\\imacros\\test.csv" + "\n";
        macro += "SET !DATASOURCE_COLUMNS 1" + "\n"
        macro += "SET !DATASOURCE_LINE 1" + "\n";
        macro += "URL GOTO={{!COL1}}" + "\n";
    
    
    
    
        iimPlay(macro);
    
       addlisteners();
    
    
        function addlisteners() {
            alert("Boo !");
        }
    

    How about now?