ol3ears Posted December 7, 2005 Report Share Posted December 7, 2005 Hi all, this is in response to the 'Serious Consideration For The Me Development Team ' thread. I have started a new thread in order to give it a better title. The following is the process I have (just) started using to interact with web pages at a javascript level under ME control. Goto www.besttoolbars.net and download their toolbar studio application. This allows you to create IE toolbars that support embedded pages (either as banners or click to display 'bubbles'). These pages embedded into the toolbar are able to interact with the target web page without incurring the hassles that framing might introduce. As an example banner page here is the start point of a work in progress. On hitting the "Go" button, the banner page reads a line of text from the clipboard in the format(s) Set||theformname|fld=val|fld=val Get||theformname|fld|fld EVLWebPage.theformname.submit(); FNCSomeFunctionName('param1', 'param2') URL It returns a value to the clipboard and also leaves a visible copy of the return values in the banner text box (for debugging). This is a faster and more accurate process than click and count and is great for those long drop down list boxes. <html> <head> <script type="text/javascript"> var WebPage; function DocumentComplete(tool) { WebPage=tool.explorer; // created on page load complete } function ExecuteJavascript() { var rtn=''; if(window.clipboardData && WebPage!=null) { rtn=clipboardData.getData('Text'); switch(left(rtn,3)) // read the cmd { case 'Set': rtn=SetData(rtn); break; case 'Get': rtn=GetData(rtn); break; case 'EVL': rtn=''+eval(rtn.substring(3)); break; case 'FNC': rtn=''+WebPage.parentWindow.execScript(rtn.substring(3), 'JavaScript'); break; } } else rtn='Error'; if(window.clipboardData) clipboardData.setData('Text', rtn); document.jsfm.rxjs.value=rtn; } function SetData(cmdstr) { var x,y; var frms=cmdstr.split('||'); for(x=1;x<frms.length;x++) { var frmdta=frms[x]; var cmds=frmdta.split('|'); var frm=WebPage[cmds[0]]; for(y=1;y<cmds.length;y++) { var z=cmds[y].indexOf('='); var fld=frm[left(cmds[y],z)]; var val=cmds[y].substring(z+1); switch(fld.type) { case 'checkbox': if(val==fld.value) fld.checked=true; else fld.checked=false; break; default: fld.value=val; break; } } } return cmdstr; } function GetData(cmdstr) { var x,y; var rtn=new String('Got'); var frms=cmdstr.split('||'); for(x=1;x<frms.length;x++) { var frmdta=frms[x]; var cmds=frmdta.split('|'); rtn=rtn.concat('||',cmds[0]); var frm=WebPage[cmds[0]]; for(y=1;y<cmds.length;y++) { var fld=frm[cmds[y]]; switch(fld.type) { case 'checkbox': rtn=rtn.concat('|',fld.checked); break; default: rtn=rtn.concat('|',fld.value); break; } } } return rtn; } function left(str, n){ if (n <= 0) return ""; else if (n > String(str).length) return str; else return String(str).substring(0,n); } function right(str, n){ if (n <= 0) return ""; else if (n > String(str).length) return str; else { var iLen = String(str).length; return String(str).substring(iLen, iLen - n); } } </script> </head> <body bgcolor="#b0b0ff"> <form name="jsfm"> <span style="position:absolute;top:0;font-family:Arial;font-weight:700;"> <font color="#808080" >Javascript Interface</font> <input type="Button" name="exjs" value="Go" onClick="ExecuteJavascript()"> <input type="Text" name="rxjs" style="Background-Color:#b0b0ff;" size="90"> </span> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.