hmobron Posted July 30, 2007 Share Posted July 30, 2007 Hello, I started to create a script to automate a pricelist download. I succesfuly loging in whit IE, Select the file for download and set the fields i whant in the file. But than i stuck. I need click the Genereer button on the screen. I first try the _IEFormSubmit, but it fails true Javascript in the page. Then i try _IEAction, that result in a banner form IE that i whant to download a file. When i automate to remove de banner on the top, ie refresh the whole screen and no file is downloaded. When i stop the script just before the click and click whit the mouse there is no problem. I now open a browser by _IECreate, but i also tryed the run command whit ie.exe -extoff. But the script is than not working any more. Some advice is welcome. Link to comment Share on other sites More sharing options...
GMK Posted July 30, 2007 Share Posted July 30, 2007 Can you post what you have so far, and possibly some source code for the web site? Link to comment Share on other sites More sharing options...
jvanegmond Posted July 30, 2007 Share Posted July 30, 2007 Look up the source code of that page.. Try a _IEFormElementGetObjByName using the name you get from the source code. You can find this name by looking for something like this: <input type="button" name="submit" value="Post" /> the name used in the function would be "submit". Use the return value from that function in a _IEAction ( ... , "click" ) followed by a _IELoadWait() github.com/jvanegmond Link to comment Share on other sites More sharing options...
hmobron Posted July 31, 2007 Author Share Posted July 31, 2007 (edited) Can you post what you have so far, and possibly some source code for the web site? Oke here the source off autoit. expandcollapse popup#include <IE.au3> ; Create a browser window $oIE = _IECreate("http://reseller.*****.**") ;_IECreate()Run("C:\Program Files\Internet Explorer\iexplore.exe -extoff ") ;_IENavigate($oIE, "http://reseller.yorcom.nl") Sleep(2000) ; get point ers to the login form and username and password fields $o_frame = _IEFrameGetObjByName($oIE, "YFrame") $o_form = _IEFormGetObjByName($o_frame, "login_wf_form") $o_login = _IEFormElementGetObjByName($o_form, "klantnummer") $o_password = _IEFormElementGetObjByName($o_form, "wachtwoord") $o_loginbutton = _IEFormElementGetObjByName($o_form, "login_wf") ; Set field values and submit the form _IEFormElementSetValue($o_login, "******") _IEFormElementSetValue($o_password, "******") ;_IEFormSubmit($o_form) _IEAction ($o_loginbutton , "click") _IELoadWait ($oIE) $oFrame = _IEFrameGetCollection($oIE, 1) _IELinkClickByText ($oframe, "Prijslijst export") Sleep(2000) _IELinkClickByText ($oframe, "Csv") Sleep(2000) $o_frame = _IEFrameGetObjByName($oIE, "YFrame") $oForm = _IEFormGetObjByName($o_frame, "exporter") $o_marge = _IEFormElementGetObjByName($oForm, "Marge") _IEFormElementCheckboxSelect ($oForm, 1, "", 1, "byIndex") _IEFormElementCheckboxSelect ($oForm, 2, "", 1, "byIndex") _IEFormElementCheckboxSelect ($oForm, 3, "", 1, "byIndex") _IEFormElementCheckboxSelect ($oForm, 4, "", 1, "byIndex") _IEFormElementCheckboxSelect ($oForm, 5, "", 1, "byIndex") _IEFormElementCheckboxSelect ($oForm, 6, "", 0, "byIndex") _IEFormElementCheckboxSelect ($oForm, 7, "", 0, "byIndex") _IEFormElementCheckboxSelect ($oForm, 8, "", 0, "byIndex") _IEFormElementCheckboxSelect ($oForm, 9, "", 0, "byIndex") _IEFormElementCheckboxSelect ($oForm, 10, "", 1, "byIndex") _IEFormElementCheckboxSelect ($oForm, 11, "", 1, "byIndex") _IEFormElementCheckboxSelect ($oForm, 12, "", 1, "byIndex") _IEFormElementSetValue($o_marge, "20") $o_genereer= _IEFormElementGetObjByName($oForm, "genereer") _IEAction ($o_genereer , "click") MsgBox(0,"test",@Error); result is 0 ;_IEFormSubmit($oForm,10) ; MouseClick ("",20,200,1) ; tricker the IE banner ;Sleep(2000) ;ControlClick ("**** - Reseller systeem","","[ID:37425]") ;WinWait("Bestand downloaden") ;Send("{DOWN}") ;Send("{SPACE}") ;Send("b") Exit expandcollapse popup;HTML Page <html> <head> <link href="/includes/css/standaard.css" rel="stylesheet" type="text/css"> <script language="javascript" type="text/javascript" src="/includes/java.js"></script> <script language="Javascript"> if (top.location == self.location) { top.location = '/frame/inhoud/prijslijst/index.php?soort=csv'; } </script> <META HTTP-EQUIV="imagetoolbar" CONTENT="no"> </head> <body> <table width="730" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="730" height="22" background="/images/balk.jpg" class="headbalktxt"><img src="/images/spacer.gif" width="10" height="10" align="absmiddle" />Reseller</td> </tr> </table> <table width="720" border="0" cellpadding="0" cellspacing="15"> <tr> <td align="left" valign="top"> <script> function MouseOver(id, text){ document.getElementById(id).innerHTML = text; } function toggleRow() { var id = document.exporter.Soort.value; var disp = new Array(''); disp["total"] = new Array("Artikelnummer","Groep","SubGroep","Naam","Omschrijving","Foto","Resellerex","Resellerin","Endusex","Endusin","Stock","Marge","Margeex","Margein","genereer","Algemeen1","Algemeen2","Algemeen3"); for (x in disp["total"]){ document.getElementById( disp["total"][x]+"_disp" ).style.display="none"; } disp["excel"] = new Array("Artikelnummer","Groep","SubGroep","Naam","Omschrijving","Foto","Resellerex","Resellerin","Endusex","Endusin","Stock","Marge","Margeex","Margein","genereer","Algemeen1","Algemeen2","Algemeen3"); disp["excel2"] = new Array("Artikelnummer","Groep","SubGroep","Naam","Omschrijving","Foto","Resellerex","Resellerin","Endusex","Endusin","Stock","Marge","Margeex","Margein","genereer","Algemeen1","Algemeen2","Algemeen3"); disp["pdf"] = new Array("Artikelnummer","Groep","Naam","Resellerex","Stock","genereer","Algemeen1","Algemeen2","Algemeen3"); disp["txt"] = new Array("Artikelnummer","Groep","SubGroep","Naam","Foto","Resellerex","Resellerin","Endusex","Endusin","Stock","Marge","Margeex","Margein","genereer","Algemeen1","Algemeen2","Algemeen3"); disp["csv"] = new Array("Artikelnummer","Groep","SubGroep","Naam","Foto","Resellerex","Resellerin","Endusex","Endusin","Stock","Marge","Margeex","Margein","genereer","Algemeen1","Algemeen2","Algemeen3"); for (x in disp[id]){ document.getElementById( disp[id][x]+"_disp" ).style.display=""; } } </script><p><b>Prijslijst export systeem</b><br> Deze utility geeft u de mogelijkheid om een prijslijst te laten genereren van ons assortiment. U kunt in onderstaand schema selecteren welke informatie u in het opgegeven bestand wilt hebben. Maar eerst moet u kiezen welk soort bestand u wilt hebben. Nadat u een selectie heeft gemaakt kunt u het bestand laten genereren. Vervolgens wordt het bestand aangeboden als download. Omdat er sprake is van dagprijzen raden wij u aan elke dag een nieuwe prijslijst te genereren.</p> <p>Bij problemen kunt u contact opnemen met onze programeur, dit kunt u doen via ons <a href='/inhoud/contact/'>contact formulier</a></p><form id='exporter' name='exporter' method='post' action=''> <fieldset><legend>Maak uw selectie</legend> <table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr id='Artikelnummer_disp' style='display:none;'> <td width='150'><label for='Artikelnummer'>Artikelnummer</label></td> <td><input name='Artikelnummer' id='Artikelnummer' type='checkbox' value='1' checked /> <a onmouseover="MouseOver('Artikelnummer_om','Het artikelnummer zoals dat bij verwerkt wordt.')" onmouseout="MouseOver('Artikelnummer_om','')"><img src='../../images/info.gif'></a> <font id='Artikelnummer_om'></font></td> </tr> <tr id='Groep_disp' style='display:none;'> <td><label for='Groep'>Groep</label></td> <td><input name='Groep' id='Groep' type='checkbox' value='1' checked /> <a onmouseover="MouseOver('Groep_om','De productgroep waar het product tot behoort.')" onmouseout="MouseOver('Groep_om','')"><img src='../../images/info.gif'></a> <font id='Groep_om'></font></td> </tr> <tr id='SubGroep_disp' style='display:none;'> <td><label for='SubGroep'>Sub Groep</label></td> <td><input name='SubGroep' id='SubGroep' type='checkbox' value='1' /> <a onmouseover="MouseOver('SubGroep_om','De sub productgroep waar het product tot behoort.')" onmouseout="MouseOver('SubGroep_om','')"><img src='../../images/info.gif'></a> <font id='SubGroep_om'></font></td> </tr> <tr id='Naam_disp' style='display:none;'> <td><label for='Naam'>Naam</label></td> <td><input name='Naam' id='Naam' type='checkbox' value='1' checked /> <a onmouseover="MouseOver('Naam_om','De naam van het product, met een korte beschrijving / partnummer.')" onmouseout="MouseOver('Naam_om','')"><img src='../../images/info.gif'></a> <font id='Naam_om'></font></td> </tr> <tr id='Omschrijving_disp' style='display:none;'> <td><label for='Omschrijving'>Omschrijving</label></td> <td><input name='Omschrijving' id='Omschrijving' type='checkbox' value='1' /> <a onmouseover="MouseOver('Omschrijving_om','De omschrijving.')" onmouseout="MouseOver('Omschrijving_om','')"><img src='../../images/info.gif'></a> <font id='Omschrijving_om'></font></td> </tr> <tr id='Foto_disp' style='display:none;'> <td><label for='Foto'>Foto</label></td> <td><input name='Foto' id='Foto' type='checkbox' value='1' /> <a onmouseover="MouseOver('Foto_om','URL van een afbeelding van het product.')" onmouseout="MouseOver('Foto_om','')"><img src='../../images/info.gif'></a> <font id='Foto_om'></font></td> </tr> <tr id='Resellerex_disp' style='display:none;'> <td><label for='Resellerex'>Uw prijs excl. BTW</label></td> <td><input name='Resellerex' id='Resellerex' type='checkbox' value='1' checked /> <a onmouseover="MouseOver('Resellerex_om','Uw prijs exclusief BTW.')" onmouseout="MouseOver('Resellerex_om','')"><img src='../../images/info.gif'></a> <font id='Resellerex_om'></font></td> </tr> <tr id='Resellerin_disp' style='display:none;'> <td><label for='Resellerin'>Uw prijs incl. BTW</label></td> <td><input name='Resellerin' id='Resellerin' type='checkbox' value='1' /> <a onmouseover="MouseOver('Resellerin_om','Uw prijs inclusief BTW.')" onmouseout="MouseOver('Resellerin_om','')"><img src='../../images/info.gif'></a> <font id='Resellerin_om'></font></td> </tr> <tr id='Endusex_disp' style='display:none;'> <td><label for='Endusex'>End-user excl. BTW</label></td> <td><input name='Endusex' id='Endusex' type='checkbox' value='1' /> <a onmouseover="MouseOver('Endusex_om','End user prijs bij exclusief BTW.')" onmouseout="MouseOver('Endusex_om','')"><img src='../../images/info.gif'></a> <font id='Endusex_om'></font></td> </tr> <tr id='Endusin_disp' style='display:none;'> <td><label for='Endusin'>End-user incl. BTW</label></td> <td><input name='Endusin' id='Endusin' type='checkbox' value='1' /> <a onmouseover="MouseOver('Endusin_om','End user prijs bij inclusief BTW.')" onmouseout="MouseOver('Endusin_om','')"><img src='../../images/info.gif'></a> <font id='Endusin_om'></font></td> </tr> <tr id='Stock_disp' style='display:none;'> <td><label for='Stock'>Stock</label></td> <td><input name='Stock' id='Stock' type='checkbox' value='1' checked /> <a onmouseover="MouseOver('Stock_om','Geeft weer of een artikel op voorraad is of niet.')" onmouseout="MouseOver('Stock_om','')"><img src='../../images/info.gif'></a> <font id='Stock_om'></font></td> </tr> <tr id='Algemeen1_disp' style='display:none;'> <td> </td> <td> </td> </tr> <tr id='Marge_disp' style='display:none;'> <td>Te berekenen marge</td> <td><input name='Marge' type='text' size='4' maxlength='4' value='0' />% <a onmouseover="MouseOver('Marge_om','Voer de marge in die u wilt maken. Voorbeeld: 2.1')" onmouseout="MouseOver('Marge_om','')"><img src='../../images/info.gif'></a> <font id='Marge_om'></font></td> </tr> <tr id='Margeex_disp' style='display:none;'> <td><label for='Margeex'>Marge excl. BTW</label></td> <td><input name='Margeex' id='Margeex' type='checkbox' value='1' /> <a onmouseover="MouseOver('Margeex_om','Berekend de prijzen door met de marge die u wilt maken, exclusief BTW.')" onmouseout="MouseOver('Margeex_om','')"><img src='../../images/info.gif'></a> <font id='Margeex_om'></font></td> </tr> <tr id='Margein_disp' style='display:none;'> <td><label for='Margein'>Marge incl. BTW</label></td> <td><input name='Margein' id='Margein' type='checkbox' value='1' /> <a onmouseover="MouseOver('Margein_om','Berekend de prijzen door met de marge die u wilt maken, inclusief BTW.')" onmouseout="MouseOver('Margein_om','')"><img src='../../images/info.gif'></a> <font id='Margein_om'></font></td> </tr> <tr id='Algemeen2_disp' style='display:none;'> <td> </td> <td> </td> </tr> <tr> <td width='150'>Soort</td> <td><select name='Soort' onchange='toggleRow();'> <option value=''>Maak een keuzen</option> <option value='txt' >Txt</option> <option value='csv' selected>Csv</option> <option value='pdf' >Pdf</option> <option value='excel' >Excel html</option> <option value='excel2' >Excel xml</option> </select> <a onmouseover="MouseOver('Soort_om','Het soort bestand dat u wil exporteren.')" onmouseout="MouseOver('Soort_om','')"><img src='../../images/info.gif'></a> <font id='Soort_om'></font> </td> </tr> <tr id='Algemeen3_disp' style='display:none;'> <td> </td> <td> </td> </tr> <tr id='genereer_disp' style='display:none;'> <td> </td> <td><input type='submit' name='genereer' value='Genereer' /></td> </tr> </table> </fieldset> </form><script>toggleRow();</script></td> </tr> </table> </body> </html> Edited July 31, 2007 by hmobron Link to comment Share on other sites More sharing options...
GMK Posted July 31, 2007 Share Posted July 31, 2007 Do you get any errors? I'm wondering if this line produces an error: $o_genereer= _IEFormElementGetObjByName($oForm, "genereer") If not, then can you tell us what the error says? Link to comment Share on other sites More sharing options...
hmobron Posted July 31, 2007 Author Share Posted July 31, 2007 Do you get any errors? I'm wondering if this line produces an error: $o_genereer= _IEFormElementGetObjByName($oForm, "genereer") If not, then can you tell us what the error says? Hello GMK, thanks for you response. I did this test earlier whit MsgBox(0,"test",@Error). Result 0. After this the ie banner shows up, For securety reasons ie is blocking this download. Hope you can help me. Greetings Hans Link to comment Share on other sites More sharing options...
GMK Posted July 31, 2007 Share Posted July 31, 2007 Then it sounds like you'll need to change your security settings to allow you to download files. Link to comment Share on other sites More sharing options...
hmobron Posted August 1, 2007 Author Share Posted August 1, 2007 Then it sounds like you'll need to change your security settings to allow you to download files.How stupid, that whas trick.Thanks a lot. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now