
FrozenTeeth
Active Members-
Posts
27 -
Joined
-
Last visited
Everything posted by FrozenTeeth
-
My old windows 7 PC compiles just fine. My new windows 7 machine gets an error. Not sure if it's a configuration or I'm missing something i'm using the _INetSmtpMailCom to send email and it compiles and runs and works fine on my other machine but when I try to compile it on the new machine I get: "G:JayAutoIT_ScriptsMyCoolProgram.au3"(859,12) : error: missing separator character before keyword. $objEmail.To ~~~~~~~~~~^ G:JayAutoIT_ScriptsMyCoolProgram.au3 - 1 error(s), 0 warning(s) !>11:09:01 AU3Check ended. Press F4 to jump to next error.rc:2 This is the code i'm using for email: Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0) $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf If $s_AttachFiles <> "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) If FileExists($S_Files2Attach[$x]) Then $objEmail.AddAttachment($S_Files2Attach[$x]) Else $i_Error_desciption = $i_Error_desciption & @LF & 'File not found to attach: ' & $S_Files2Attach[$x] SetError(1) Return 0 EndIf Next EndIf $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf If $ssl Then $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True EndIf ;Update settings $objEmail.Configuration.Fields.Update ; Sent the Message $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf EndFunc ;==>_INetSmtpMailCom
-
GUI 2nd open from tray doesn't work
FrozenTeeth replied to FrozenTeeth's topic in AutoIt GUI Help and Support
Works like a charm! Thanks for the heads up/fix! -
If I right click the tray icon and select about it works multiple times. but If I try selecting 'settings' on the menu the GUI opens and allows me to save then close the GUI. But at that point none of the menu items work anymore. I tried reseting Opt("GUIOnEventMode", 1) to Opt("GUIOnEventMode", 0) when the gui exits and that doesn't work. Any ideas? #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <GUIComboBox.au3> #include <GuiComboBoxEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <_sql.au3>; #include <Array.au3> Opt("TrayMenuMode", 1) ; Hide default tray menu items TraySetIcon(@ScriptDir & "\0.ico") TraySetClick(8) ;only show the menu when right clicking Local $SleepStep, $aboutitem,$infoitem $aboutitem = TrayCreateItem("About") $infoitem = TrayCreateItem("Info") $exititem = TrayCreateItem("Exit") ; ; main routine ; While 1 Switch TrayGetMsg() ;switch seems nicer in this case Case 0 $SleepStep += 1 If $SleepStep > 1000 Then $SleepStep = 0 ;do something every cycle ; to be added later EndIf ContinueLoop Case $TRAY_EVENT_PRIMARYDOWN ;reaction to left clicking TrayTip("Tickets:", "you have new tickets", 5, 1) SetIcon() Case $aboutitem TrayItemSetState($aboutitem, $TRAY_UNCHECKED) ;stop the automated (un)checking when clicked MsgBox(64, "About", "Ticket Notification Utility") Case $infoitem TrayItemSetState($infoitem, $TRAY_UNCHECKED) ;stop the automated (un)checking when clicked OpenGUI() ;MsgBox(64, "POPUP", "setting change here") Case $exititem ExitLoop EndSwitch WEnd Exit Func SetIcon() ; testing Local $IconNumber = 5 Select Case $IconNumber < 1 TraySetIcon(@ScriptDir & "\0.ico") Case $IconNumber > 9 TraySetIcon(@ScriptDir & "\9plus.ico") Case Else TraySetIcon(@ScriptDir & "\" & $IconNumber & ".ico") EndSelect EndFunc ;==>SetIcon Func OpenGUI() Opt("GUIOnEventMode", 1) #region ### START Koda GUI section ### Form= $Form2 = GUICreate("Form2", 202, 125, 302, 218) GUISetOnEvent($GUI_EVENT_CLOSE, "Form2Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form2Minimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form2Maximize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form2Restore") $Label1 = GUICtrlCreateLabel("Settings:", 72, 16, 45, 17) GUICtrlSetOnEvent(-1, "Label1Click") $ButtonSave = GUICtrlCreateButton("Save", 64, 48, 73, 33, $WS_GROUP) GUICtrlSetOnEvent(-1, "ButtonSaveClick") GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### ;While 1 ; Sleep(100) ;WEnd Local $msg ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd return EndFunc ;==>OpenGUI Func ButtonSaveClick() ;test save settings MsgBox(0, "Saved:", "Your settings have been saved") GUISetState(@SW_HIDE) EndFunc ;==>ButtonSaveClick Func Form2Close() EndFunc ;==>Form2Close Func Form2Maximize() EndFunc ;==>Form2Maximize Func Form2Minimize() EndFunc ;==>Form2Minimize Func Form2Restore() EndFunc ;==>Form2Restore Func Label1Click() EndFunc ;==>Label1Click
-
IE Form Element to value not working
FrozenTeeth replied to FrozenTeeth's topic in AutoIt General Help and Support
Thanks PsaltyDS! You have been a great help in wrapping my head around this. This was my final code. It is not pretty but it works. I just changed the $f_fireEvent to zero then checked the text. Then I fire the event and then submit. Works! #include <IE.au3> $oIE = _IECreate("http://ncat3420a/CatRptCenter/CatToHostReportPge.aspx", 0, 1, 1, 1) $oForm = _IEFormGetObjByName($oIE, "XPCATMain") $oText = _IEFormElementGetObjByName ($oForm, "ddlHostBusDate") _IEFormElementSetValue ($oText, "08/12/2010",0) MsgBox(0, "Form Element Value", _IEFormElementGetValue ($oText)) Global $foundDate = _IEFormElementGetValue ($oText) MsgBox(0, "$foundDate", $foundDate) _IEFormElementSetValue ($oText, "08/12/2010",1) MsgBox(0, "$foundDate", $foundDate) if $founddate = "08/12/2010" then _IEFormImageClick($oIE, "SubmitImageButton", "name") end if _IEQuit($oIE) exit -
IE Form Element to value not working
FrozenTeeth replied to FrozenTeeth's topic in AutoIt General Help and Support
Your right! It does reset! If I remove the line: _IEFormElementSetValue ($oText, "08/12/2010") The found date works fine. How do I re-read the page?!?!?!? _IEAttach? -
IE Form Element to value not working
FrozenTeeth replied to FrozenTeeth's topic in AutoIt General Help and Support
I open the page and set the date. Then check the date to make sure it is set correctly then submit the form. Everything is working except the checking the field for the date. #include <IE.au3> ; ; Navigate to CAT to Host Report (Not working) ; $oIE = _IECreate("http://ncat3420a/CatRptCenter/CatToHostReportPge.aspx", 0, 1, 1, 1) sleep(2000) $oForm = _IEFormGetObjByName($oIE, "XPCATMain") $oText = _IEFormElementGetObjByName ($oForm, "ddlHostBusDate") _IEFormElementSetValue ($oText, "08/12/2010") MsgBox(0, "Form Element Value", _IEFormElementGetValue ($oText)) Global $foundDate = _IEFormElementGetValue ($oText) MsgBox(0, "$foundDate", $foundDate) -
IE Form Element to value not working
FrozenTeeth replied to FrozenTeeth's topic in AutoIt General Help and Support
Thanks for testing that out for me. Yep I tried a test here and it works fine with the example form but when I use it on my web page (Which I have no control over) it does not work. I think I'll have to try something else maybe read the html and check the value that way. It't the long way around but it will work This is the table I'm trying to get at: <table class="Grid" cellspacing="0" cellpadding="0" align="Center" border="0" style="border-style:None;width:98%;border-collapse:collapse;"> <tr> <td valign="Top"><table border="0" style="width:100%;"> <tr> <td><span id="PageTitle" class="Head">CAT to Host Report</span></td> </tr> </table></td> </tr><tr> <td> </td> </tr><tr id="ParameterRow"> <td valign="Top"><table border="0" style="width:100%;"> <tr> <td valign="Top" style="width:40%;"><table class="NormalBold" border="0" style="width:100%;"> <tr id="HostBusinessDate"> <td valign="Top"><span id="lblHostBusDate" title="Enter a host business date or select a date from the list" style="width:130px;">Host business date</span></td><td><span id="HostBusDateFmtText" title="Enter a host business date or select a date from the list" class="NormalTextBox"><input name="HostBusDateFmtText:InnerTextBox" type="text" value="08/12/2010" maxlength="10" id="HostBusDateFmtText_InnerTextBox" style="width:200px;" /><span id="HostBusDateFmtText__ctl0" controltovalidate="HostBusDateFmtText_InnerTextBox" errormessage="Please enter the date in the format MM/DD/YYYY." display="Dynamic" evaluationfunction="RegularExpressionValidatorEvaluateIsValid" validationexpression="^((([1-9])|([0][1-9])|([1][0-2]))[/-](([1-9])|([0][1-9])|([1][0-9])|([2][0-9])|([3][0-1]))[/-](\d{4}))$" style="color:Red;display:none;">*</span></span> <br> <select name="ddlHostBusDate" onchange="__doPostBack('ddlHostBusDate','')" language="javascript" id="ddlHostBusDate" style="width:200px;"> <option value="10/04/2010">10/04/2010</option> <option value="10/03/2010">10/03/2010</option> <option value="10/02/2010">10/02/2010</option> <option value="10/01/2010">10/01/2010</option> <option value="09/30/2010">09/30/2010</option> <option value="09/29/2010">09/29/2010</option> <option value="09/28/2010">09/28/2010</option> <option value="09/27/2010">09/27/2010</option> <option value="09/25/2010">09/25/2010</option> <option value="09/24/2010">09/24/2010</option> <option value="09/23/2010">09/23/2010</option> <option value="09/22/2010">09/22/2010</option> <option value="09/21/2010">09/21/2010</option> <option value="09/20/2010">09/20/2010</option> <option value="09/18/2010">09/18/2010</option> <option value="09/17/2010">09/17/2010</option> <option value="09/16/2010">09/16/2010</option> <option value="09/15/2010">09/15/2010</option> <option value="09/14/2010">09/14/2010</option> <option value="09/13/2010">09/13/2010</option> <option value="09/11/2010">09/11/2010</option> <option value="09/10/2010">09/10/2010</option> <option value="09/09/2010">09/09/2010</option> <option value="09/08/2010">09/08/2010</option> <option value="09/07/2010">09/07/2010</option> <option value="09/04/2010">09/04/2010</option> <option value="09/03/2010">09/03/2010</option> <option value="09/02/2010">09/02/2010</option> <option value="09/01/2010">09/01/2010</option> <option value="08/31/2010">08/31/2010</option> <option value="08/30/2010">08/30/2010</option> <option value="08/28/2010">08/28/2010</option> <option value="08/27/2010">08/27/2010</option> <option value="08/26/2010">08/26/2010</option> <option value="08/25/2010">08/25/2010</option> <option value="08/24/2010">08/24/2010</option> <option value="08/23/2010">08/23/2010</option> <option value="08/22/2010">08/22/2010</option> <option value="08/21/2010">08/21/2010</option> <option value="08/20/2010">08/20/2010</option> <option value="08/19/2010">08/19/2010</option> <option value="08/18/2010">08/18/2010</option> <option value="08/17/2010">08/17/2010</option> <option value="08/16/2010">08/16/2010</option> <option value="08/14/2010">08/14/2010</option> <option value="08/13/2010">08/13/2010</option> <option selected="selected" value="08/12/2010">08/12/2010</option> <option value="08/11/2010">08/11/2010</option> <option value="08/10/2010">08/10/2010</option> <option value="08/09/2010">08/09/2010</option> <option value="08/08/2010">08/08/2010</option> <option value="08/07/2010">08/07/2010</option> <option value="08/06/2010">08/06/2010</option> <option value="08/05/2010">08/05/2010</option> <option value="08/04/2010">08/04/2010</option> <option value="08/03/2010">08/03/2010</option> <option value="08/02/2010">08/02/2010</option> <option value="07/31/2010">07/31/2010</option> <option value="07/30/2010">07/30/2010</option> <option value="07/29/2010">07/29/2010</option> <option value="07/28/2010">07/28/2010</option> <option value="07/27/2010">07/27/2010</option> <option value="07/26/2010">07/26/2010</option> <option value="07/24/2010">07/24/2010</option> <option value="07/23/2010">07/23/2010</option> <option value="07/22/2010">07/22/2010</option> <option value="07/21/2010">07/21/2010</option> <option value="07/20/2010">07/20/2010</option> <option value="07/19/2010">07/19/2010</option> <option value="07/18/2010">07/18/2010</option> <option value="07/17/2010">07/17/2010</option> <option value="07/16/2010">07/16/2010</option> <option value="07/15/2010">07/15/2010</option> <option value="07/14/2010">07/14/2010</option> <option value="07/13/2010">07/13/2010</option> <option value="07/12/2010">07/12/2010</option> <option value="07/10/2010">07/10/2010</option> <option value="07/09/2010">07/09/2010</option> <option value="07/08/2010">07/08/2010</option> <option value="07/07/2010">07/07/2010</option> <option value="07/06/2010">07/06/2010</option> <option value="07/04/2010">07/04/2010</option> <option value="07/03/2010">07/03/2010</option> <option value="07/02/2010">07/02/2010</option> <option value="07/01/2010">07/01/2010</option> <option value="06/30/2010">06/30/2010</option> <option value="06/29/2010">06/29/2010</option> <option value="06/28/2010">06/28/2010</option> <option value="06/27/2010">06/27/2010</option> <option value="06/26/2010">06/26/2010</option> </select></td> </tr><tr id="HostID"> <td><span id="lblHostID" style="width:130px;">Host device Id</span></td><td><select name="ddlHostID" id="ddlHostID" style="width:200px;"> <option selected="selected" value="ALL">All</option> <option value="1">1 - XP Host Interface</option> <option value="3">3 - SB XP Acq Host Interface</option> <option value="4">4 - SB Issuer Host Interface</option> </select></td> </tr><tr id="SortBy"> <td><span id="lblSortBy" style="width:130px;">Sort by</span></td><td><select name="ddlSortBy" id="ddlSortBy" style="width:200px;"> <option value="CardNbr">Card number</option> <option value="MemberNbr">Member number</option> <option selected="selected" value="CAT Date Time">Operation date and time</option> </select></td> </tr><tr id="ReportContent"> <td><span id="lblReportCont" style="width:130px;">Report content</span></td><td><select name="ddlReportCont" id="ddlReportCont" style="width:200px;"> <option selected="selected" value="D">Detailed report</option> <option value="T">Totals only</option> </select></td> </tr><tr id="Demo"> <td><input id="ckTestCards" type="checkbox" name="ckTestCards" /><label for="ckTestCards">Test cards</label></td> </tr><tr> <td> </td><td><input type="image" name="SubmitImageButton" onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " language="javascript" id="SubmitImageButton" title="Submit the reports" src="/CatRptCenter/images/Submit_Button.jpg" alt="" align="Middle" border="0" /></td> </tr> </table></td><td valign="Top" style="width:60%;"><table id="SelectExportParmsCtl1_SelectExportParmsTable" class="Grid" border="0" style="width:100%;"> <tr> <td valign="Top"><span class="NormalBold"><input id="SelectExportParmsCtl1_ExportToPdfCheckBox" type="checkbox" name="SelectExportParmsCtl1:ExportToPdfCheckBox" checked="checked" /><label for="SelectExportParmsCtl1_ExportToPdfCheckBox">Export to PDF</label></span></td> </tr><tr> <td><span class="NormalBold"><input id="SelectExportParmsCtl1_ExportToTextCheckBox" type="checkbox" name="SelectExportParmsCtl1:ExportToTextCheckBox" /><label for="SelectExportParmsCtl1_ExportToTextCheckBox">Export to text</label></span></td> </tr><tr> <td><span class="NormalBold"><input id="SelectExportParmsCtl1_ReplaceFileCheckBox" type="checkbox" name="SelectExportParmsCtl1:ReplaceFileCheckBox" checked="checked" /><label for="SelectExportParmsCtl1_ReplaceFileCheckBox">Replace file</label></span></td> </tr><tr> <td> </td> </tr><tr> <td valign="Top"><span title="Enter a custom file name for the exported report to use in place of the name generated by CAT" class="NormalBold">Custom export file name </span><span title="Enter a custom file name for the exported report to use in place of the name generated by CAT" class="Normal" style="color:DarkBlue;font-size:8pt;"> (Enter a name only if you do not want to accept the default name)</span></td> </tr><tr> <td valign="Top"><span id="SelectExportParmsCtl1_ExportFileNameFmtText" title="Enter a custom file name for the exported report to use in place of the name generated by CAT" class="NormalTextBox"><input name="SelectExportParmsCtl1:ExportFileNameFmtText:InnerTextBox" type="text" maxlength="250" id="SelectExportParmsCtl1_ExportFileNameFmtText_InnerTextBox" style="width:500px;" /></span></td> </tr> </table> </td> </tr> </table></td> </tr> </table> -
Not sure why I can't get this value into a variable. The message box returns the correct date but the $FoundDate returns a zero. $oQuery = _IEFormElementGetObjByName ($oForm, "ddlHostBusDate") MsgBox(0, "Form Element Value", _IEFormElementGetValue ($oQuery)) Global $foundDate = _IEFormElementGetValue ($oQuery) MsgBox(0, "$foundDate", $foundDate) Any help is appreciated.
-
Error copying file? HELP!
FrozenTeeth replied to FrozenTeeth's topic in AutoIt General Help and Support
Tried your suggestion and am not getting a 1005 error but a 1000 error. Here is a screen shot from the event log. Looked it up on eventid.net but seems to be a general error. -
Error copying file? HELP!
FrozenTeeth replied to FrozenTeeth's topic in AutoIt General Help and Support
I must appologize. I meant to remove that line. I was going to try to runt the copy with the dos xcopy command. I have updated the first post to reflect the true script. Here is what I was going to try. I can't run it at a whim because it would mess with live data. I run it once a day. My next test is Monday Local $doscommand $doscommand = "xcopy " & $5250filename & " " & $5250filenameImport & " /c /q /y" LogAction("5250 - Copied file: " & $5250filename & " to: " & $5250filenameImport) -
I have a program that ends in the same place everytime. Here is the code. The second code section shows where the issue is. it bombs after coping the file. I have also attached the screen shot of the error and the log file that is getting created. This program would need to be modified heavly if you want to try and run it as it looks for specific files in specific areas. And the SQL stuff I can not figure out why it bombs after the file copy it waits a few seconds then runs a batch file. The batch file never runs. I have checked the security of all the file/folders and everything is Domain administrator. The user running the script is the Domain Administrator account. #NoTrayIcon #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=..\Icons\Iconshock_tiny_animals_vista_icons\ico\elephant.ico #AutoIt3Wrapper_Run_Tidy=y #AutoIt3Wrapper_Run_cvsWrapper=y #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Misc.au3> #include <Date.au3> #include <file.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Process.au3> #include <String.au3> #include <_sql.au3> Opt('MustDeclareVars', 1) ; ;make sure only one is running on local computer at a time! ; If _Singleton("5250_new", 1) = 0 Then MsgBox(0, "Warning", "An occurence of 5250_new is already running. Exiting.") Exit EndIf ; MsgBox(64, "5250 Starting", "Starting TotaleChecks Import") ; ;error functions ; Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") Global $HexNumber, $oMyRet, $tTime ;################################## ; EMAIL Variables ;################################## Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") Global $SmtpServer, $FromAddress, $FromName, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl, $HexNumber $SmtpServer = "192.168.0.123" ; address for the smtp-server to use - REQUIRED $FromName = "5250" ; name from who the email was sent $FromAddress = "myemail@email.com" ; address from where the mail should come $ToAddress = "email@email.com" ; destination address of the email - REQUIRED $Subject = "Notification from: " & @ScriptName ; subject from the email - can be anything you want it to be $Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file you want to attach- leave blank if not needed $CcAddress = "super@mail.com" ; address for cc - leave blank if not needed $BccAddress = "" ; address for bcc - leave blank if not needed $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $Username = "mis" ; username for the account used from where the mail gets sent - REQUIRED $Password = "daisy5668" ; password for the account used from where the mail gets sent - REQUIRED $IPPort = 25 ; port used for sending the mail $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS ;~ $IPPort=465 ; GMAIL port used for sending the mail ;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS ; ;Dates ; Global $MyDate, $Today, $todayName, $MyTime, $dd, $yy, $mm, $yesterdaydd, $yesterdaydate, $dateyyyymmdd, $dateprevyyyymmdd, $NCATPrevDate, $dateThreeDaysAgo, $dateThreeDaysAgoDD, $dateThreeDaysAgoMM, $dateThreeDaysAgoYY Global $yesterdayMM, $yesterdayYY, $dateTwoDaysAgo, $dateTwoDaysAgoDD, $dateTwoDaysAgoMM, $dateTwoDaysAgoYY, $twoweeksago, $twoweeksagoYYYYMMDD, $todayMMDDYY Global $5250BackupFilename, $fc, $sDir, $sFile, $sCommand, $todayMMDD, $missingboolean $Today = _NowCalcDate() _DateTimeSplit($Today, $MyDate, $MyTime) $todayMMDDYY = StringFormat("%02i%02i%s", $MyDate[2], $MyDate[3], StringRight($MyDate[1], 2)) $todayMMDD = StringFormat("%02i%02i%s", $MyDate[2], $MyDate[3]) ; $dd = @MDAY $yy = StringRight(@YEAR, 2) $mm = @MON $yesterdaydate = _DateAdd('d', -1, _NowCalcDate()) $yesterdaydd = StringRight($yesterdaydate, 2) $yesterdayMM = StringMid($yesterdaydate, 6, 2) $yesterdayYY = StringMid($yesterdaydate, 3, 2) ; ;Two days ago (Used for Monday where you need saturday's date) ; $dateTwoDaysAgo = _DateAdd('d', -2, _NowCalcDate()) $dateTwoDaysAgoDD = StringRight($dateTwoDaysAgo, 2) $dateTwoDaysAgoMM = StringMid($dateTwoDaysAgo, 6, 2) $dateTwoDaysAgoYY = StringMid($dateTwoDaysAgo, 3, 2) ; ;Three days ago (Used for Monday where you need last business day of Friday) ; $dateThreeDaysAgo = _DateAdd('d', -3, _NowCalcDate()) $dateThreeDaysAgoDD = StringRight($dateThreeDaysAgo, 2) $dateThreeDaysAgoMM = StringMid($dateThreeDaysAgo, 6, 2) $dateThreeDaysAgoYY = StringMid($dateThreeDaysAgo, 3, 2) ; $dateyyyymmdd = @YEAR & @MON & @MDAY $dateprevyyyymmdd = StringLeft($yesterdaydate, 4) & StringMid($yesterdaydate, 6, 2) & StringRight($yesterdaydate, 2) ; ;two weeks ago ; $twoweeksago = _DateAdd('d', -14, _NowCalcDate()) $twoweeksagoYYYYMMDD = StringLeft($twoweeksago, 4) & StringMid($twoweeksago, 6, 2) & StringRight($twoweeksago, 2) ; Const $logfilelocation = "G:\AutoIT_Production\Logs\" & _DateToMonth(@MON) & "-" & @YEAR & "\" & $todayMMDDYY & "\Log_" & $todayMMDDYY & ".log" If Not FileExists($logfilelocation) Then FileOpen($logfilelocation, 9) FileClose($logfilelocation) EndIf ; ;get focus info ; Global $xpfocusxpini = @WindowsDir & "\focusxp.ini" Global $xpWebServer, $xpOpName, $xpWSDesc If FileExists($xpfocusxpini) Then $xpWebServer = IniRead($xpfocusxpini, "xpwnav", "WebServer", "none") $xpOpName = IniRead($xpfocusxpini, "OpName", "WebServer", "none") $xpWSDesc = IniRead($xpfocusxpini, "WSDesc", "WebServer", "none") EndIf LogAction("****************************************************************************************") LogAction(StringUpper("***** " & @UserName & " ran reference number: 5250 from " & @ComputerName & " *****")) LogAction(StringUpper("***** FOCUS XP INFO: Operator:" & $xpOpName & " Workstation Description: " & $xpWSDesc & " *****")) LogAction(StringUpper("***** Started 5250 Check Import *****")) LogAction("****************************************************************************************") Global $5250filename, $5250count, $5250line, $5250tempfilename, $5250OrigFile, $5250PrevDayFile, $5250CurrSeq, $5250PrevSeq, $5250filenameImport, $5250rejectarray Global $5250rejectarray, $5250RejectFilename, $5250LogFilename, $file Global $FileList, $upper, $FirstlineArray, $LastlineArray, $newArray[1], $lineArray $5250filename = "G:\Indexes\hacuchecks.txt" $5250filenameImport = "G:\Indexes\Index_hacuchecks_import.txt" $5250tempfilename = "G:\Indexes\Index_hacuchecks_temp.txt" ;$5250OrigFile = "G:\Indexes\backup\Index.txt" ;temp remove - for testing only $5250OrigFile = "T:\TeChecksIndexBuilder\Archive\Indexes\Index.txt" $5250BackupFilename = "G:\Indexes\backup\" & _DateToMonth(@MON) & "-" & @YEAR & "\" & $todayMMDD & "_hacuchecks_Index.txt" $5250RejectFilename = "G:\Indexes\Index_hacuchecks_import.rej" $5250LogFilename = "G:\Indexes\Index_hacuchecks_import.log" ; ; Make sure the drive mappings are correct. ; If Not DriveGetDrive("T:") = "\\2003imm\TeChecks" Then LogAction("5250 - Had to map T: drive to \\2003imm\TeChecks") DriveMapDel("T:") Sleep(5000) DriveMapAdd("T:", "\\2003imm\TeChecks", 9) If @error Then MsgBox(4096, "Error", "Drive could not be mapped! Contact IS Manager!") LogAction("Drive T: could not be mapped! Contact IS Manager!") Exit EndIf Sleep(5000) DriveSetLabel("T:", "IMM_TeChecks") LogAction("5250 - T: Drive mapped") EndIf If Not DriveGetDrive("G:") = "\\san1\shared\mis" Then LogAction("5250 - Had to map G: drive to \\san1\shared\mis") DriveMapDel("G:") Sleep(5000) DriveMapAdd("G:", "\\san1\shared\mis", 9) If @error Then MsgBox(4096, "Error", "Drive could not be mapped! Contact IS Manager!") LogAction("Drive G: could not be mapped! Contact IS Manager!") Exit EndIf Sleep(5000) DriveSetLabel("G:", "MIS") LogAction("5250 - G: Drive mapped") EndIf ; ; Delete files as needed ; ProgressOn("5250 Progress Meter", "Progress", "0 percent") ; ;check temp file ; If FileExists($5250tempfilename) Then $fc = FileDelete($5250tempfilename) If @error <> 0 Then MsgBox(0, "Error", "Failed to delete file! " & $5250tempfilename & "Please finish manually. Error: " & @error) Exit EndIf LogAction("5250 - Deleted file: " & $5250tempfilename) EndIf ;;GUICtrlSetData($Progress1, "5") ProgressSet(5, "5 percent") If FileExists($5250filename) Then $fc = FileDelete($5250filename) If @error <> 0 Then MsgBox(0, "Error", "Failed to delete file! " & $5250filename & "Please finish manually. Error: " & @error) Exit EndIf LogAction("5250 - Deleted file: " & $5250filename) EndIf ;;GUICtrlSetData($Progress1, "10") ProgressSet(10, "10 percent") If FileExists($5250filenameImport) Then $fc = FileDelete($5250filenameImport) If @error <> 0 Then MsgBox(0, "Error", "Failed to delete file! " & $5250filenameImport & "Please finish manually. Error: " & @error) Exit EndIf LogAction("5250 - Deleted file: " & $5250filenameImport) EndIf ; ;Copy orig file to a temporary filename ; FileMove($5250OrigFile, $5250tempfilename, 9) If @error <> 0 Then MsgBox(0, "Error", "Failed to move file! " & $5250OrigFile & " to: " & $5250tempfilename & " Please finish manually. Error: " & @error) LogAction("5250 - Failed to move file: " & $5250OrigFile & " to: " & $5250tempfilename & " Please finish manually. Error: " & @error) Exit EndIf ; ;write to log file ; LogAction("5250 - Moved file: " & $5250OrigFile & " to: " & $5250tempfilename) ; ;wait 4 seconds ; Sleep(4000) ;;GUICtrlSetData($Progress1, "15") ProgressSet(15, "15 percent") ; ;backup the orig file ; FileCopy($5250tempfilename, $5250BackupFilename, 9) If @error <> 0 Then MsgBox(0, "Error", "Failed to copy file! " & $5250tempfilename & " to: " & $5250BackupFilename & " Please finish manually. Error: " & @error) LogAction("5250 - Failed to copy file: " & $5250tempfilename & " to: " & $5250BackupFilename & " Please finish manually. Error: " & @error) Exit EndIf ; ;write to log file ; LogAction("5250 - Copy file: " & $5250tempfilename & " to: " & $5250BackupFilename) ; ;wait 4 seconds ; Sleep(4000) ;;GUICtrlSetData($Progress1, "20") ProgressSet(20, "20 percent") ; ; check yesterday's file to make sure we have the check numbers in order ; If @WDAY = 2 Then $5250PrevDayFile = "G:\Indexes\backup\" & _DateToMonth(@MON) & "-" & @YEAR & "\" & $dateThreeDaysAgoMM & $dateThreeDaysAgoDD & "_HACUCHECKS_Index.txt" Else $5250PrevDayFile = "G:\Indexes\backup\" & _DateToMonth(@MON) & "-" & @YEAR & "\" & $yesterdayMM & $yesterdaydd & "_HACUCHECKS_Index.txt" EndIf ;;GUICtrlSetData($Progress1, "30") ProgressSet(30, "30 percent") ; ;check if previous days file is available ; If FileExists($5250PrevDayFile) = True Then ; ;open both files ; FileOpen($5250BackupFilename, 0) FileOpen($5250PrevDayFile, 0) ; ;set var for reading first and last lines ; ;;GUICtrlSetData($Progress1, "35") $5250PrevSeq = StringMid(FileReadLine($5250PrevDayFile, -1), 10, 6) $5250CurrSeq = StringMid(FileReadLine($5250BackupFilename, 1), 10, 6) ; ; evaluate the difference between the two values ; If $5250CurrSeq - $5250PrevSeq <> 1 Then MsgBox(48, "Sequence Error!", "Contact the IS Manager! The check sequence is not in order! (Script will still import checks!) Prev: " & $5250PrevSeq & " Today: " & $5250CurrSeq) EndIf ; ;close the files ; FileClose($5250BackupFilename) FileClose($5250PrevDayFile) ;;GUICtrlSetData($Progress1, "40") ProgressSet(40, "40 percent") ; ; pause for 5 seconds ; LogAction("5250 - Check sequence okay prev: " & $5250PrevSeq & " todays: " & $5250CurrSeq) Sleep(5000) Else ; ;show message box to user about error ; MsgBox(64, "No Previous Day File", "Previous Day's file is missing. The script can't verify the check sequences. You will have to do this manually.(Script will still import checks!)") LogAction("5250 - Previous Day's file is missing. The script can't verify the check sequences.") EndIf ; ; GUICtrlSetData($pbar, "50") ; ; ;Delete orig file ; FileDelete($5250filename) If @error <> 0 Then MsgBox(0, "Error", "Failed to delete file! " & $5250filename & "Please finish manually. Error: " & @error) LogAction("5250 - Failed to delete file! " & $5250filename & "Please finish manually. Error: " & @error) Exit EndIf ; ;make corrections in file ; _ReplaceStringInFile($5250tempfilename, "\\2003IMM\techecks\", "@@T:\", 0, 1) ; ; notify log of status ; LogAction("5250 - Replaced drive path ") ;;GUICtrlSetData($Progress1, "50") ProgressSet(50, "50 percent") ; ; pause for 2.5 seconds ; Sleep(2500) ; ; count the lines in temp file ; $5250count = _FileCountLines($5250tempfilename) ;MsgBox(0,"Info:","File count lines: " & $5250count) ; ; pause for 2.5 seconds ; Sleep(2500) ; ; Open files for reading ; FileOpen($5250tempfilename, 0) FileOpen($5250filename, 9) ;;GUICtrlSetData($Progress1, "55") ProgressSet(55, "55 percent") ; ; set variables ; Global $5250CommaCounter, $5250CommaLocation ; ; cycle the file ; For $x = 1 To $5250count ; ;read in each line thru loop ; $5250line = FileReadLine($5250tempfilename, $x) ;MsgBox(0,"Info:","Line " & $x & " = " & $5250line) ; split the line into an array ; ; $5250CommaCounter = StringSplit($5250line, ",") ;;GUICtrlSetData($Progress1, "60") ProgressSet(60, "60 percent") ;_ArrayDisplay($5250CommaCounter) ; ; test the script to make sure it's a valid line (9 commas) ; If $5250CommaCounter[0] <> 9 Then ; ;run select for manipulate data ; Select ; ;file has too many comma's lets remove the second one. which is in the name field. ; Case $5250CommaCounter[0] = 11 ; ;find the comma ; $5250CommaLocation = StringInStr($5250line, ",", 0, 4) ;MsgBox(0, "Info:", "Comma Location: " & $5250CommaLocation) ; ;correct the line ; $5250line = StringLeft($5250line, $5250CommaLocation - 1) & StringMid($5250line, $5250CommaLocation + 1, StringLen($5250line) - 1) ;MsgBox(0, "Info:", "New Line = " & $5250line) ; ; write the line ; FileWriteLine($5250filename, $5250line) LogAction("5250 - 11 commas found new line is: " & $5250line) ; ;file has not enough comma's lets add one. Sometimes happens when there is no name ; Case $5250CommaCounter[0] = 8 ; ;find comma locaion ; $5250CommaLocation = StringInStr($5250line, ",", 0, 3) ; ; fix the line ; ;MsgBox(0, "Info:", "Comma Location: " & $5250CommaLocation) $5250line = StringLeft($5250line, $5250CommaLocation) & "HACU,1234" & StringMid($5250line, $5250CommaLocation + 2, StringLen($5250line) - 1) ; ; Display to end user new line was done. ; MsgBox(0, "Info:", "New Line = " & $5250line) LogAction("5250 - New Line = " & $5250line) ; ; write the new line ; FileWriteLine($5250filename, $5250line) Case Else MsgBox(0, "Error!:", "This line contains an error:" & @CRLF & $5250line & @CRLF & "please investigate error or contact IS Manager") LogAction("5250 - This line contains an error:" & @CRLF & $5250line & @CRLF & "please investigate error or contact IS Manager") EndSelect Else ; ;Normal line but we need to check for empty fields ; $5250CommaLocation = StringInStr($5250line, ",,,", 0, 3) ; ; normal line write out to new file with no change ; FileWriteLine($5250filename, $5250line) EndIf Next LogAction("5250 - File process complete") ; GUICtrlSetData($pbar, "75") ProgressSet(70, "70 percent") ; ; pause for 1.5 seconds ; Sleep(1500) ; ; close the file ; FileClose($5250filename) LogAction("5250 - File Closed: " & $5250filename) ;;GUICtrlSetData($Progress1, "70") ProgressSet(75, "75 percent") ; ; pause for 1.5 seconds ; Sleep(1500) ; ; close the file ; FileClose($5250tempfilename) LogAction("5250 - File Closed: " & $5250tempfilename) ; ; pause for 5 seconds ; Sleep(5000) ;;GUICtrlSetData($Progress1, "80") ProgressSet(80, "80 percent") ; ; check for file ; If FileExists($5250tempfilename) Then ; ;delete file ; $fc = FileDelete($5250tempfilename) ; ; write to log ; LogAction("5250 - Delete File: " & $5250tempfilename) EndIf ; pause for 2 seconds ; Sleep(2000) ; ; copy the file ; FileCopy($5250filename, $5250filenameImport, 9) LogAction("5250 - Copied file: " & $5250filename & " to: " & $5250filenameImport) ; ; run the import ; ; ; pause for 3 seconds ; ;Sleep(3000) ;LogAction("5250 - Waited 3 seconds") ;;GUICtrlSetData($Progress1, "90") ;ProgressSet(90, "90 percent") ;LogAction("5250 - Updated progress to 90") ; ; set variables ; $sDir = "G:\AutoIT_Production\5250" LogAction("5250 - $sDir=" & $sDir) $sFile = "5250.bat" LogAction("5250 - $sFile=" & $sFile) LogAction("5250 - Set directory for batch file: " & $sDir & "\" & $sFile) ; ; run the import ; RunWait($sDir & "\" & $sFile, $sDir, @SW_SHOW) ; ;write to log file ; LogAction("5250 - Running import script: " & $sDir & "\" & $sFile) ; ;lets verify no rejects ; ; ; pause for 5 seconds ; ProgressSet(92, "92 percent") LogAction("5250 - Progress set to 92") Sleep(5000) LogAction("5250 - Waited 5 seconds") ; ;write log file to auto it log ; Global $logarray _FileReadToArray($5250LogFilename, $logarray) For $x = 1 To $logarray[0] LogAction("1750 - Import Log: " & $logarray[$x]) Next ; ;search for rejects ; LogAction("5250 - Checking for rejects:") If FileGetSize($5250RejectFilename) <> "0" Then ; ; tell end user abour reject ; MsgBox(48, "Rejects found!", "A reject was found that the script could not fix! You will need to correct this! Click ok to view the rejects.") LogAction("5250 - Rejects found:") ; ; set the variables ; $sDir = "G:\Indexes\" $sCommand = "notepad.exe " & $5250RejectFilename ; ; run the command to display the rejects ; Run($sCommand, $sDir, @SW_SHOW) ; ; read rejects into array ; _FileReadToArray($5250RejectFilename, $5250rejectarray) ; ; cycle thru array ; For $x = 1 To $5250rejectarray[0] ; ;write reject log to regular log ; LogAction("5250 - " & $5250rejectarray[$x]) Next ; ;email reject log to IS Manager ; $Body = "Reject in 5250 file: " & $5250RejectFilename & " Please review!" $AttachFiles = $5250RejectFilename _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) Else LogAction("5250 - No rejects found") EndIf ProgressSet(95, "95 percent") ; ;verify the database for the import ; If Not _FileReadToArray($5250filenameImport, $FileList) Then MsgBox(4096, "Error", " Error reading import file to Array error:" & @error) Exit EndIf ;_ArrayDisplay($FileList) $upper = $FileList[0] ;split them into arrays $FirstlineArray = StringSplit($FileList[1], ",", 0) $LastlineArray = StringSplit($FileList[$upper], ",", 0) _SQL_Startup() _SQL_RegisterErrorHandler() $newArray[0] = 0 ; ProgressSet(97, "97 percent") If _SQL_Connect(-1, "192.168.0.18", "EMC", "userx", "passxxxx") = $SQL_ERROR Then MsgBox(0 + 16 + 262144, "Error", _SQL_GetErrMsg()) LogAction("5250 - SQL error: " & _SQL_GetErrMsg()) EndIf Global $x Local $aResult, $iRows, $iColumns For $n = 1 To $upper $lineArray = StringSplit($FileList[$n], ",", 0) _SQL_GetTable2D(-1, "Select field2,field3,field4,field7 FROM sysop.ae_dt13 where field2=" & $lineArray[2], $aResult, $iRows, $iColumns); If @error Then ;no qwery returned $x = _SQL_GetErrMsg() If $x = "Query has no data" Then _ArrayAdd($newArray, $FileList[$n] & " - Missing") $newArray[0] += 1 Else ; some other SQL error need to notify user and log it MsgBox(0, "", $x) LogAction($x) EndIf $missingboolean = True Else ;qwery returned _ArrayAdd($newArray, $FileList[$n] & " - Found") $newArray[0] += 1 EndIf Next If $missingboolean = True Then ; ;send not found to log and display them for user ; Global $u, $notify For $u = 1 To $newArray[0] If StringRight($newArray[$u], 7) = "Missing" Then $notify = $notify & "Item not imported: " & $newArray[$u] & @CRLF LogAction("!!! ERROR !!!!! ERROR !!!!! ERROR !!!!! ERROR !!!!! ERROR !!! - MISSING FROM DATABASE:") LogAction("5250 - Item not imported: " & $newArray[$u]) EndIf Next ;InputBox features: Title=Yes, Prompt=Yes, Default Text=No, Height=500 If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer $sInputBoxAnswer = InputBox("Enter comment:", "Please enter a comment on why these items are missing from the import (Review reject log as needed)" & @CRLF & $notify, "", " ", "-1", "500", "-1", "-1") Select Case @error = 0 ;OK - The string returned is valid LogAction("5250 - Comment added: " & $sInputBoxAnswer) Case @error = 1 ;The Cancel button was pushed LogAction("5250 - No comment was added") Case @error = 3 ;The InputBox failed to open LogAction("5250 - Error opening input box") EndSelect Else LogAction("5250 - No missing items from database.") EndIf ProgressSet(100, "100 percent", "Complete") ; ;all done ; MsgBox(64, "Complete", "5250 import complete") LogAction("****************************************************************************************") LogAction(StringUpper("***** Completed 5250 Check Import *****")) LogAction("****************************************************************************************") ; ; Functions below ; Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf If $s_AttachFiles <> "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) SetError(1) Return 0 EndIf Next EndIf $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 Then $IPPort = 25 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf If $ssl Then $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True EndIf ;Update settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf $objEmail = "" EndFunc ;==>_INetSmtpMailCom ; ; ; Com Error Handler Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description, 3) ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) SetError(1); something to check for when this function returns Return EndFunc ;==>MyErrFunc Func LogAction($logtext) ;log to the screen listbox $tTime = _Date_Time_GetLocalTime() ;log to the text file FileOpen($logfilelocation, 9) FileWriteLine($logfilelocation, _Date_Time_SystemTimeToDateTimeStr($tTime) & " - " & $logtext) FileClose($logfilelocation) EndFunc ;==>LogAction Error Seciton: FileCopy($5250filename, $5250filenameImport, 9) LogAction("5250 - Copied file: " & $5250filename & " to: " & $5250filenameImport) ; ; run the import ; ; ; pause for 3 seconds ; ;Sleep(3000) ;LogAction("5250 - Waited 3 seconds") ;;GUICtrlSetData($Progress1, "90") ;ProgressSet(90, "90 percent") ;LogAction("5250 - Updated progress to 90") ; ; set variables ; $sDir = "G:\AutoIT_Production\5250"Log File: 05/07/2010 07:38:19 - **************************************************************************************** 05/07/2010 07:38:19 - ***** ADMINISTRATOR RAN REFERENCE NUMBER: 5250 FROM MISS-VM ***** 05/07/2010 07:38:19 - ***** FOCUS XP INFO: OPERATOR:NONE WORKSTATION DESCRIPTION: NONE ***** 05/07/2010 07:38:19 - ***** STARTED 5250 CHECK IMPORT ***** 05/07/2010 07:38:20 - **************************************************************************************** 05/07/2010 07:38:20 - 5250 - Had to map T: drive to \\2003imm\TeChecks 05/07/2010 07:38:30 - 5250 - T: Drive mapped 05/07/2010 07:38:30 - 5250 - Had to map G: drive to \\san1\shared\mis 05/07/2010 07:38:40 - 5250 - G: Drive mapped 05/07/2010 07:38:40 - 5250 - Deleted file: G:\Indexes\Index_hacuchecks_temp.txt 05/07/2010 07:38:40 - 5250 - Deleted file: G:\Indexes\hacuchecks.txt 05/07/2010 07:38:40 - 5250 - Deleted file: G:\Indexes\Index_hacuchecks_import.txt 05/07/2010 07:38:41 - 5250 - Moved file: T:\TeChecksIndexBuilder\Archive\Indexes\Index.txt to: G:\Indexes\Index_hacuchecks_temp.txt 05/07/2010 07:38:45 - 5250 - Copy file: G:\Indexes\Index_hacuchecks_temp.txt to: G:\Indexes\backup\May-2010\0507_hacuchecks_Index.txt 05/07/2010 07:38:49 - 5250 - Check sequence okay prev: 253307 todays: 253308 05/07/2010 07:38:54 - 5250 - Replaced drive path 05/07/2010 07:39:05 - 5250 - File process complete 05/07/2010 07:39:07 - 5250 - File Closed: G:\Indexes\hacuchecks.txt 05/07/2010 07:39:08 - 5250 - File Closed: G:\Indexes\Index_hacuchecks_temp.txt 05/07/2010 07:39:13 - 5250 - Delete File: G:\Indexes\Index_hacuchecks_temp.txt 05/07/2010 07:39:15 - 5250 - File Closed: G:\Indexes\hacuchecks.txt 05/07/2010 07:39:17 - 5250 - Copied file: G:\Indexes\hacuchecks.txt to: G:\Indexes\Index_hacuchecks_import.txt
-
Embedded IE memory keeps growing
FrozenTeeth replied to FrozenTeeth's topic in AutoIt General Help and Support
I have fixed the issue for now. The memory leaks don't happen as long as I close all IE windows when the program starts (The program kills them for me). Then it launches the IE from a different exe this way it has it's own process and does the IECreate and IEQuit just fine on it's own. The end user will just have to click a button to launch the next window to check the link. THanks for all the help! -
Embedded IE memory keeps growing
FrozenTeeth replied to FrozenTeeth's topic in AutoIt General Help and Support
I used yahoo as an example. You could change it to any page. The internal web site I'm checking has over 1000 pages and they don't contain video mainly text and pictures. -
Embedded IE memory keeps growing
FrozenTeeth replied to FrozenTeeth's topic in AutoIt General Help and Support
No offense was taken at all. That's how we learn! You have been very helpful. -
Embedded IE memory keeps growing
FrozenTeeth replied to FrozenTeeth's topic in AutoIt General Help and Support
Thanks for recode. Yes the _arraydelete was bogus I new that could be removed. I'm so used to using Dim from my BASIC days The only real code I omitted was the distinct web pages I'm looking for. I might try to launch the IE in a separate exe maybe this will show the end-user the webpage then quit. Thanks again for all your help. I'll continue the battle. -
Embedded IE memory keeps growing
FrozenTeeth replied to FrozenTeeth's topic in AutoIt General Help and Support
Well I have looked into this some more and I can't find anyway to tell how much memory my program is using while it's running. I searched the forums and most memory hits are about reading and writing memory itself. I looked thru the help file and couldn't find anything that tell me the allocated memory of a process. any help is appreciated. thanks -
Embedded IE memory keeps growing
FrozenTeeth replied to FrozenTeeth's topic in AutoIt General Help and Support
Anyone come up with anything? I haven't found anything yet. -
I wrote a program to check the links of a page then log them and launch the links. it will loop thru the links and remove the ones I want. In the code example I'm searching the main yahoo site and removing all the http://www.yahoo.com links then removing any duplicates (_arrayunique) then logging and launching any leftover links. Everything is working perfect except the memory keeps climbing and climbing until the computer runs out of memory. I've tried some cleanup and deleting the array before it starts all over but to no avail. I even found the reduce memory progam (_ReduceMemory) from searching here and it does release some memory but never keeps it to an average low. The final program will be watching a corporate intranet. I used www.yahoo.com as an example. Thanks for all the help in advance. I am running this on a Windows 7 64-bit machine with 8GB of memory but it will run finally on a 32-bit server 2003 with only 2GB of memory. (If that matters) #include <GuiComboBox.au3> #include <GuiComboBoxEx.au3> #include <array.au3> #include <GuiTab.au3> #include <IE.au3> #include <GuiEdit.au3> #include <Process.au3> #include <File.au3> #include <String.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) ; ; ###### ## ## #### ;## ## ## ## ## ;## ## ## ## ;## #### ## ## ## ;## ## ## ## ## ;## ## ## ## ## ; ###### ####### #### ; ; Opt("GUIOnEventMode", 1) ; ;dim local global var's ; Dim $formLinkChecker, $oIE, $GUIActiveX, $stoplinkrun, $arraycount, $oLinks, $oLink Dim $iNumLinks, $sHTML, $firstarray, $btnStop, $lblStatusUpdate, $lblStatusText If FileExists(@ScriptDir & "\linksfound.txt") Then FileDelete(@ScriptDir & "\linksfound.txt") ; ; ; $formLinkChecker = GUICreate("Link Checker", 801, 571, 192, 124) $btnStop = GUICtrlCreateButton("Stop", 632, 520, 81, 25, $WS_GROUP) GUICtrlSetOnEvent($btnStop, "btnStopClick") $lblStatusUpdate = GUICtrlCreateLabel("..........................................................", 49, 522, 573, 17) GUICtrlSetOnEvent($lblStatusUpdate, "lblStatusUpdateClick") $lblStatusText = GUICtrlCreateLabel("Status:", 9, 522, 37, 17) GUICtrlSetOnEvent($lblStatusText, "lblStatusTextClick") GUISetOnEvent($GUI_EVENT_MINIMIZE, "formLinkCheckerMinimize", $formLinkChecker) GUISetOnEvent($GUI_EVENT_MAXIMIZE, "formLinkCheckerMaximize", $formLinkChecker) GUISetOnEvent($GUI_EVENT_RESTORE, "formLinkCheckerRestore", $formLinkChecker) GUISetOnEvent($GUI_EVENT_CLOSE, "formLinkCheckerClose", $formLinkChecker) GUISetState(@SW_SHOW) $oIE = _IECreateEmbedded() $GUIActiveX = GUICtrlCreateObj($oIE, 5, 5, 790, 510) $stoplinkrun = True Func formLinkCheckerMinimize() EndFunc ;==>formLinkCheckerMinimize Func formLinkCheckerMaximize() EndFunc ;==>formLinkCheckerMaximize Func formLinkCheckerRestore() EndFunc ;==>formLinkCheckerRestore Func btnStopClick() $stoplinkrun = False EndFunc ;==>btnStopClick Func lblStatusUpdateClick() EndFunc ;==>lblStatusUpdateClick Func lblStatusTextClick() EndFunc ;==>lblStatusTextClick Func formLinkCheckerClose() Exit EndFunc ;==>formLinkCheckerClose _IENavigate($oIE, "http://www.yahoo.com") While 1 If $stoplinkrun = True Then _IENavigate($oIE, "http://www.yahoo.com") StartLinkProcess() EndIf WEnd Func StartLinkProcess() Local $firstarray[1], $arraycountNew, $secondarray[1], $thirdarray[1] $arraycount = 0 $oLinks = _IELinkGetCollection($oIE) $iNumLinks = @extended For $oLink In $oLinks $arraycount += 1 If IsArray($firstarray) Then _ArrayAdd($firstarray, $oLink.href) EndIf Next $firstarray[0] = $arraycount ;clear some vars not used any more $sHTML = "" $iNumLinks = 0 $arraycount = 0 $oLinks = "" $oLink = "" ;_ArrayDisplay($firstarray, "1st") ; ;remove known unwanted links ; $arraycountNew = 0 For $u = 1 To $firstarray[0] If StringLeft($firstarray[$u], 20) <> "http://www.yahoo.com" Then $arraycountNew += 1 _ArrayAdd($secondarray, $firstarray[$u]) EndIf ;remove non http links If StringLeft($firstarray[$u], 5) <> "http:" Then $arraycountNew += 1 _ArrayAdd($secondarray, $firstarray[$u]) EndIf Next $secondarray[0] = $arraycountNew $arraycountNew = 0 ;_ArrayDisplay($secondarray, "2nd") For $x = 0 To $firstarray[0] _ArrayDelete($firstarray, $x) Next ; ;if duplicates create unique array ; $thirdarray = _ArrayUnique($secondarray) ;_ArrayDisplay($thirdarray, "3rd") For $x = 0 To $secondarray[0] _ArrayDelete($secondarray, $x) Next ; ; launch the link ; For $u = 1 To $thirdarray[0] RecordTheLinks($thirdarray[$u]) GUICtrlSetData($lblStatusUpdate, $thirdarray[$u]) ; ;check if stop button pushed then exit loop ; If $stoplinkrun = False Then $u = $thirdarray[0] EndIf Next ; ;cleanup vars ; $u = 0 For $x = 1 To $thirdarray[0] _ArrayDelete($thirdarray, $x) Next _ReduceMemory() ; ;wait 1 minute and try again ; Sleep(60000) EndFunc ;==>StartLinkProcess ; ; ; Func _ReduceMemory($i_PID = -1); thx to wOuters If $i_PID <> -1 Then Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID) Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0]) DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0]) Else Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1) EndIf Return $ai_Return[0] EndFunc ;==>_ReduceMemory Func RecordTheLinks($link2record) _FileWriteLog(@ScriptDir & "\linksfound.txt", $link2record) _IENavigate($oIE, $link2record) EndFunc ;==>RecordTheLinks
-
Working with 2 GUI's can't close second GUI
FrozenTeeth replied to FrozenTeeth's topic in AutoIt GUI Help and Support
Thanks for the quick reply, and the quick fix. I now see what I was doing wrong. Thanks again. Great to see helpful people. Keep it up! -
I'v been beating my head over this. I searched and search the forum and actualy found a recent thread with a similar issue 2 GUI's I have a larger program but I have pulled out all no essental stuff and it still doesn't work. I can start the the main GUI and then open the second GUI (my settings GUI) but it won't let me close the GUI and return to the main GUI. From the code you see I've tried to put the GUI exit code in diffrent spots and it still fails. What am I doing wrong?? Thanks for the help. #include <GuiComboBox.au3> #include <GuiComboBoxEx.au3> #include <GuiEdit.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> Opt("GUIOnEventMode", 1) $formLink = GUICreate("Link", 801, 571, 192, 124) $btnStart = GUICtrlCreateButton("Start", 10, 10, 80, 30) Local $formGlobal, $msg2 GUICtrlSetOnEvent($btnStart, "btnStartClick") GUISetState(@SW_SHOW) ; ; main loop ; While 1 Sleep(100) $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func btnStartClick() globalSettingsGUI() EndFunc ;==>btnStartClick ; Func globalSettingsGUI() GUISetState(@SW_DISABLE, $formLink) $formGlobal = GUICreate("Global Settings", 506, 271, 228, 426) $btnGlobalSaveSettings = GUICtrlCreateButton("Save Settings", 372, 222, 125, 33) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetOnEvent(-1, "btnGlobalSaveSettingsClick") GUISetState(@SW_SHOW) GUISwitch($formGlobal) ; ; loop ; While 1 Sleep(100) $msg2 = GUIGetMsg() Select Case $msg2 = $GUI_EVENT_CLOSE MsgBox(0, "test", "test") GUISetState(@SW_DISABLE, $formGlobal) GUISetState(@SW_ENABLE, $formLink) GUISwitch($formLink) GUIDelete($formGlobal) Return EndSelect WEnd EndFunc ;==>globalSettingsGUI Func formGlobalClose() MsgBox(0, "test", "test") GUISetState(@SW_DISABLE, $formGlobal) GUISetState(@SW_ENABLE, $formLink) GUISwitch($formLink) GUIDelete($formGlobal) EndFunc ;==>formGlobalClose Func formGlobalMaximize() EndFunc ;==>formGlobalMaximize Func formGlobalMinimize() EndFunc ;==>formGlobalMinimize Func formGlobalRestore() EndFunc ;==>formGlobalRestore Func btnGlobalSaveSettingsClick() MsgBox(0, "test", "test") GUISetState(@SW_DISABLE, $formGlobal) GUISetState(@SW_ENABLE, $formLink) GUISwitch($formLink) GUIDelete($formGlobal) EndFunc ;==>btnGlobalSaveSettingsClick
-
What's wrong with my error checking?
FrozenTeeth replied to FrozenTeeth's topic in AutoIt General Help and Support
It moves 6 files a day so I would think that $filestomove array is correct and working the way it should. -
The below code moves reports to and archive directory. It also logs the move. The issue I have is the @error returns a zero as in my log file it say's failed to move report. Even thou when I look the file(s) has moved just fine! ; ;move reports for archive ; Dim $filestomove $filestomove = _FileListToArray($ReportsDirectory, "ilb*.rpa") For $x = 1 To $filestomove[0] FileMove($ReportsDirectory & $filestomove[$x], $ReportsBackupDirectory, 1) If @error = 0 Then LogAction("Failed to move report: " & $ReportsDirectory & $filestomove[$x] & " to " & $ReportsBackupDirectory & $filestomove[$x] & " file already exists") Else LogAction("Moved report: " & $ReportsDirectory & $filestomove[$x] & " to " & $ReportsBackupDirectory & $filestomove[$x]) EndIf Next From the help file: FileMove Moves one or more files FileMove ( "source", "dest" [, flag] ) Parameters source The source path and filename of the file to move. (* wildcards are supported) dest The destination path and filename of the moved file. (* wildcards are supported) flag [optional] this flag determines whether to overwrite files if they already exist: Can be a combination of the following: 0 = (default) do not overwrite existing files 1 = overwrite existing files 8 = Create destination directory structure if it doesn't exist (See Remarks). Return Value Success: Returns 1.
-
COM Error Number 80020009
FrozenTeeth replied to FrozenTeeth's topic in AutoIt General Help and Support
Whats weird is I changed to this com handler and it's running fine??!?!?!? Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description, 3) ConsoleWrite("### Com Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) SetError(1); something to check for when this function returns Return EndFunc ;==>MyErrFunc I'll do some more testing