Jump to content

9tailsfox

Active Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by 9tailsfox

  1. Yes, I will. As you can see I just created very simple script but If it able to read the username and password in the excel column. In the future I just need to update the Excel list not the au3 script. Thank you :-)
  2. Hi to all expert, I need to create an automation login a website with the given username and password. After login I need to automate some task in there and then logout and then login other username and password with complete the task until the list in excel is over. How do I create an automation with the loop login username & password while complete the task aswell. I know there might be other thread but I hope I can get the answer or redirect me to the right place. thank you ; Create a browser window and navigate to Australia Post $oIE = _IECreate("https://mylocalsample.com/login/") $hwndIE = _IEPropertyGet ($oIE, "hwnd") WinSetState($hwndIE, "", @SW_MAXIMIZE) ; get pointers to the login form and username, password and signin fields Local $o_form = _IEFormGetObjByName($oIE, "mblogin") Local $o_login = _IEFormElementGetObjByName($o_form, "userid") Local $o_password = _IEFormElementGetObjByName($o_form, "password") Local $username = "Paul" Local $password = "ps4123" ; Set field values and submit the form _IEFormElementSetValue($o_login, $username) _IEFormElementSetValue($o_password, $password) ;_Submit login _IEFormSubmit($o_form) ;Click the Manifest Link _IENavigate($oIE, "https://mylocalsample.com/login/generateManifest/") Sleep(1000) ; ; ;Select Manifest BRISBANE Local $o_manifest = _IEGetObjByID($oIE, "manifest") _IEAction($o_manifest, "focus") _IEAction($o_manifest, "selectall") ClipPut ("Direct Entry Australia") _IEAction($o_manifest, "paste") ;_IEAction($o_manifestStartDate, "focus")Minus 30Days Local $o_manifestStartDate = _IEGetObjByID($oIE, "manifestStartDate") Local $oAppl = _Excel_Open() Local $oMyDocDir = @MyDocumentsDir & "\Date.xlsx" If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example", "Error Copy Date" & @CRLF & "@error = " & @error & ", @extended = " & @extended) ; Open Workbook 1 Local $oWorkbook1 = _Excel_BookOpen($oAppl, $oMyDocDir, True) Local $oRange = $oWorkbook1.ActiveSheet.Range("A4") _Excel_RangeCopyPaste($oWorkbook1.ActiveSheet, $oRange) ;paste it to program like notepad, wordpad, DMS, or msword ;WinActivate("New Zealand Post - Customs Manifests - Internet Explorer", "") _IEAction($o_manifestStartDate, "focus") _IEAction($o_manifest, "selectall") _IEAction($o_manifestStartDate, "paste") ;_IEAction($o_manifestEndDate, "focus")Today Local $o_manifestEndDate = _IEGetObjByID($oIE, "manifestEndDate") _IEAction($o_manifestEndDate, "focus") Sleep(1000) Local $o_manifestPort = _IEGetObjByID($oIE, "manifestPort") _IEAction($o_manifestPort, "focus") _IEAction($o_manifestPort, "selectall") ClipPut ("Brisbane") _IEAction($o_manifestPort, "paste") Local $o_selectedManifestDate = _IEGetObjByID($oIE, "selectedManifestDate") _IEAction($o_selectedManifestDate, "focus") Sleep(1000) Local $o_ConfirmManifest = _IEGetObjByID($oIE, "generateManifestButton") _IEAction($o_ConfirmManifest, "focus") _IEAction($o_ConfirmManifest, "click") Sleep(1000) Local $o_LodgementRef = _IEGetObjByID($oIE, "lodgementRef") _IEAction($o_LodgementRef, "focus") ClipPut ("BNE") _IEAction($o_LodgementRef, "paste") Local $o_ContinueM = _IEGetObjByID($oIE, "dijit_form_Button_0_label") ; dijit_form_Button_1_label cancel _IEAction($o_ContinueM, "click") sleep(1000) ; ; ; ;Logout _IENavigate($oIE, "https://mylocalsample.com/login/?logout") Sleep(1000) Local $o_form = _IEFormGetObjByName($oIE, "mblogin") Local $o_login = _IEFormElementGetObjByName($o_form, "userid") Local $o_password = _IEFormElementGetObjByName($o_form, "password") Local $username = "Raymond" Local $password = "Overigh23" ; Set field values and submit the form _IEFormElementSetValue($o_login, $username) _IEFormElementSetValue($o_password, $password) ;_Submit login _IEFormSubmit($o_form) ;Click the Manifest Link _IENavigate($oIE, "https://mylocalsample.com/login/generateManifest/") Sleep(1000) ; ; ;Select Manifest BRISBANE Local $o_manifest = _IEGetObjByID($oIE, "manifest") _IEAction($o_manifest, "focus") _IEAction($o_manifest, "selectall") ClipPut ("Direct Entry Australia") _IEAction($o_manifest, "paste") ;_IEAction($o_manifestStartDate, "focus")Minus 30Days Local $o_manifestStartDate = _IEGetObjByID($oIE, "manifestStartDate") Local $oAppl = _Excel_Open() Local $oMyDocDir = @MyDocumentsDir & "\Date.xlsx" If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example", "Error Copy Date" & @CRLF & "@error = " & @error & ", @extended = " & @extended) ; Open Workbook 1 Local $oWorkbook1 = _Excel_BookOpen($oAppl, $oMyDocDir, True) Local $oRange = $oWorkbook1.ActiveSheet.Range("A4") _Excel_RangeCopyPaste($oWorkbook1.ActiveSheet, $oRange) ;paste it to program like notepad, wordpad, DMS, or msword ;WinActivate("New Zealand Post - Customs Manifests - Internet Explorer", "") _IEAction($o_manifestStartDate, "focus") _IEAction($o_manifest, "selectall") _IEAction($o_manifestStartDate, "paste") ;_IEAction($o_manifestEndDate, "focus")Today Local $o_manifestEndDate = _IEGetObjByID($oIE, "manifestEndDate") _IEAction($o_manifestEndDate, "focus") Sleep(1000) Local $o_manifestPort = _IEGetObjByID($oIE, "manifestPort") _IEAction($o_manifestPort, "focus") _IEAction($o_manifestPort, "selectall") ClipPut ("Brisbane") _IEAction($o_manifestPort, "paste") Local $o_selectedManifestDate = _IEGetObjByID($oIE, "selectedManifestDate") _IEAction($o_selectedManifestDate, "focus") Sleep(1000) Local $o_ConfirmManifest = _IEGetObjByID($oIE, "generateManifestButton") _IEAction($o_ConfirmManifest, "focus") _IEAction($o_ConfirmManifest, "click") Sleep(1000) Local $o_LodgementRef = _IEGetObjByID($oIE, "lodgementRef") _IEAction($o_LodgementRef, "focus") ClipPut ("BNE") _IEAction($o_LodgementRef, "paste") Local $o_ContinueM = _IEGetObjByID($oIE, "dijit_form_Button_0_label") ; dijit_form_Button_1_label cancel _IEAction($o_ContinueM, "click") sleep(1000) ; ;Logout _IENavigate($oIE, "https://mylocalsample.com/login/?logout") Sleep(1000) ;
  3. yeah, or I if I could use or create a program tool to convert it. But now i'm writing the script and test so far so good. the only thing is the Blockinput is not working. any idea to make it work on windows 10. otherwise someone accidentally click mouse or keyboard would mess up the whole process. thanks #include <IE.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> ;Local $oAppl = _Excel_Open() ;Local $oMyDocDir = @MyDocumentsDir & "\Omg.xls" ;If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example", "Error Copy Date" & @CRLF & "@error = " & @error & ", @extended = " & @extended) ; Open Workbook 1 ;Local $oWorkbook1 = _Excel_BookOpen($oAppl, $oMyDocDir, False) ;Local $oRange = $oWorkbook1.ActiveSheet.Range("A4") ;_Excel_RangeCopyPaste($oWorkbook1.ActiveSheet, $oRange) ;paste it to program like notepad, wordpad, DMS, or msword Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookNew($oExcel, 1) Local $sWorkbook = @MyDocumentsDir & "\OMG.xls" _Excel_BookSaveAs($oWorkbook, $sWorkbook, $xlWorkbookDefault, True) Local $xlMaximized = -4137 $oWorkbook.Application.Activewindow.WindowState = $xlMaximized WinActivate ("[CLASS:NetUIHWND]", "") BlockInput(1) Sleep(2000) Sleep(1000) Send("{ALT}") Send("{a}") Send("{f}") Send("{t}") sleep(1000) ClipPut ("c:\users\thianpoh.ang\documents\Snoopy1.csv") sleep(1000) Send("^v") Sleep(1000) Send("{Enter}") Sleep(2000) Send("{Tab}") Sleep(500) Send("{Tab}") Sleep(500) Send("{DOWN}") Sleep(500) Send("{DOWN}") Sleep(500) Send("{DOWN}") Sleep(500) Send("{Tab}") Sleep(500) Send("{Tab}") Sleep(500) Send("{Tab}") Sleep(500) Send("{Tab}") Sleep(1000) Send("{Enter}") Sleep(5000) Send("^s") Sleep(2000) Send("{Enter}") Sleep(1000) Send("!{F4}") Sleep(1000) BlockInput(0)
  4. thanks for the reply. If the the CSV file I leave untouched and I wanna convert it to xls with arrayed column without open through MS Excel. I think the number won't change to (9.10942E+19). Anyway possible way just through AUTOIT ONLY to convert to XLS? thanks
  5. Semicolon to Comma.csv Yes this is edited file from the CSV semicolon to Comma. Because there are some customers details So i had edited it. please take a look. thank you
  6. Hi i need help to convert the CSV file content with ; semicolon data to Excel 2003 xls file with the array column. But there is an issue also the content of the CSV has unique number value of 20 digits. which as I know the Excel will display the number to some like "9.109442E+19" . When you click on it the cell show "91094210325010300000" it was duplicated to all other column instead of show its unique number "91094210325010331013". Please guide me as I'm trying to create automation CSV to EXCEL conversion. Thank you
  7. Pardon me as I'm asking silly questions. I'm really bad on coding and after I downloaded the UDF and I replace the xpath like below. is that correct? #region SAMPLE ; Using multiple levels as an example...made comples on purpose to demonstrate...: $xpathForumLink = "//div[@id='widget_manifest']//div[@class='dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer']" $xpathGeneralHelpSuprt = "//div[@id='widget_manifest']//div[@class='dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer']" ; Click the Last page avaiable on the page navigation...which happens to be page 6 $xpathGeneralHelpPagination = "//ul[@class='ipsPagination']/li[last()-3]/a"
  8. HI I've found the Xpath by using the chroPath tool. below is the script that I've wrote. It doesn't work. please help thanks Local $o_manifest = _IEGetObjByID($oIE, "manifest") Local $oxpath = "//div[@id='widget_manifest']//div[@class='dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer']" Local $o_manifest2 = _IEGetObjByID($oIE, $oxpath) _IEAction($o_manifest2, "focus") _IEAction($o_manifest2, "click")
  9. Hi Thanks for the reply. I believe the xpath is this $xpath = "//*[@id="widget_manifest"]/div[1]". Yes I browse your signature and I still could not understand. So how do I make this thing able to click?
  10. <td class="txt"> <div class="dijit dijitReset dijitInline dijitLeft dijitTextBox dijitComboBox" id="widget_manifest" role="combobox" widgetid="manifest" aria-labelledby="manifest_label" aria-expanded="false"><div class="dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer" data-dojo-attach-point="_buttonNode, _popupStateNode" role="presentation" popupactive="true"><input class="dijitReset dijitInputField Hi how do I write to autoit script by above given source code? I need to click it and as I know it has related to Xpath. So please help me how to link the xpath. thanks
  11. Perhaps any expert here can show me how to send IE click on the DOJO textbox? thanks
  12. Hi, First of all I would like to say i'm sorry as I don't know how to highlight the texts but hope you can understand as I'm a beginner. Lately I need to create an Automation for the below webpage. I need to login about more than hundred of accounts user to manifest their shipping @.@. My eyes started pain. Please refer the code below and the snapshot. I need create a script to select the something called DOJO and DIJIT but i'm not good on coding. Please help be base on all the source code I already copied here. Thank you HINT: The Red color highlighted is the row that I wish to input text or select. thanks <html> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-35413041-1']); _gaq.push(['_trackPageview']); _gaq.push(['_trackPageLoadTime']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>New Zealand Post - Customs Manifests</title> <link rel="stylesheet" type="text/css" href="/js/djui/1.7.2/dijit/themes/tundra/tundra.css"> <style type="text/css"> @import "/js/djui/1.7.2/dojox/grid/resources/Grid.css"; @import "/js/djui/1.7.2/dojox/grid/resources/tundraGrid.css"; label { font-size: 13px; color: #666666; margin-right: 5px; } .clickImg { border-style: none; vertical-align: middle; cursor: pointer; cursor: hand; } .errorMessage { color: red; }</style> <link rel="stylesheet" type="text/css" href="/css/velocity.css?t=20180228195504"> </head> <BODY class='tundra' marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" BGCOLOR="#FFFFFF" link="#000066" vlink="#000066" alink="#000066"> <!--Header Start--> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#ffffff"><img src="/shared/images/newzea/logo.gif" width="750" height="100" border="0" alt=""></td> </tr> </table> <!--Header End--> <table width="740" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="6" class="txt" align="right" valign="bottom" height="17"> <a href="/mba/37753x0/home/" class="linktxt">Home</a> | <a href="#" onclick="return openwin('/userprofile/userprofile.php3','ndcluserprofile', 640, 480);" class="linktxt">My Profile</a> | <a href="/mba/37753x0/login/?logout" class="linktxt">Logout</a>&nbsp; </td> </tr> <tr> <td colspan="6" class="txt" height="4"><img src="/images/transparent.gif" height="4" width="1" alt="" border="0"></td> </tr> <tr> <td width="10"><img src="/images/transparent.gif" height="2" width="10" alt="" border="0"></td> <td width="160" align="left" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="txt"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr><td class="menutitle">Customs Manifests</td></tr> <tr><td height="2"><img src="/images/transparent.gif" height="2" width="1" alt="" border="0"></td></tr> <tr><td height="2" bgcolor="#000066"><img src="/images/transparent.gif" height="2" width="1" alt="" border="0"></td></tr> <tr><td height="7"><img src="/images/transparent.gif" height="7" width="1" alt="" border="0"></td></tr> <tr> <td class="soft">This page allows you to generate a new Customs Manifest or to retrieve a previously generated Customs Manifest. Only labelled items not previously manifested, and with a collection date and time between the dates and times selected, will be included when a new manifest is generated. Cancelled jobs will be excluded.<p>Manifests can only be produced for items entered within the last 90 days. Manifests can only be re-printed for a maximum of 90 days.</p> <p>Please ensure that you have cancelled any consignments with labels that will not be used, before you request a manifest</p><br><br> <a href="http://www.adobe.com/products/acrobat/readstep2.html" target="_blank"><img src="/shared/images/template_APC/getAdobeReader.gif" width="88" height="31" alt="Get Adobe Acrobat Reader" border="0"></a> <br><br> </td> </tr> </table> </td> </tr> <tr><td width="160"><img src="/images/transparent.gif" width="160" height="1" alt="" border="0"></td></tr> </table> </td> <td width="10"><img src="/images/transparent.gif" height="250" width="10" alt="" border="0"></td> <td width="1" bgcolor="#CCCCCC"><img src="/images/transparent.gif" height="1" width="1" alt="" border="0"></td> <td width="10"><img src="/images/transparent.gif" height="1" width="10" alt="" border="0"></td> <td valign="top" class="txt"><div id="accessError" class="txt" style="display:none; width: 100%">No Customs Manifests available.</div> <div id="loader" class="txt">Please Wait - checking manifests</div> <div id="main" class="tundra" style="display:none; width: 100%"> <table cellpadding="0" cellspacing="0"> <thead> <tr><td colspan="2" class="ttxt" style="font-weight: bold; padding-bottom:5px;">Generate New Manifest</td></tr> </thead> <tr> <td><div id="generateStatus"></div> <div id="messages" style="display: none"></div> </td> </tr> <tr><td colspan="2" class="txt"><div style="padding: 15px 0 0 0;"></div>Select the Collection Date, Time range and the Type of Manifest you wish to generate.</td></tr> <tr> <td valign="top"> <table cellpadding="0" cellspacing="5"> <tr id="rowManifest"> <td class="txt" width="90"><label for="manifest">Manifest</label></td> <td class="txt"> <div id="manifest"></div> </td> </tr> <tr id="rowManifestType"> <td class="txt"><label for="manifestType">Manifest Type</label></td> <td class="txt"> <div id="manifestType"></div> </td> </tr> <tr> <td class="txt"><label for="manifestStartDate">Start Date</label></td> <td> <table cellpadding="0" cellspacing="0"><tr> <td class="txt"><div id="manifestStartDate"></div></td> <td class="txt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td> <td class="txt"><label for="manifestStartTime">Time</label></td> <td class="txt"><div id="manifestStartTime"></div></td> </tr></table> <div class="errorMessage" id="errorStartDate"></div> </td> </tr> <tr> <td class="txt"><label for="manifestEndDate">End Date</label></td> <td> <table cellpadding="0" cellspacing="0"><tr> <td class="txt"><div id="manifestEndDate"></div></td> <td class="txt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td> <td class="txt"><label for="manifestEndTime">Time</label></td> <td class="txt"><div id="manifestEndTime"></div></td> </tr></table> <div class="errorMessage" id="errorEndDate"></div> </td> </tr> <tr id="rowManifestPort"> <td class="txt"><label for="manifestPort">Port</label></td> <td class="txt"> <div id="manifestPort"></div> </td> </tr> <tr id="rowSelectionInfo"> <td colspan="2"> <div id="selectionInfo" style="border: 1px solid #999; padding: 2px; background-color: #efefef;"> <span id="minLodgementVolume"></span> <span id="numberOfJobs"></span> </div> </td> </tr> <tr> <td colspan="2"> <img src="/shared/images/template_APC/generate_grey.gif" alt="generate" id="generateManifestButton"/> </td> </tr> </table> </td> </tr> </table> <div style="padding: 20px 0 0 0;"></div> <table cellpadding="0" cellspacing="0"> <thead> <tr><td class="ttxt" style="font-weight: bold;">Retrieve Manifest</td></tr> </thead> <tr> <td valign="top"> <table cellpadding="0" cellspacing="5"> <tr> <td><label for="selectedManifestDate">Manifest Date</label></td> <td> <table cellpadding="0" cellspacing="0"><tr> <td class="txt"><div id="selectedManifestDate"></div></td> </tr></table> <div class="errorMessage" id="errorManifestDate"></div> </td> </tr> </table> </td> </tr> </table> <div style="padding: 0 0 10px 0;"> This is a list of previously generated manifests for the selected Manifest Date.<br/> Click the &nbsp;<button type='button' class='newBtn noCursorBtn'><span>pdf</span></button> or &nbsp;<button type='button' class='newBtn noCursorBtn'><span>csv</span></button> icon to retrieve the manifest you require. </div> <div id="manifestList"></div> <div id="confirmGenerate" dojoType="dijit.Dialog" title="Warning"> <script type="dojo/method" event="onHide" args="evt"> cancelGenerateManifest(); </script> <table width="250" cellspacing="10" cellpadding="0"> <tr> <td class="txt" colspan="2">Are you sure that you have cancelled any consignments with labels that will not be used?</td> </tr> <tr> <td class="txt"><label for="lodgementRef">Lodgement Reference</label></td> <td class="txt"> <div id="lodgementRef"></div> <div class="errorMessage" id="errorLodgmentRef">date error</div> </td> </tr> <tr> <td class="txt" align="right"> <button dojoType="dijit.form.Button" type="button">Continue <script type="dojo/method" event="onClick" args="evt"> validateExtras(); </script> </button> </td> <td class="txt" align="left"> <button dojoType="dijit.form.Button" type="button">Cancel <script type="dojo/method" event="onClick" args="evt"> dijit.byId("confirmGenerate").hide(); </script> </button> </td> </tr> </table> </div> </div> </td> </tr> </table> <img src="/images/transparent.gif" width="5" height="1" alt=""><img src="/images/power/ndpowered.gif" width="102" height="28" alt="Powered by NetDespatch"> </body> <script src="/js/velocityUI.js" type="text/javascript"></script> <script src="/js/dojoHelper.js?t=20180228195504" type="text/javascript"></script> <script src="/js/djui/1.7.2/dojo/dojo.js" type="text/javascript" data-dojo-config="parseOnLoad: true, async: true"></script> <script type="text/javascript"> var now = new Date(); var jsonServices; var serverTime = "2018-07-25 03:27:11"; var manifestTypeObj = ""; var activeManifestGroupsStore; var activeManifestsStore; var manifestPortStore; var availableManifestsGrid; var manifestPort; var manifestMlid; var maxDateRange = ""; var portMandatory = false; var checkMinimumVol = false; var checkLodgementRef = false; var pdfDownload = false; var minLodgementVol; var numberOfJobs; var requestedManifestTypeId; var generatingManifest = false; var generateButtonHandle = null; var selectedManifestDateInput = null; var selectedManifestDateInputHandle = null; var manifestNamesObj = null; require(["dojo", "dojox/grid/DataGrid", "dojox/data/JsonRestStore", "dojo/data/ItemFileReadStore", "dojox/rpc/Service", "dojo/date/locale", "dojo/DeferredList", "dijit/form/Button", "dijit/form/DateTextBox", "dijit/form/FilteringSelect", "dijit/Dialog", "dojox/html/entities", "dojo/dom", "dojo/domReady!"], function(dojo, dom){ hideAllFields(); jsonServices = new dojox.rpc.Service("/wssmd/manifest/manifestServices.smd", {timeout: 1}); now = dojo.date.locale.parse(serverTime, {datePattern: "yyyy-MM-dd HH:mmm:ss", selector: "date"}); createDefaultManifestStore(); getManifestNames(); activeManifestGroupsStore = getActiveManifestGroups(); var manifestStartDateInput = createDateInputWithoutIcon("manifestStartDate", now, "dd MMM yyyy"); dojo.style(manifestStartDateInput.domNode, "width", "10em"); dojo.connect(manifestStartDateInput, "onChange", inputChange); var manifestStartTimeInput = createManifestStartTimeInput(); dojo.connect(manifestStartTimeInput, "onChange", inputChange); var manifestEndDateInput = createDateInputWithoutIcon("manifestEndDate", now, "dd MMM yyyy"); dojo.style(manifestEndDateInput.domNode, "width", "10em"); dojo.connect(manifestEndDateInput, "onChange", inputChange); var manifestEndTimeInput = createManifestEndTimeInput(); dojo.connect(manifestEndTimeInput, "onChange", inputChange); getNumberOfJobs(); dojo.style(dojo.byId("loader"), "display", "none"); dojo.style(dojo.byId("main"), "display", ""); selectedManifestDateInput = createDateInputWithoutIcon("selectedManifestDate", now, "dd MMM yyyy"); dojo.style(selectedManifestDateInput.domNode, "width", "10em"); dojo.connect(selectedManifestDateInput, "onChange", function(e){ if (validManifestDateTimeFormat()) { refreshList(); } }); }); function inputChange(){ hideMessages(); resetAllErrors(); if(validateDate()){ getNumberOfJobs(); } else { disconnectGenerateManifestButton(); } } function resetAfterGenerateManifest(){ resetAllErrors(); if(validateDate()){ getNumberOfJobs(); } else { disconnectGenerateManifestButton(); } } function createAvailableManifestsGrid(store) { var gridLayout = [ { name: 'Manifest ID', field: 'manifestNumber', width: '100px'}, { name: 'Type', field: 'groupCode', width: '200px', formatter: formatTypeName}, { name: 'Shipments', field: 'jobCount', width: '85px'}, { name: 'Created Date/Time', field: 'creationDateTime', width: '130px', formatter: formatDate}, { name: ' ', fields:['id', 'manifestTypeId', 'pdfAllowed', 'csvAllowed'], width: '70px', formatter: createPrintLinkTable} ]; var grid = new dojox.grid.DataGrid({ store: store, structure: gridLayout, selectionMode: 'none', autoHeight: 5, autoWidth: true, canSort: gridSortNotAllowed, noDataMessage: "There are no Customs Manifests for the selected date" }, "manifestList"); grid.setQuery("manifestDate=" + formatToServerFormatDateTime(dijit.byId("selectedManifestDate").attr('value'))); return grid; } function formatTypeName(value) { var i; var typeName = ""; if (value == null) { return typeName; } if (typeof manifestNamesObj === 'undefined') { return ""; } else { for(i = 0; i < manifestNamesObj.length; i++){ if(value == manifestNamesObj.groupCode){ typeName = manifestNamesObj.groupName; } } return typeName; } } function formatToServerFormatDateTime(value) { return dojo.date.locale.format(value, {datePattern: "yyyy-MM-dd", selector: "date"}); } function formatDate(value) { return dojo.date.locale.format( dojo.date.locale.parse(value, {datePattern: "yyyy-MM-dd", timePattern: "HH:mm:ss"}), {datePattern: "dd MMM yyyy", timePattern: "HH:mm"}); } function connectSelectedManifestDateInput() { if (selectedManifestDateInputHandle == null) { selectedManifestDateInputHandle = dojo.connect(selectedManifestDateInput, "onChange", function(e) { hideMessages(); }); } } function disconnectSelectedManifestDateInput() { dojo.disconnect(selectedManifestDateInputHandle); selectedManifestDateInputHandle = null; } function refreshList() { refreshListNoConnect(); connectSelectedManifestDateInput(); } function refreshListNoConnect() { availableManifestsGrid.removeSelectedRows(); availableManifestsGrid.store.close(); availableManifestsGrid.setQuery("manifestDate=" + formatToServerFormatDateTime(dijit.byId("selectedManifestDate").attr('value'))); availableManifestsGrid.sort(); } function hideAllFields(){ dojo.style(dojo.byId("rowManifestType"), "display", "none"); dojo.style(dojo.byId("rowManifestPort"), "display", "none"); hideMessages(); resetAllErrors(); } function getManifestNames() { jsonServices.manifestNames({}).then( function(result) { var result = dojox.html.entities.decode(result); manifestNamesObj = dojo.fromJson(result); //this code was moved here to be able to load the manifest type names correctly //before, it was not getting the names correctly because they were not available availableManifestsGrid = createAvailableManifestsGrid(getManifestList()); availableManifestsGrid.startup(); } ); } function getActiveManifestGroups() { jsonServices.getActiveManifestGroups({}).then( function(result) { var result = dojox.html.entities.decode(result); var manifestGroupObj = dojo.fromJson(result); var items = manifestGroupObj.items; if(items.length == 0){ noActiveManifests(); } else { activeManifestGroupsStore = createStoreFromData(manifestGroupObj); activeManifestGroupsStore.fetch({onComplete: populateManifestGroupsNames}); } }, function(err){ alert("ok"); } ); } function noActiveManifests(){ dojo.style(dojo.byId("loader"), "display", "none"); dojo.style(dojo.byId("main"), "display", "none"); dojo.style(dojo.byId("accessError"), "display", ""); } function populateManifestGroupsNames(items, request) { createActiveManifestGroupInput(items); } function connectGenerateManifestButton() { //change image source generateManifestButton.setAttribute("src","/shared/images/template_APC/generate.gif"); //add class dojo.addClass("generateManifestButton", "clickImg"); if (generateButtonHandle == null) { generateButtonHandle = dojo.connect(dojo.byId("generateManifestButton"), "onclick", function(e) { hideMessages(); if(checkValidations()){ if(checkLodgementRef){ showConfirmGenerate(); } else { generatingManifest = true; generateManifest(); } } //dojo.disconnect(generateButtonHandle); }); } } function disconnectGenerateManifestButton() { //change image to original source generateManifestButton.setAttribute("src","/shared/images/template_APC/generate_grey.gif"); //remove class dojo.removeClass("generateManifestButton", "clickImg"); // var handle = dojo.connect(dojo.byId("generateManifestButton"), "onclick", function(e) { // }); dojo.disconnect(generateButtonHandle); generateButtonHandle = null; //alert("disconnect"); } function checkValidations(){ var errorFlag = true; if(!validateManifestType()){ showErrorMessage("Please correct the errors on the page"); errorFlag = false; } if (!validateManifestPort()) { showErrorMessage("Please correct the errors on the page"); errorFlag = false; } if (!validateDate()) { showErrorMessage("Please correct the errors on the page"); errorFlag = false; } return errorFlag; } function validateManifestType(){ if((dijit.byId("manifestType") == null) || (dijit.byId("manifestType").attr('value') == "")){ return false; } else { return true; } } function validateMaxDateRange(startDate, endDate){ var endDateTime = endDate; endDateTime.setHours("23"); endDateTime.setMinutes("59"); endDateTime.setSeconds("59"); var startDateTime = startDate; startDateTime.setHours("00"); startDateTime.setMinutes("00"); startDateTime.setSeconds("00"); var diffDays = Math.abs(dojo.date.difference(endDateTime, startDateTime, "day")); if(diffDays <= maxDateRange){ return true; } else{ dojo.byId("errorEndDate").innerHTML = "The date range requested cannot exceed "+maxDateRange+" days inclusive"; dojo.style(dojo.byId("errorEndDate"), "display", ""); return false; } } function validateStartDateRange(startDate, nowDate){ var minusDay = parseInt(-maxDateRange) + 1;// add 1 day as wee include the current day as whole day var value = dojo.date.add(nowDate, "day", minusDay); var earliestDate = dojo.date.locale.format(value, {datePattern: "dd-MMM-yyyy", selector: "date"}); var nowDateTime = nowDate; nowDateTime.setHours("23"); nowDateTime.setMinutes("59"); nowDateTime.setSeconds("59"); var startDateTime = startDate; startDateTime.setHours("00"); startDateTime.setMinutes("00"); startDateTime.setSeconds("00"); var diffDays = Math.abs(dojo.date.difference(nowDateTime, startDateTime, "day")); if(diffDays <= maxDateRange){ return true; } else{ dojo.byId("errorStartDate").innerHTML = "The start date requested cannot be earlier than "+earliestDate; dojo.style(dojo.byId("errorStartDate"), "display", ""); return false; } } function validateStartDate(startDate, endDate){ var compare = dojo.date.compare(endDate, startDate, "hour"); return (compare >= 0); } function validManifestDateTimeFormat(){ var invalidMessage = "The value entered is not valid"; if(dijit.byId("selectedManifestDate").isValid()){ dojo.style(dojo.byId("errorManifestDate"), "display", "none"); return true; } else { dojo.byId("errorManifestDate").innerHTML = invalidMessage; dojo.style(dojo.byId("errorManifestDate"), "display", ""); return false; } } function validDateTimeFormat(){ var validStartDateFormat = false; var validStartTimeFormat = false; var validEndDateFormat = false; var validEndTimeFormat = false; var invalidMessage = "The value entered is not valid"; if(dijit.byId("manifestStartDate").isValid()){ validStartDateFormat = true; } else { dojo.byId("errorStartDate").innerHTML = invalidMessage; dojo.style(dojo.byId("errorStartDate"), "display", ""); } if(dijit.byId("manifestStartTime").isValid()){ validStartTimeFormat = true; } else { dojo.byId("errorStartDate").innerHTML = invalidMessage; dojo.style(dojo.byId("errorStartDate"), "display", ""); } if(dijit.byId("manifestEndDate").isValid()){ validEndDateFormat = true; } else { dojo.byId("errorEndDate").innerHTML = invalidMessage; dojo.style(dojo.byId("errorEndDate"), "display", ""); } if(dijit.byId("manifestEndTime").isValid()){ validEndTimeFormat = true; } else { dojo.byId("errorEndDate").innerHTML = invalidMessage; dojo.style(dojo.byId("errorEndDate"), "display", ""); } return (validStartDateFormat && validStartTimeFormat && validEndDateFormat && validEndTimeFormat); } function validateDate(){ //2012-02-23 11:00:00 if(validDateTimeFormat()){ var validDateRange = true; var validStartDateRange = true; var start = formatToServerFormatDate(dijit.byId("manifestStartDate").attr('value')) + " " + dijit.byId("manifestStartTime").attr('value'); var end = formatToServerFormatDate(dijit.byId("manifestEndDate").attr('value')) + " " + dijit.byId("manifestEndTime").attr('value'); var startDate = dojo.date.locale.parse(start, {datePattern: "yyyy-MM-dd HH:mmm:ss", selector: "date"}); var endDate = dojo.date.locale.parse(end, {datePattern: "yyyy-MM-dd HH:mmm:ss", selector: "date"}); if(maxDateRange != ""){ validStartDateRange = validateStartDateRange(startDate, now); validDateRange = validateMaxDateRange(startDate, endDate); } var validStartDate = validateStartDate(startDate, endDate); if(!validStartDate){ showErrorMessage("Please correct the errors on the page"); dojo.byId("errorEndDate").innerHTML = "End Date/Time cannot be before Start Date/Time"; dojo.style(dojo.byId("errorEndDate"), "display", ""); } if(validDateRange && validStartDateRange && validStartDate){ return true; } else { showErrorMessage("Please correct the errors on the page"); return false; } } else { showErrorMessage("Please correct the errors on the page"); return false; } } function validateManifestPort(){ if(( (dijit.byId("manifestPort") == null) || (dijit.byId("manifestPort").attr('value') == "") ) && (portMandatory)){ return false; } else { return true; } } function validateExtras(){ if(validateLodgmentReference()){ generatingManifest = true; dijit.byId("confirmGenerate").hide(); generateManifest(); } else { showErrorMessage("Please correct the errors on the page"); } } function validateLodgmentReference(){ if(dijit.byId("lodgementRef").isValid()){ return true; } else { dojo.byId("errorLodgmentRef").innerHTML = "Please enter a Lodgement Reference"; dojo.style(dojo.byId("errorLodgmentRef"), "display", ""); return false; } } function showConfirmGenerate() { dijit.byId("lodgementRef").setValue(""); dijit.byId("confirmGenerate").show(); } function generateManifest() { generatingManifest = true; hideMessages(); toggleGenerateStatus(); validateLodgmentReference(); var manifestStartDate = formatToServerFormatDate(dijit.byId("manifestStartDate").attr('value')); var manifestStartTime = dijit.byId("manifestStartTime").attr('value'); var manifestEndDate = formatToServerFormatDate(dijit.byId("manifestEndDate").attr('value')); var manifestEndTime = dijit.byId("manifestEndTime").attr('value'); var manifestType = dijit.byId("manifestType").attr('value'); //var manifestPort = dijit.byId("manifestPort").attr('value'); //var manifestMlid = dijit.byId("manifestMlid").attr('value'); var lodgementRef = dijit.byId("lodgementRef").attr('value'); requestedManifestTypeId = manifestType; jsonServices.generateManifest({manifestStartDate:manifestStartDate, manifestStartTime:manifestStartTime, manifestEndDate:manifestEndDate, manifestEndTime:manifestEndTime,manifestType:manifestType, manifestPort:manifestPort, manifestMlid:manifestMlid, lodgementRef:lodgementRef}).addCallback( function(result) { toggleGenerateStatus(); var resultObj = dojo.fromJson(result); if (resultObj[0]) { showInfoMessage("The manifest was generated successfully"); } else { showErrorMessage(resultObj[1]); } //getNumberOfJobs(); resetAfterGenerateManifest(); refreshListNoConnect(); }); generatingManifest = false; } function toggleGenerateStatus() { dojo.toggleClass("generateStatus", "spinner-busy"); } function openReportWindow(reportPath) { openwin(reportPath, "_blank", 640, 480); } function cancelGenerateManifest() { if (!generatingManifest) { hideMessages(); connectGenerateManifestButton(); } } function createLodgementRefInput(mandatory) { var lodgementRefTextBox; try { lodgementRefTextBox = dijit.byId("lodgementRef"); lodgementRefTextBox.setAttribute('required',mandatory); } catch (err) { lodgementRefTextBox = new dijit.form.ValidationTextBox({ name: "lodgementRef", value: "", required: mandatory, maxLength: 30 }, "lodgementRef"); } return lodgementRefTextBox; } function createPrintLink(manifestId) { return "<a href='#' onclick='printManifest("+manifestId+")'><img class='clickImg' src='/shared/images/template_APC/print.gif' alt='print'/></a>"; } function createPrintLinkTable(values) { var type="pdf"; var buttonInputs = ""; if(values[2] == 1) { //pdf type="pdf"; //return "<a href='#' onclick='printManifestTable("+values[0]+","+values[1]+",\""+type+"\""+")'><img class='clickImg' src='/shared/images/template_APC/print.gif' alt='printPDF'/></a>"; buttonInputs= "<button type='button' class='newBtn pdfBtn' onclick='printManifestTable("+values[0]+","+values[1]+",\""+type+"\""+")'><span>pdf</span></button> "; } if(values[3] == 1) { //csv type="csv"; //return "<a href='#' onclick='printManifestTable("+values[0]+","+values[1]+",\""+type+"\""+")'><img class='clickImg' src='/shared/images/template_APC/print.gif' alt='printCSV'/></a>"; buttonInputs = buttonInputs + "<button type='button' class='newBtn pdfBtn' onclick='printManifestTable("+values[0]+","+values[1]+",\""+type+"\""+")'><span>csv</span></button>"; } return buttonInputs; } function printManifest(manifestId) { var printManifestTypeId = requestedManifestTypeId; jsonServices.printManifest({id:manifestId, manifestTypeId:printManifestTypeId, reportType:"pdf"}).addCallback( function(result) { hideMessages(); var resultObj = dojo.fromJson(result); if (resultObj[0]) { openReportWindow(resultObj[1]); } else { alert("The Customs Manifest is not available at the moment, please try again later."); } }); } function printManifestTable(manifestId, manifestTypeId, type) { jsonServices.printManifest({id:manifestId, manifestTypeId:manifestTypeId, reportType:type}).addCallback( function(result) { hideMessages(); var resultObj = dojo.fromJson(result); if (resultObj[0]) { openReportWindow(resultObj[1]); } else { alert("The Customs Manifest is not available at the moment, please try again later."); } }); } function getManifestList() { return new dojox.data.JsonRestStore({ transport: "GET", envelope: "URL", target: "/ws/manifest_manifestService/listAvailable", idAttribute: "id", parameters: [ { name: "manifestDate", type: "STRING", optional: false } ] }); } function createStoreFromData(data){ return new dojo.data.ItemFileReadStore({ data: data }); } function createManifestGroupInput(store) { var manifestGroupInput = new dijit.form.FilteringSelect({ store: store, value: "--Please select--", labelAttr: "manifestGroupName", searchAttr: "manifestGroupName" }, "manifest"); return manifestGroupInput; } function createManifestTypeInput(store) { var manifestTypeInput = new dijit.form.FilteringSelect({ store: store, value: "--Please select--", searchAttr: "includeGroup" }, "manifestType"); dojo.style(manifestTypeInput.domNode, "width", "21.3em"); return manifestTypeInput; } function createPortInput(store) { var manifestPortInput = new dijit.form.FilteringSelect({ store: store, value: "--Please select--", searchAttr: "portName" }, "manifestPort"); //manifestPortInput.set("displayedValue", "--Please select--"); return manifestPortInput; } function getActiveManifests(manifestGroup) { jsonServices.getManifestTypes({manifestGroup:manifestGroup}).addCallback( function(result) { manifestTypeObj = dojo.fromJson(result); var items = manifestTypeObj.items; for(i = 0; i < items.length; i++){ var item = items; var includeGroup = item.includeGroup; var j; for(j = 0; j < manifestNamesObj.length; j++){ if(includeGroup == manifestNamesObj[j].groupCode){ item.includeGroup = manifestNamesObj[j].groupName; } } } activeManifestsStore = createStoreFromData(manifestTypeObj); var w = dijit.byId("manifestType"); if(w) { //w.set("value", "--Please select--"); w.set("store", activeManifestsStore); w.startup(); } else { var manifestTypeInput = createManifestTypeInput(activeManifestsStore); manifestTypeInput.startup(); dojo.connect(manifestTypeInput, "onChange", function(e) { var type = dijit.byId("manifestType").attr('value'); activeManifestsStore.fetch({ query: { manifestTypeId: type }, onComplete: getActiveManifestInfo }); }); } if(items.length != 2){ w = dijit.byId("manifestType"); w.setDisplayedValue("--Please select--"); if (items.length == 1) { dojo.style(dojo.byId("rowManifestType"), "display", "none"); } else { dojo.style(dojo.byId("rowManifestType"), "display", ""); } } else { var defaultVal = items[1].manifestTypeId; dijit.byId("manifestType").setValue(defaultVal); dojo.style(dojo.byId("rowManifestType"), "display", "none"); if(items[1].checkLodgementRef == 0){ checkLodgementRef = false; } else { checkLodgementRef = true; } createLodgementRefInput(checkLodgementRef); } inputChange(); } ); } function getActiveManifestInfo(items, request){ var item = items[0]; if(item){ var itemId = activeManifestsStore.getValue(item, "manifestTypeId"); var id = dijit.byId("manifestType").attr('value'); maxDateRange = activeManifestsStore.getValue(item, "maxDateRange"); manifestPort = ""; if(activeManifestsStore.getValue(item, "portMandatory") == 0){ portMandatory = false; dojo.style(dojo.byId("rowManifestPort"), "display", "none"); var w = dijit.byId("manifestPortInput"); if(w){ manifestPortInput.reset(); } } else { portMandatory = true; getActivePorts(); dojo.style(dojo.byId("rowManifestPort"), "display", ""); } disconnectGenerateManifestButton(); if(activeManifestsStore.getValue(item, "checkMinimumVol") == 0){ checkMinimumVol = false; } else { checkMinimumVol = true; } if(activeManifestsStore.getValue(item, "checkLodgementRef") == 0){ checkLodgementRef = false; } else { checkLodgementRef = true; } createLodgementRefInput(checkLodgementRef); //getNumberOfJobs(); inputChange(); } } // Create manifest group dropdown function createActiveManifestGroupInput(items) { var manifestGroupInput = dijit.byId("manifest"); if(manifestGroupInput){ manifestGroupInput.set("store", activeManifestGroupsStore); }else{ manifestGroupInput = createManifestGroupInput(activeManifestGroupsStore); dojo.connect(manifestGroupInput, "onChange", function(e) { manifestPort = ""; var w = dijit.byId("manifestPort"); if(w){ w.setDisplayedValue("--Please select--"); } w = dijit.byId("manifestType"); if(w){ w.setDisplayedValue("--Please select--"); } var val = dijit.byId("manifest").attr('value'); getActiveManifests(val); }); } manifestGroupInput.startup(); if(items.length == 2){ var manifestGroup = items[1].manifestGroup; var manifestGroupName = items[1].manifestGroupName; dijit.byId("manifest").setValue(manifestGroup); dijit.byId("manifest").setDisplayedValue(manifestGroupName); } else { dijit.byId("manifest").setDisplayedValue("--Please select--"); } } function getActivePorts() { jsonServices.getConfiguredPorts({}).addCallback( function(result) { var manifestPortObj = dojo.fromJson(result); manifestPortStore = createStoreFromData(manifestPortObj); var portInput = dijit.byId("manifestPort"); if(portInput){ portInput.reset(); } else { portInput = createPortInput(manifestPortStore); dojo.connect(portInput, "onChange", function(e) { //var port = dijit.byId("manifestPort").attr('value'); manifestPortStore.fetch({onComplete: getPortInfo}); }); portInput.startup(); } manifestPortStore.fetch({onComplete: setDefaultPortInfo}); } ); } function setDefaultPortInfo(items, request) { if(items.length == 2){ var item = items[1]; var defaultVal = manifestPortStore.getValue(item, "portCode"); dijit.byId("manifestPort").setValue(defaultVal); //dojo.style(dojo.byId("rowManifestPort"), "display", "none"); } else { dijit.byId("manifestPort").setDisplayedValue("--Please select--"); dojo.style(dojo.byId("rowManifestPort"), "display", ""); } } function getPortInfo(items, request){ var i; for(i = 0; i < items.length; i++){ var item = items; var itemId = manifestPortStore.getValue(item, "portCode"); var id = dijit.byId("manifestPort").attr('value'); if(id == itemId){ manifestPort = manifestPortStore.getValue(item, "portCode"); manifestMlid = manifestPortStore.getValue(item, "mlid"); minLodgementVol = manifestPortStore.getValue(item, "minLodgementVolume"); } } //getNumberOfJobs(); inputChange(); } function createManifestStartTimeInput() { var timeStoreData = createTimeStoreData(); var timeStore = new dojo.data.ItemFileReadStore({ data: timeStoreData }); var nowRounded = new Date(); nowRounded.setHours(nowRounded.getMinutes() < 30 ? nowRounded.getHours() : nowRounded.getHours()+1); nowRounded.setHours(0); nowRounded.setMinutes(0); nowRounded.setSeconds(0); nowRounded.setMilliseconds(0); var manifestStartTimeInput = new dijit.form.FilteringSelect({ value: dojo.date.locale.format(nowRounded, {timePattern: "HH:mm:ss", selector: "time"}), store: timeStore, searchAttr: "dispTime" }, "manifestStartTime"); dojo.style(manifestStartTimeInput.domNode, "width", "5em"); return manifestStartTimeInput; } function createManifestEndTimeInput() { var timeStoreData = createEndDateTimeStoreData(); var timeStore = new dojo.data.ItemFileReadStore({ data: timeStoreData }); var nowRounded = new Date(); nowRounded.setHours(nowRounded.getMinutes() < 30 ? nowRounded.getHours() : nowRounded.getHours()+1); nowRounded.setHours(23); nowRounded.setMinutes(59); nowRounded.setSeconds(59); nowRounded.setMilliseconds(0); var manifestEndTimeInput = new dijit.form.FilteringSelect({ value: dojo.date.locale.format(nowRounded, {timePattern: "HH:mm:ss", selector: "time"}), store: timeStore, searchAttr: "dispTime" }, "manifestEndTime"); dojo.style(manifestEndTimeInput.domNode, "width", "5em"); return manifestEndTimeInput; } function createTimeStoreData() { return { identifier: 'time', label: 'dispTime', items: [ { time:'00:00:00', dispTime:'00:00'}, { time:'01:00:00', dispTime:'01:00'}, { time:'02:00:00', dispTime:'02:00'}, { time:'03:00:00', dispTime:'03:00'}, { time:'04:00:00', dispTime:'04:00'}, { time:'05:00:00', dispTime:'05:00'}, { time:'06:00:00', dispTime:'06:00'}, { time:'07:00:00', dispTime:'07:00'}, { time:'08:00:00', dispTime:'08:00'}, { time:'09:00:00', dispTime:'09:00'}, { time:'10:00:00', dispTime:'10:00'}, { time:'11:00:00', dispTime:'11:00'}, { time:'12:00:00', dispTime:'12:00'}, { time:'13:00:00', dispTime:'13:00'}, { time:'14:00:00', dispTime:'14:00'}, { time:'15:00:00', dispTime:'15:00'}, { time:'16:00:00', dispTime:'16:00'}, { time:'17:00:00', dispTime:'17:00'}, { time:'18:00:00', dispTime:'18:00'}, { time:'19:00:00', dispTime:'19:00'}, { time:'20:00:00', dispTime:'20:00'}, { time:'21:00:00', dispTime:'21:00'}, { time:'22:00:00', dispTime:'22:00'}, { time:'23:00:00', dispTime:'23:00'} ] }; } function createEndDateTimeStoreData() { return { identifier: 'time', label: 'dispTime', items: [ { time:'00:59:59', dispTime:'00:59'}, { time:'01:59:59', dispTime:'01:59'}, { time:'02:59:59', dispTime:'02:59'}, { time:'03:59:59', dispTime:'03:59'}, { time:'04:59:59', dispTime:'04:59'}, { time:'05:59:59', dispTime:'05:59'}, { time:'06:59:59', dispTime:'06:59'}, { time:'07:59:59', dispTime:'07:59'}, { time:'08:59:59', dispTime:'08:59'}, { time:'09:59:59', dispTime:'09:59'}, { time:'10:59:59', dispTime:'10:59'}, { time:'11:59:59', dispTime:'11:59'}, { time:'12:59:59', dispTime:'12:59'}, { time:'13:59:59', dispTime:'13:59'}, { time:'14:59:59', dispTime:'14:59'}, { time:'15:59:59', dispTime:'15:59'}, { time:'16:59:59', dispTime:'16:59'}, { time:'17:59:59', dispTime:'17:59'}, { time:'18:59:59', dispTime:'18:59'}, { time:'19:59:59', dispTime:'19:59'}, { time:'20:59:59', dispTime:'20:59'}, { time:'21:59:59', dispTime:'21:59'}, { time:'22:59:59', dispTime:'22:59'}, { time:'23:59:59', dispTime:'23:59'} ] }; } function formatToServerFormatDate(value) { return dojo.date.locale.format(value, {datePattern: "yyyy-MM-dd", selector: "date"}); } function getNumberOfJobs() { var manifestStartDate = ""; var manifestStartTime = ""; var manifestEndDate = ""; var manifestEndTime = ""; var manifestType = ""; if(dijit.byId("manifestStartDate")){ manifestStartDate = formatToServerFormatDate(dijit.byId("manifestStartDate").attr('value')); } if(dijit.byId("manifestStartTime")){ manifestStartTime = dijit.byId("manifestStartTime").attr('value'); } if(dijit.byId("manifestEndDate")){ manifestEndDate = formatToServerFormatDate(dijit.byId("manifestEndDate").attr('value')); } if(dijit.byId("manifestEndTime")){ manifestEndTime = dijit.byId("manifestEndTime").attr('value'); } if(dijit.byId("manifestType")){ manifestType = dijit.byId("manifestType").attr('value'); } jsonServices.getNumberOfJobs({manifestStartDate:manifestStartDate, manifestStartTime:manifestStartTime, manifestEndDate:manifestEndDate, manifestEndTime:manifestEndTime,manifestType:manifestType, manifestPort:manifestPort,portMandatory:portMandatory}).addCallback( function(result) { var resultObj = dojo.fromJson(result); numberOfJobs = resultObj.numberOfJobs; createSelectionInfo(); if(numberOfJobs > 0 && !checkMinimumVol){ connectGenerateManifestButton(); } else if (numberOfJobs > 0 && checkMinimumVol && minLodgementVol > 0) { checkMinimunVolume(); } else { disconnectGenerateManifestButton(); } return ""; }); } function checkMinimunVolume() { if(parseInt(numberOfJobs) < parseInt(minLodgementVol)){ disconnectGenerateManifestButton(); } else { connectGenerateManifestButton(); } } function createSelectionInfo() { if((portMandatory) && (minLodgementVol > 0)){ var minVolumeString = "Minimum Lodgement Volume &nbsp;&nbsp;&nbsp;:&nbsp;<b>" + minLodgementVol + "</b> for MLID <b>" + manifestMlid + "</b><br/>"; dojo.byId("minLodgementVolume").innerHTML = minVolumeString; } else { dojo.byId("minLodgementVolume").innerHTML = ""; } var numberOfJobsString = ""; if (numberOfJobs > 0) { numberOfJobsString = "Number of Shipments selected : <b>" + numberOfJobs +"</b>"; if((parseInt(numberOfJobs) < parseInt(minLodgementVol)) && (checkMinimumVol)){ numberOfJobsString += "<br><b>Number of Shipments does not meet Minimum Lodgement Volume</b>"; } } else { numberOfJobsString = "No Shipments selected"; } dojo.byId("numberOfJobs").innerHTML = numberOfJobsString; } function resetAllErrors(){ dojo.query(".errorMessage").style("display", "none"); } function createDefaultManifestStore(){ var result = '{"identifier":"manifestGroup","label":"manifestGroupName","items":[{"manifestGroup":"","manifestGroupName":"--Please select--"}]}'; manifestGroupObj = dojo.fromJson(result); activeManifestGroupsStore = createStoreFromData(manifestGroupObj); activeManifestGroupsStore.fetch({onComplete: populateManifestGroupsNames}); } </script> </html>
  13. #include <IE.au3> ; Create a browser window and navigate to Australia Post $oIE = _IECreate("https://online.auspost.com.au/eParcel/common/auth/login.do") ; get pointers to the login form and username, password and signin fields Local $o_form = _IEFormGetObjByName($oIE, "LoginForm") Local $o_login = _IEFormElementGetObjByName($o_form, "userName") Local $o_password = _IEFormElementGetObjByName($o_form, "password") Local $username = "abcd123 Local $password = "abcd123" ; Set field values and submit the form _IEFormElementSetValue($o_login, $username) _IEFormElementSetValue($o_password, $password) ;_IEAction($o_password, "focus") _IEFormSubmit($o_form) Just add _IEFormSubmit($o_form)
  14. Hi, I would like to run script by using autoit to select the radio button below but the thing is the Value/string is random generate. For example now the value is "mbCkxM" another 5 minutes it will be JFKdjX. So How do I bind the random generated value in to my script? please check my script after the double lines. thanks <tr> <TD> <p style="text-align: left;">WXB</p> </TD> <TD> <p style="text-align: left;">Delisdfsdfions</p> </TD> <TD> <p style="text-align: left;">Private Bag 33450</p> </TD> <TD> <p style="text-align: left;">LwerTT</p> </TD> <TD> <p style="text-align: left;">WLG</p> </TD> <TD> <p style="text-align: left;"></p> </TD> <TD> <p style="text-align: left;">SwerWS</p> </TD> <TD> <p style="text-align: left;">12 werwerAY</p> </TD> <TD> <p style="text-align: center;"> <input type="radio" name="merchantLocationID" value="mbCkxM" /> </p> </TD> </TR> ================================================================================================================= #include <IE.au3> ; Create a browser window and navigate to Australia Post $oIE = _IECreate("https://online.auspost.com.au/eParcel/common/auth/login.do") ; get pointers to the login form and username, password and signin fields Local $o_form = _IEFormGetObjByName($oIE, "LoginForm") Local $o_login = _IEFormElementGetObjByName($o_form, "userName") Local $o_password = _IEFormElementGetObjByName($o_form, "password") Local $username = "abcd123n" Local $password = "abcd123n" ; Set field values and submit the form _IEFormElementSetValue($o_login, $username) _IEFormElementSetValue($o_password, $password) ;_IEAction($o_password, "focus") _IEFormSubmit($o_form) ;Merchant location select Local $o_formx = _IEFormGetObjByName($oIE, "merchantLocationListForm") _IEFormElementRadioSelect($o_formx, "mbCkxM", "merchantLocationID", 1, "byValue") _IEFormSubmit($o_formx)
  15. hello, I'm newbie here. I'm stuck... base on the source code. How can I send the form? I sense that some thing need to do with the below Bolded syntax. So Expert please guide me how to send the Post method in Autoit script. After the double was my Autoit script. <div id="contentContainer" class="layout_twoColumnLeft clearfix"> <div id="overlayContent"> <div id="news" class="pcs clearfix"> <form name="LoginForm" id="LoginForm" method="post" action="/eParcel/common/auth/submitLogin.do" class="clear:both"> <fieldset class="noborder"> <div class="leftarea"> <a href="http://auspost.com.au/business/eparcel.html" target="_blank"> <img id="contextImage1" src="https://auspost.com.au/images/eParcel/option1.jpg" alt=""/> </a> </div> <div class="rightarea"> <table rules="none" frame="void" border="0" cellpadding="1" cellspacing="1"> <tr> <td class="bottomline" colspan="3"><h1 class="plainAnchor">Welcome to eParcel</h1></td> </tr> <tr> <td colspan="3"> <div id="messages" style="color: red; "></div> </td> </tr> <tr> <td class="required">*</td> <td class="label" colspan="2">Required information</td> </tr> <tr> <td class="required">*</td> <td class="label">Username</td> <td><input type="text" name="userName" value="" id="userName" class="sizetwenty"></td> </tr> <tr> <td class="required">*</td> <td class="label">Password</td> <td><input type="password" name="password" value="" id="password" class="sizetwenty"></td> </tr> <tr> <td colspan="3"> <div style="width: 100%;"> <div style="width: 70%; float: left;"> <h1><a id="resetPasswordLink">Forgotten your password?&nbsp;&nbsp;&nbsp;Click Here</a></h1> </div> <div style="width: 30%; float: right;"> <button type="submit" class="button primary inputButton">Login <span class="caret">&raquo;</span></button> </div> </div> </td> </tr> <tr> ====================================================================================================================================================== #include <IE.au3> ; Create a browser window and navigate to Australia Post $oIE = _IECreate("https://online.auspost.com.au/eParcel/common/auth/login.do") ; get pointers to the login form and username, password and signin fields Local $o_form = _IEFormGetObjByName($oIE, "LoginForm") Local $o_login = _IEFormElementGetObjByName($o_form, "userName") Local $o_password = _IEFormElementGetObjByName($o_form, "password") Local $username = "abctesting" Local $password = "abctesting" ; Set field values and submit the form _IEFormElementSetValue($o_login, $username) _IEFormElementSetValue($o_password, $password) _IEAction($o_password, "focus")
×
×
  • Create New...