
Gene
Active Members-
Posts
478 -
Joined
-
Last visited
Everything posted by Gene
-
Con is a reserved word, it goes back as far as DOS 2.11 You could use Kon, it would sound the same. Gene
-
List view works great, even when I change tabs.
Gene replied to Gene's topic in AutoIt GUI Help and Support
Thanks for the quick reply. I have tried setting the position 2000 pixels to the left and right, but nothing with the X axis. I continued to get the smear on the other tabs which was better than having the listview in front of them, but not much. I remembered using a listviiew a couple years ago with no problem. I've been reviewing that code since my post and have not yet seen anything. There is of course 3 differences. That was a loop, this is event mode, the method of populating it, that was a long list, changed in frequently and this is a short one and is revised every time a different record is viewed. Gene -
This is in a people tracking program. TAB 0 is the contact info. The others cover personal life details. The listview (LV) is on TAB 0, it displays the record with the focus and the 8 adjacent records on either side of it, 17 all together. Works great. Problem is, when another TAB is clicked, it paints and is immediately partially obscured by the LV. Graphic below. I've tried Setting the state disabled and/or hide, I even tried deleting the list view. Suggestions are welcome. Some code snippets.... <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--> $tTabGroupClick = GUICtrlRead($tTabGroup) Select Case $tTabGroupClick = 0 _Lv_Show() GUICtrlSetState($sT0SerchName, $GUI_FOCUS) _DisplayRec() Case $tTabGroupClick = 1 _Lv_Show() GUICtrlSetState($sT1SerchName, $GUI_FOCUS) _DisplayRec() ;===================================== Func _Lv_Show() If $tTabGroupClick = 0 Then GUICtrlSetState($sT0SerchResult, $GUI_ENABLE + $GUI_SHOW) $k = 0 Return 0 Else GUICtrlSetState($sT0SerchResult, $GUI_DISABLE + $GUI_Hide ) $k = 1 Return 1 EndIf EndFunc ;==>_Lv_Show ;=========================================== Func _DispLview() If $tTabGroupClick = 0 Then Local $sT0SerchResult = GUICtrlCreateListView("L. Name|F. Name|Initial|Address|City|State|Zip", 340, 70, 351, 306, $LVS_SORTASCENDING,$LVS_SHOWSELALWAYS) GUICtrlSetState($sT0SerchResult, $GUI_ENABLE + $GUI_SHOW) Else GUICtrlDelete ( $sT0SerchResult ) _DisplayRec() EndIf If $RecNmbr - 8 > -1 Then $aLVRecs17 = StringSplit($aAtData[$RecNmbr - 8], "|") $aLVitems[17] = $aLVRecs17[1] & "|" & $aLVRecs17[2] & "|" & $aLVRecs17[3] & "|" & $aLVRecs17[6] & "|" & $aLVRecs17[8] & "|" & $aLVRecs17[9] $sT0SerchResult_17 = GUICtrlCreateListViewItem($aLVitems[17], $sT0SerchResult) EndIf If $RecNmbr - 7 > -1 Then $aLVRecs16 = StringSplit($aAtData[$RecNmbr - 7], "|") $aLVitems[16] = $aLVRecs16[1] & "|" & $aLVRecs16[2] & "|" & $aLVRecs16[3] & "|" & $aLVRecs16[6] & "|" & $aLVRecs16[8] & "|" & $aLVRecs16[9] $sT0SerchResult_16 = GUICtrlCreateListViewItem($aLVitems[16], $sT0SerchResult) EndIf If $RecNmbr - 6 > -1 Then $aLVRecs1 = StringSplit($aAtData[$RecNmbr - 6], "|") $aLVitems[1] = $aLVRecs1[1] & "|" & $aLVRecs1[2] & "|" & $aLVRecs1[3] & "|" & $aLVRecs1[6] & "|" & $aLVRecs1[8] & "|" & $aLVRecs1[9] $sT0SerchResult_1 = GUICtrlCreateListViewItem($aLVitems[1], $sT0SerchResult) EndIf If $RecNmbr - 5 > -1 Then $aLVRecs2 = StringSplit($aAtData[$RecNmbr - 5], "|") $aLVitems[2] = $aLVRecs2[1] & "|" & $aLVRecs2[2] & "|" & $aLVRecs2[3] & "|" & $aLVRecs2[6] & "|" & $aLVRecs2[8] & "|" & $aLVRecs2[9] $sT0SerchResult_2 = GUICtrlCreateListViewItem($aLVitems[2], $sT0SerchResult) EndIf If $RecNmbr - 4 > -1 Then $aLVRecs3 = StringSplit($aAtData[$RecNmbr - 4], "|") $aLVitems[3] = $aLVRecs3[1] & "|" & $aLVRecs3[2] & "|" & $aLVRecs3[3] & "|" & $aLVRecs3[6] & "|" & $aLVRecs3[8] & "|" & $aLVRecs3[9] $sT0SerchResult_3 = GUICtrlCreateListViewItem($aLVitems[3], $sT0SerchResult) EndIf If $RecNmbr - 3 > -1 Then $aLVRecs4 = StringSplit($aAtData[$RecNmbr - 3], "|") $aLVitems[4] = $aLVRecs4[1] & "|" & $aLVRecs4[2] & "|" & $aLVRecs4[3] & "|" & $aLVRecs4[6] & "|" & $aLVRecs4[8] & "|" & $aLVRecs4[9] $sT0SerchResult_4 = GUICtrlCreateListViewItem($aLVitems[4], $sT0SerchResult) EndIf If $RecNmbr - 2 > -1 Then $aLVRecs5 = StringSplit($aAtData[$RecNmbr - 2], "|") $aLVitems[5] = $aLVRecs5[1] & "|" & $aLVRecs5[2] & "|" & $aLVRecs5[3] & "|" & $aLVRecs5[6] & "|" & $aLVRecs5[8] & "|" & $aLVRecs5[9] $sT0SerchResult_5 = GUICtrlCreateListViewItem($aLVitems[5], $sT0SerchResult) EndIf If $RecNmbr - 1 > -1 Then $aLVRecs6 = StringSplit($aAtData[$RecNmbr - 1], "|") $aLVitems[6] = $aLVRecs6[1] & "|" & $aLVRecs6[2] & "|" & $aLVRecs6[3] & "|" & $aLVRecs6[6] & "|" & $aLVRecs6[8] & "|" & $aLVRecs6[9] $sT0SerchResult_6 = GUICtrlCreateListViewItem($aLVitems[6], $sT0SerchResult) EndIf $aLVRecs7 = StringSplit($aAtData[$RecNmbr], "|") $aLVitems[7] = $aLVRecs7[1] & "|" & $aLVRecs7[2] & "|" & $aLVRecs7[3] & "|" & $aLVRecs7[6] & "|" & $aLVRecs7[8] & "|" & $aLVRecs7[9] $sT0SerchResult_7 = GUICtrlCreateListViewItem($aLVitems[7], $sT0SerchResult) GUICtrlSetColor ( -1, 0xff0000) GUICtrlSetBkColor(-1,0x00ff00) If $RecNmbr + 1 < UBound($aAtData) Then $aLVRecs8 = StringSplit($aAtData[$RecNmbr + 1], "|") $aLVitems[8] = $aLVRecs8[1] & "|" & $aLVRecs8[2] & "|" & $aLVRecs8[3] & "|" & $aLVRecs8[6] & "|" & $aLVRecs8[8] & "|" & $aLVRecs8[9] $sT0SerchResult_8 = GUICtrlCreateListViewItem($aLVitems[8], $sT0SerchResult) EndIf If $RecNmbr + 2 < UBound($aAtData) Then $aLVRecs9 = StringSplit($aAtData[$RecNmbr + 2], "|") $aLVitems[9] = $aLVRecs9[1] & "|" & $aLVRecs9[2] & "|" & $aLVRecs9[3] & "|" & $aLVRecs9[6] & "|" & $aLVRecs9[8] & "|" & $aLVRecs9[9] $sT0SerchResult_9 = GUICtrlCreateListViewItem($aLVitems[9], $sT0SerchResult) EndIf If $RecNmbr + 3 < UBound($aAtData) Then $aLVRecs10 = StringSplit($aAtData[$RecNmbr + 3], "|") $aLVitems[10] = $aLVRecs10[1] & "|" & $aLVRecs10[2] & "|" & $aLVRecs10[3] & "|" & $aLVRecs10[6] & "|" & $aLVRecs10[8] & "|" & $aLVRecs10[9] $sT0SerchResult_10 = GUICtrlCreateListViewItem($aLVitems[10], $sT0SerchResult) EndIf If $RecNmbr + 4 < UBound($aAtData) Then $aLVRecs11 = StringSplit($aAtData[$RecNmbr + 4], "|") $aLVitems[11] = $aLVRecs11[1] & "|" & $aLVRecs11[2] & "|" & $aLVRecs11[3] & "|" & $aLVRecs11[6] & "|" & $aLVRecs11[8] & "|" & $aLVRecs11[9] $sT0SerchResult_11 = GUICtrlCreateListViewItem($aLVitems[11], $sT0SerchResult) EndIf If $RecNmbr + 5 < UBound($aAtData) Then $aLVRecs12 = StringSplit($aAtData[$RecNmbr + 5], "|") $aLVitems[12] = $aLVRecs12[1] & "|" & $aLVRecs12[2] & "|" & $aLVRecs12[3] & "|" & $aLVRecs12[6] & "|" & $aLVRecs12[8] & "|" & $aLVRecs12[9] $sT0SerchResult_12 = GUICtrlCreateListViewItem($aLVitems[12], $sT0SerchResult) EndIf If $RecNmbr + 6 < UBound($aAtData) Then $aLVRecs13 = StringSplit($aAtData[$RecNmbr + 6], "|") $aLVitems[13] = $aLVRecs13[1] & "|" & $aLVRecs13[2] & "|" & $aLVRecs13[3] & "|" & $aLVRecs13[6] & "|" & $aLVRecs13[8] & "|" & $aLVRecs13[9] $sT0SerchResult_13 = GUICtrlCreateListViewItem($aLVitems[13], $sT0SerchResult) EndIf If $RecNmbr + 7 < UBound($aAtData) Then $aLVRecs14 = StringSplit($aAtData[$RecNmbr + 7], "|") $aLVitems[14] = $aLVRecs14[1] & "|" & $aLVRecs14[2] & "|" & $aLVRecs14[3] & "|" & $aLVRecs14[6] & "|" & $aLVRecs14[8] & "|" & $aLVRecs14[9] $sT0SerchResult_14 = GUICtrlCreateListViewItem($aLVitems[14], $sT0SerchResult) EndIf If $RecNmbr + 8 < UBound($aAtData) Then $aLVRecs15 = StringSplit($aAtData[$RecNmbr + 8], "|") $aLVitems[15] = $aLVRecs15[1] & "|" & $aLVRecs15[2] & "|" & $aLVRecs15[3] & "|" & $aLVRecs15[6] & "|" & $aLVRecs15[8] & "|" & $aLVRecs15[9] $sT0SerchResult_15 = GUICtrlCreateListViewItem($aLVitems[15], $sT0SerchResult) EndIf EndFunc ;==>_DispLview ;======================================== Func _DisplayRec() $sWrkvar = $aAtData [$RecNmbr] $a_Record = StringSplit($sWrkvar, "|") $j = 1 $sT0_LName = $a_Record[$j] $j = $j + 1 $sT0_Fname = $a_Record[$j] $j = $j + 1 $sT0_Initial = $a_Record[$j] $j = $j + 1 $sT0_Computer = $a_Record[$j] $j = $j + 1 $dT0_DateTimeofRecord = $a_Record[$j] $j = $j + 1 $sT0_Addr1 = $a_Record[$j] $j = $j + 1 $sT0_Addr2 = $a_Record[$j] . . . . . . snipped $rT5_Administrator = $a_Record[$j] $j = $j + 1 $rT5_Deceased = $a_Record[$j] $j = $j + 1 $rT5_NoContact = $a_Record[$j] $j = $j + 1 $rT5_Current = $a_Record[$j] GUICtrlSetData($sT0LName, $sT0_LName) GUICtrlSetData($sT0Fname, $sT0_Fname) GUICtrlSetData($sT0Initial, $sT0_Initial) GUICtrlSetData($sT0Addr1, $sT0_Addr1) . . . . . . snipped GUICtrlSetData($rT4Administrator, $rT4_Administrator) GUICtrlSetData($rT4Deceased, $rT4_Deceased) GUICtrlSetData($rT4NoContact, $rT4_NoContact) GUICtrlSetData($rT4Current, $r_Current) sT0CurrentNameChange() _DispLview() EndFunc ;==>_DisplayRec<!--c2--></div><!--ec2-->
-
I'm adding context sensitive help. To do that, as data is being entered the user tabs from field to field or clicks on fields as needed. I'd, like to set a variable to the context of the field with the foucus when it gets the focus in case the user presses the F1 key. I can make code execute when I tab out of a field or when I click out of a field, but not on tabbing or clicking into a field. Some example code is below. The line tabbed in above the ellipsis and the 4th UDF below it (also tabbed in) are examples of something like what I want to do, but don't know how. I could be approaching it from the wrong direction too. Gene Edit 2007/03/16 I discovered ControlGetFocus ( "title" [, "text"] ), I think I can use it to set the Help Topic and to run any other code that would benefit from GotFocus. If there is a better way, I'd like to know it. <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->Local $sT0LName = GUICtrlCreateInput("", 14, 84, 121, 21) GUICtrlSetOnEvent(-1, "sT0LNameChange") #cs GUICtrlSetOnEvent($sT0LName, sT0LNameonfocus) ; Functionality I'm looking for. #ce Local $sT0Fname = GUICtrlCreateInput("", 145, 84, 121, 21) GUICtrlSetOnEvent(-1, "sT0FnameChange") Local $sT0Initial = GUICtrlCreateInput("", 270, 84, 35, 21) GUICtrlSetOnEvent(-1, "sT0InitialChange") . . . Func sT0LNameChange() $sT0_LName = GUICtrlRead($sT0LName) _StringProper($sT0_LName) GUICtrlSetData($sT0LName, $sT0_LName) EndFunc ;==>sT0LNameChange Func sT0FnameChange() $sT0_Fname = GUICtrlRead($sT0Fname) _StringProper($sT0_Fname) GUICtrlSetData($sT0Fname, $sT0_Fname) EndFunc ;==>sT0FnameChange Func sT0InitialChange() $sT0_Initial = GUICtrlRead($sT0Initial) $sT0_Initial = StringUpper($sT0_Initial) GUICtrlSetData($sT0Initial, $sT0_Initial) EndFunc ;==>sT0InitialChange #cs Func sT0LNameonfocus() $sHelpTopic = '"LName"' EndFunc ;==>sT0LNameChange #ce<!--c2--></div><!--ec2-->
-
Is Koda supposed to generate Event UDFs for Menu events (in event mode)? Gene
-
Hi, I'm using Koda Ver 1.6.0.2 I used Save As to save my project when I started. Now I've done quite a bit of work and when I try to Save or Save As, I get the error below. I've already written off this work. Hope to hear from you soon. Gene >>>>>>>>>>>> Window Details <<<<<<<<<<<<< Title: Koda FormDesigner Class: #32770 Size: X: 335 Y: 366 W: 489 H: 126 >>>>>>>>>>> Mouse Details <<<<<<<<<<< Screen: X: 645 Y: 387 Cursor ID: 2 >>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<< RGB: Hex: 0x026AFE Dec: 158462 >>>>>>>>>>> Control Under Mouse <<<<<<<<<<< Size: Control ID: ClassNameNN: Text: >>>>>>>>>>> Status Bar Text <<<<<<<<<<< >>>>>>>>>>> Visible Window Text <<<<<<<<<<< OK Access violation at address 00403B00 in module 'FD.exe'. Read of address FFFFFFDD. >>>>>>>>>>> Hidden Window Text <<<<<<<<<<< {Edit Mar 3, 2007} I have used it again gingerly once since the error above, saving about every 2 minutes. The error did not repeat. I didn't finish the GUI and haven't had s chance to work on it today.
-
No. I don't think he embeds this in each script. I used to use a similar scheme. To put it into effect, the update script was separate from the script to be compliled. From Win Explorer I would run "Compile with Options" after a right click. The first time I compiled a given script, I would click the compiler's "Run" Tab then I pasted a call like "UpDateVerNo.exe "ScriptToBeCompiledFileName.au3" into the "Run Before" text box. Then when I clicked the "Compile" button the ScriptToBeCompiled would be updated just before it was compiled. Of course you would have to code the updater script to take the "ScriptToBeCompiledFileName" from its command line. The only problem with this was that if the compile failed for any reason, I had to reset the version number in the script that failed. That said, I don't use this method any more and all of the above is from memory. Since I started using Component Software's RCS I'm back to manually setting the version at compile time because I haven't figured out how to get the version out of it programmatically. Didn't say I couldn't, said I haven't. Gene {edit 2/28/07a} Left out a sentence. {edit 2/28/07b} I had another thought, you could create an edited version of @GEOSOFT's UDF to decrement the version if the "new" ScriptToBeCompiledFileName.EXE does not exist and call it from the "Run after" text box. You could also embed the ScriptToBeCompiledFileName.au3.ini file in your ScriptToBeCompiledFileName.au3 (the names of the compiler directives change when embeded and you'd need to look them up). Then turn on Auto Incremnt Version and the compiler wrapper would increment the version each time you compile using the wrapper.
-
It does do that, and produces an HTML log file with the latest data at the top of the list, so you don't have to spend a lot of time scrolling down to see what has been happening lately. It puts in column headers every X number of rows (you can change X in the INI) MaxRows=20 is the default. For each day/week/month that IP Address changes occur it inserts a Total Row for the appropriate time unit. That row shows the current date, thenumber of IP Address changes including downtime changes, thenumber of times the connection went down, theamount of downtime in seconds and theaverage number of seconds per time down.If you have a gmail account and configure Jdeb's Send Mail UDF, you can run it on another PC/Server on your network and each time MaxRows is reached, it will send you an emai. No email = nothing serious going on with your connection. Gene
-
I try hard to avoid too much maturity, most people wear it poorly. Thanks for the script comment. Gene
-
Thanks for fixing the balloon issue! Gene
-
I can read size 2 and above just fine. If I remember from your Valik Avatar thread correctly, I'm probably older than your Dad. My Avatar shows how old I feel. Gene
-
Thank you Valik! Gene
-
This is nice, I especially like the 12 month calendar. Some suggestions follow: The tip at the bottom of the screen (BOS) is too terse, non-computer people would be confused. I had to read it twice. Check the punctuation. (Same for the Help box)Why not use the "FileOpenDialog ( )" function to select the file to open instead of requiring the user to type it in from memory?Alternatively you could read the "journals" folder and populate a ComboBox for the user to select from.If you used the "yyyy-mm-dd" format, the files would almost always be in date order for the user.You could also use a key logger to allow the user to type in a date and with each character they type, re-populate a list of days until the one of interest appears. If you added a field for "Key Words" you could use this same method to search the Key Word fields to re-populate a list of the records with those words. DO NOT ASK for help with a key logger, if you develop one DO NOT POST IT, you will be in deep doodoo. I'm probably going to get some flack for mentioning one here, even though this would be a legitimate use of one.You could use the calendar UDF to save the file by the date the user selects from a popup calendar of the current month, this would insure that the format is always the same. This would also let you remove the date format instructions.You should remove one of "date format instructions" and relocate the other in any case.You might want to add a config dialog and allow the user to select colors and fonts they like.An option to change passwords would be appropriate too.Given your tip at the BOS, you might want to popup a warning message box if the user attempts to overwrite an existing file.I didn't check to see if you can set a style for wordwrap, but you should.Instead of having a file for each day, you could put them all in one file, encrypt the date and use the date as the KEY field. This would add to the security.Alternatively you could encrypt the date and use that for the file name if you don't want to use a single file.Using either 7.0 or 7.1 above, you could use the" FileSetTime ( )" function to obscure the dates of all data files so Mr. or Mrs Nosey would have nearly nothing to go on.All the suggestions not withstanding, I do like your Diary. Gene PS. Obviously the foregoing is a stream of conciousness kind of thing. {edit 2/27/07} As regards dates, if you make the program handle the dates, you can extend them to the time as well. hh:mm:ss would virtually guarantee no date-time collisions, and all entries would be chronological. That would make it difficult for most users to purposly mis-date an entry. You could disallow any post dated entries to stymie anyone who would set the computer clock ahead to make an entry and then set it back to the correct time and date. If there is an open Internet connection, you could include a freebie Inet time-n-date setter and compare the Inet Time and date to the computer time and date.
-
Thanks for the reminder, I have 7-Zip on a jump drive and had forgotten it. Gene
-
I hate to whine, but I don't have a RAR tool, can do ZIPs, have not seen a free RAR tool. Gene
-
How to get process info ( like cpu and mem usage )
Gene replied to pinkfoyd's topic in AutoIt General Help and Support
Hi @th.meger I tried out the script above (curosity) It seemed to be very slow. My PC is 1.5Ghz, 256MbRAM, WinXP Pro. Attached is a graphic from my TaskManager Preformance tab while the script was running. The msgbox value was 50. -
This is a near public place, we are all responsible for our own screwups. I agree that the result of your screwup was unpleasant, but what if they hadn't told you, what if they had kept quiet, logged on as you and caused trouble in 20 or 30 threads? You got out light. That said, if you want much help from the Forum, you're going to have to post source code. People have to see what you're doing to be able to see what is wrong.
-
Sorry about the tags, I didn't realize at first that I had used the wrong tags. I uploaded a new ZIP file. It is interesting, but far longer than expected when I started it. I thought you had to give explicit paths to FileInstalls, or did you mean in uploaded scripts. H'mmmn, the Help file doesn't actually say that, I think I just assumed it from the Help file example script. I still plan to add a traymenu to it for easier configuration. In addition to the present INI file it will allow the user to set the "To:" name(s) and Address, the "From:" will continue to be hard coded.
-
I have had a problem of up and down connection and sometimes hundreds of IP changes in a day. I saw that others had similar problems and decided to post my solution to the problem. This script is not polished, but it seems to be working fine. It is also not simple, I wanted an output document I could beat my ISP with. It still has some research code in it that tracks the time to process a whole cycle minus the Sleep() time and the time taken to process the cycles that are involved when there is no obvious downtime and just the IP address is changed. There is also some remnants of code to track process flow, but it is remarked out. I'm still trying to figure out how to determine the average length of the interuption when the IP address changes. A lot of the time my connection is uninterupted for days or weeks. At other times the IP address may change from a high of more than once a second to 2 or 3 times an hour. In the "good" times the IP only changes once every 30 to 45 days. It has 2 FileInstalls, they are included in the ZIP file. I'd appreciate any comment, rocks or otherwise. {EDIT 2/28/07} I should have put this in here to begin with In addition to tracking up/down time, it also produces an HTML log file with the latest data at the top of the list, so you don't have to spend a lot of time scrolling down to see what has been happening lately. It inserts column headers every X number of rows (you can change X in the INI) MaxRows=20 is the default. For each day/week/month that IP Address changes occur it inserts a Total Row for the appropriate time unit. That row shows the current date, thenumber of IP Address changes including downtime changes, thenumber of times the connection went down, theamount of downtime in seconds and theaverage number of seconds per time down.If you have a gmail account and configure Jdeb's Send Mail UDF, you can run it on another PC or Server on your network and each time MaxRows is reached, it will send you an email. No email = nothing serious going on with your connection. If you have an easy to read record of you up/down experience Your ISP wil probably take you seriously, mine did. Mine did note that they liked that I had let it run during the good times as well. {EDIT 2/27/07c} I don't know why, but all the backslashes have disappeared from the code below. So don't copy and paste, download the ZIP. {EDIT 2/27/07b} There are edits in the text above due to the post having been moved from its original location. {EDIT 2/27/07a} @SmOke_N pointed out below, that as long as FileInstalls are in the script folder, full paths are not necessary. I updated the code below and the .ZIP. #compiler_aut2exe=C:Program FilesAutoIt3betaAut2ExeAut2Exe.exe #compiler_icon= #compiler_outfile=K:My Documents_Dev_ProjectsInternetConnectionMonitorInternetConnectionMonitorInternetConnectionMonitor(shared 1.104).au3.exe #compiler_Compression=4 #compiler_PassPhrase= #compiler_Allow_Decompile=4 ;[Res] #compiler_res_comment=Tracks Internet uptime based on the external IP Address. #compiler_res_description=Tracks Internet uptime based on the external IP Address. #compiler_res_fileversion=0.0.1.104 #compiler_res_fileversion_autoincrement=n #compiler_res_legalcopyright=Eugene T. Sears 2007 gtsears@yahoo.com #compiler_res_field1name=Version #compiler_res_field1value=0.0.1.104 ;[Other] #compiler_Run_AU3Check=1 #compiler_Run_Before= #compiler_Run_After= #include <Date.au3> #include <Inet.au3> #include <File.au3> #include <String.au3> Global $PublicIP, $sIpConn, $iInterval, $sLastIP, $sLastIpAddr, $dLastChgDate, $dLastCycleDate, $iChgCntFromStart Global $iCycleCount, $iChgCount, $iShortInterval, $iLongInterval, $dLogStarted, $sTrakHtm, $dNow, $iCycleCntFromStart Global $dDateTimeNow, $iDateDiff, $iMaxRows, $iEmail, $iRetry, $iHours, $iMins, $iSecs, $dLastYrMoDa, $iMonDownChgs Global $iMonDownSecs, $iTodayDownChgs, $iTodayDownSecs, $iWeekDownChgs, $iWeekDownSecs, $iMonChgs, $iTodayChgs, $iWeekChgs Global $iMediumInterval, $iPush, $iDownSec, $sVarContent, $iScriptLine, $iResponse, $iError, $dYrMoDa, $dStartTime Global $iCycleTimeCnt, $dif, $iCycleTime, $sLogMsg, $begin, $iPrintProcessLog, $iChgTime, $iIPchgCycleTimeCnt, $iChgCycleFlg Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $iInterval = 0 If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 $dStartTime = _NowCalc() If FileExists(@WorkingDir & "InConMon.INI") Then _ReadINI() Else _Chek4HTMfile() _CreateINI() EndIf If Not FileExists(@WorkingDir & "Trak.HTM") Then _Chek4HTMfile() EndIf While 1 $dDateTimeNow = _NowCalc() $dYrMoDa = @YEAR & "-" & @MON & "-" & @MDAY _NextCycle() WEnd Exit Func OnAutoItExit() $sLogMsg = " Cumulative Cycle Time (" & Round($iCycleTime, 4) & ") Divided by " & $iCycleTimeCnt & " Cycles = " & Round(($iCycleTime / $iCycleTimeCnt), 4) & " Seconds per Cycle. " _FileWriteLog(@WorkingDir & "TimingLog.log", $sLogMsg & " Data flushed on shutdownn. ") _FileWriteLog(@WorkingDir & "ChgCycleTime.log", $iChgTime & @TAB & $iIPchgCycleTimeCnt & @TAB & " Data flushed on shutdownn. ") EndFunc ;==>OnAutoItExit Func _VarContent($iScriptLine, $sMessage) ;If $iPrintProcessLog = 1 Then If $iPrintProcessLog = 3 Then $sVarContent = $iScriptLine & "|" & $sMessage & "|" & $PublicIP & "|" & $sLastIpAddr & "|" & $dLastChgDate & "|" & $dDateTimeNow & "|" & $iDownSec & "|" & $dLastYrMoDa & "|" & $dYrMoDa & "|" & $iChgCount & "|" & $iDateDiff & "|" & $iDownSec & "|" & $iMonChgs & "|" & $iMonDownChgs & "|" & $iMonDownSecs & "|" & $iTodayChgs & "|" & $iTodayDownChgs & "|" & $iTodayDownSecs & "|" & $iWeekChgs & "|" & $iWeekDownChgs & "|" & $iWeekDownSecs & @CRLF _FileWriteLog(@WorkingDir & "ProcessPath.log", $sVarContent) EndIf If $iPrintProcessLog = 0 Then _FileWriteLog(@WorkingDir & "ProcessPath.log", @CRLF & @CRLF & @CRLF) $iPrintProcessLog = 2 EndIf EndFunc ;==>_VarContent Func _AddressChanged() If $sLastIpAddr = "Startup" Then $iDateDiff = 0 $sTrakHtm = $sTrakHtm & "<tr>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $dDateTimeNow & "</td>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $sLastIpAddr & "</td>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $iDateDiff & "</td>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $PublicIP & "</td>" & @CR $sTrakHtm = $sTrakHtm & "</tr>" & @CR _WriteToLog() If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 $sTrakHtm = "" $iChgCount = 0 IniWrite(@WorkingDir & "InConMon.INI", "Last", "ChgCount", $iChgCount) $iMonDownChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownChgs", $iMonDownChgs) $iMonDownSecs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownSecs", $iMonDownSecs) $iTodayDownChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownChgs", $iTodayDownChgs) $iTodayDownSecs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownSecs", $iTodayDownSecs) $iWeekDownChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownChgs", $iWeekDownChgs) $iWeekDownSecs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownSecs", $iWeekDownSecs) $iMonChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonChgs", $iMonChgs) $iTodayChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayChgs", $iTodayChgs) $iWeekChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekChgs", $iWeekChgs) Else $iPrintProcessLog = 1 If $sLastIpAddr <> "Startup" And $sLastIpAddr <> "None" Then $iChgCycleFlg = 1 EndIf Select ;Case _DateDiff("M", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) > 1 ; $iDateDiff = _DateDiff("M", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) & " Months " Case _DateDiff("w", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) > 1 $iDateDiff = _DateDiff("w", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) & " Weeks " Case _DateDiff("D", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) > 1 $iDateDiff = _DateDiff("D", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) & " Days " Case _DateDiff("h", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) > 1 $iDateDiff = _DateDiff("h", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) & " Hours " Case _DateDiff("n", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) > 1 $iDateDiff = _DateDiff("n", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) & " Minutes " Case _DateDiff("S", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) > 0 $iDateDiff = _DateDiff("S", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) & " Seconds " EndSelect $dLastChgDate = IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", "") $iDownSec = _DateDiff("S", $dLastChgDate, $dDateTimeNow) If $iChgCount > $iMaxRows Then $iEmail = 1 $iChgCount = 0 $sTrakHtm = $sTrakHtm & "<tr>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center"><b><font size="4">Date & Time</font></b></td>' & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center"><b><font size="4">Last Ip Address</font></b></td>' & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center"><b><font size="4">Duration</font></b></td>' & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center"><b><font size="4">New Ip Address</font></b></td>' & @CR $sTrakHtm = $sTrakHtm & "</tr>" & @CR EndIf ; $iChgCount = $iMaxRows $sTrakHtm = $sTrakHtm & "<tr>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $dDateTimeNow & "</td>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $sLastIpAddr & "</td>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $iDateDiff & "</td>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $PublicIP & "</td>" & @CR $sTrakHtm = $sTrakHtm & "</tr>" & @CR _WriteToLog() If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 $sTrakHtm = "" If $sLastIpAddr = "None" Then $iMonDownChgs = $iMonDownChgs + 1 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownChgs", $iMonDownChgs) $iMonDownSecs = $iMonDownSecs + $iDownSec IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownSecs", $iMonDownSecs) $iTodayDownChgs = $iTodayDownChgs + 1 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownChgs", $iTodayDownChgs) $iTodayDownSecs = $iTodayDownSecs + $iDownSec IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownSecs", $iTodayDownSecs) $iWeekDownChgs = $iWeekDownChgs + 1 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownChgs", $iWeekDownChgs) $iWeekDownSecs = $iWeekDownSecs + $iDownSec IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownSecs", $iWeekDownSecs) EndIf ; $sLastIpAddr = "None" $iMonChgs = $iMonChgs + 1 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonChgs", $iMonChgs) $iTodayChgs = $iTodayChgs + 1 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayChgs", $iTodayChgs) $iWeekChgs = $iWeekChgs + 1 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekChgs", $iWeekChgs) $iCycleCount = 0 IniWrite(@WorkingDir & "InConMon.INI", "Last", "CycleCount", $iCycleCount) IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", $dDateTimeNow) $iChgCount = $iChgCount + 1 IniWrite(@WorkingDir & "InConMon.INI", "Last", "ChgCount", $iChgCount) $iChgCntFromStart = $iChgCntFromStart + 1 IniWrite(@WorkingDir & "InConMon.INI", "Cumulative", "ChgCntFromStart", $iChgCntFromStart) If $sLastIpAddr <> $PublicIP Then IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastIpAddr", $PublicIP) $sLastIpAddr = $PublicIP EndIf EndIf If $sLastIpAddr = "Startup" Then If $sLastIpAddr = "Startup" Then $sLastIpAddr = $PublicIP IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastIpAddr", $PublicIP) $iError = @error If $iError > 0 Then Select Case $iError = 1 MsgBox(0, "Error Message", " Invalid $sType ") Case $iError = 2 MsgBox(0, "Error Message", " Invalid $sStartDate ") Case $iError = 3 MsgBox(0, "Error Message", " Invalid $sEndDate ") EndSelect EndIf EndIf EndFunc ;==>_AddressChanged Func _Chek4HTMfile() If Not FileExists(@WorkingDir & "Trak.HTM") Then FileInstall("Trak2.HTM", @WorkingDir & "Trak.HTM", 0) _ReplaceStringInFile(@WorkingDir & "Trak.HTM", "StartDateTime", $dStartTime, 0, 0) EndIf If Not FileExists(@WorkingDir & "InConMon.INI") Then FileInstall("InConMon2.INI", @WorkingDir & "InConMon.INI", 1) EndIf $dLastCycleDate = $dStartTime EndFunc ;==>_Chek4HTMfile Func _CompareIpAddr() $PublicIP = _GetIP() If $PublicIP = -1 Then $PublicIP = "None" $iPrintProcessLog = 1 EndIf $sLastIpAddr = IniRead(@WorkingDir & "InConMon.INI", "Last", "LastIpAddr", "None") If $PublicIP = $sLastIpAddr Then $sIpConn = "OK" If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 Else $sIpConn = "" $iPrintProcessLog = 1 _AddressChanged() EndIf EndFunc ;==>_CompareIpAddr Func _CreateINI() IniWrite(@WorkingDir & "InConMon.INI", "Start", "LogStarted", $dLogStarted) IniWrite(@WorkingDir & "InConMon.INI", "Start", "MaxRows", "20") $dLogStarted = IniRead(@WorkingDir & "InConMon.INI", "Last", "LogStarted", "") If $dLogStarted = "" Then $dLogStarted = _NowCalc() IniWrite(@WorkingDir & "InConMon.INI", "Start", "LogStarted", $dLogStarted) EndIf $dYrMoDa = @YEAR & "-" & @MON & "-" & @MDAY IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastYrMoDa", $dYrMoDa) IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastCycleDate", $dLastCycleDate) $PublicIP = _GetIP() IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastIpAddr", "Startup") IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", $dLogStarted) IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastCycleDate", $dLastCycleDate) IniWrite(@WorkingDir & "InConMon.INI", "Last", "CycleCount", "1") IniWrite(@WorkingDir & "InConMon.INI", "Last", "ChgCount", "1") IniWrite(@WorkingDir & "InConMon.INI", "Interval", "ShortInterval", "2") IniWrite(@WorkingDir & "InConMon.INI", "Interval", "MediumInterval", "6") IniWrite(@WorkingDir & "InConMon.INI", "Interval", "LongInterval", "15") IniWrite(@WorkingDir & "InConMon.INI", "Cumulative", "ChgCntFromStart", "0") IniWrite(@WorkingDir & "InConMon.INI", "Cumulative", "CycleCntFromStart", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "MonChgs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownChgs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownSecs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayChgs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownChgs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownSecs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekChgs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownChgs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownSecs", "0") EndFunc ;==>_CreateINI Func _DaySubTotal() $iPrintProcessLog = 1 $iTodayChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "TodayChgs", "") If $iTodayChgs = 0 Then If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 Return EndIf $sTrakHtm = "<tr>" & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#00FFCC"><font size="4"><b>Daily' & @CR $sTrakHtm = $sTrakHtm & 'Subtotal<br>' & @CR $sTrakHtm = $sTrakHtm & '<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & $dLastYrMoDa & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#00FFCC"><font size="4"><b>Changes Today<br>' & @CR $sTrakHtm = $sTrakHtm & "Ttl. = " & $iTodayChgs & '<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & " Down = " & $iTodayDownChgs & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#00FFCC"><font size="4"><b>Down Time<br>' & @CR $sTrakHtm = $sTrakHtm & '(seconds)<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & _StringAddComma($iTodayDownSecs) & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#00FFCC"><font size="4"><b>Average Down Time<br>' & @CR $sTrakHtm = $sTrakHtm & '(down secs/down chgs)<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & _StringAddComma(Round(($iTodayDownSecs / $iTodayDownChgs), 1)) & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '</tr>' & @CR _WriteToLog() $sTrakHtm = "" $iTodayDownChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownChgs", $iTodayDownChgs) $iTodayDownSecs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownSecs", $iTodayDownSecs) $iTodayChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayChgs", $iTodayChgs) If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 EndFunc ;==>_DaySubTotal Func _WeekSubTotal() $iPrintProcessLog = 1 $iWeekChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "WeekChgs", "") If $iWeekChgs = 0 Then If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 Return EndIf $sTrakHtm = "<tr>" & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#FFCCFF"><font size="4"><b>Weekly' & @CR $sTrakHtm = $sTrakHtm & 'Subtotal<br>' & @CR $sTrakHtm = $sTrakHtm & '<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & $dLastYrMoDa & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#FFCCFF"><font size="4"><b>Changes Week<br>' & @CR $sTrakHtm = $sTrakHtm & " Ttl. = " & $iWeekChgs & '<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & " Down = " & $iWeekDownChgs & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#FFCCFF"><font size="4"><b>Down Time<br>' & @CR $sTrakHtm = $sTrakHtm & '(seconds)<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & _StringAddComma($iWeekDownSecs) & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#FFCCFF"><font size="4"><b>Average Down Time<br>' & @CR $sTrakHtm = $sTrakHtm & '(down secs/down chgs)<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & _StringAddComma(Round(($iWeekDownSecs / $iWeekDownChgs), 1)) & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '</tr>' & @CR _WriteToLog() $sTrakHtm = "" $iWeekDownChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownChgs", $iWeekDownChgs) $iWeekDownSecs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownSecs", $iWeekDownSecs) $iWeekChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekChgs", $iWeekChgs) If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 EndFunc ;==>_WeekSubTotal Func _MonSubTotal() $iPrintProcessLog = 1 $iMonChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "MonChgs", "") If $iMonChgs = 0 Then If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 Return EndIf $sTrakHtm = "<tr>" & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#CCFF33"><font size="4"><b>Monthly' & @CR $sTrakHtm = $sTrakHtm & 'Subtotal<br>' & @CR $sTrakHtm = $sTrakHtm & '<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & $dLastYrMoDa & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#CCFF33"><font size="4"><b>Changes Mon<br>' & @CR $sTrakHtm = $sTrakHtm & " Ttl. = " & $iMonChgs & '<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & " Down = " & $iMonDownChgs & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#CCFF33"><font size="4"><b>Down Time<br>' & @CR $sTrakHtm = $sTrakHtm & '(seconds)<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & _StringAddComma($iMonDownSecs) & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#CCFF33"><font size="4"><b>Average Down Time<br>' & @CR $sTrakHtm = $sTrakHtm & '(down secs/down chgs)<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & _StringAddComma(Round(($iMonDownSecs / $iMonDownChgs), 1)) & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '</tr>' & @CR _WriteToLog() $sTrakHtm = "" $iMonDownChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownChgs", $iMonDownChgs) $iMonDownSecs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownSecs", $iMonDownSecs) $iMonChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonChgs", $iMonChgs) If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 EndFunc ;==>_MonSubTotal 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) ; JdeB's code $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 Func _WriteCyclTime() $sLogMsg = " Cumulative Cycle Time (" & Round($iCycleTime, 4) & ") Divided by " & $iCycleTimeCnt & " Cycles = " & Round(($iCycleTime / $iCycleTimeCnt), 4) & " Seconds per Cycle. " _FileWriteLog(@WorkingDir & "TimingLog.log", $sLogMsg) $iCycleTime = 0 $iCycleTimeCnt = 0 $dif = 0 EndFunc ;==>_WriteCyclTime Func _NextCycle() $iCycleCount = $iCycleCount + 1 IniWrite(@WorkingDir & "InConMon.INI", "Last", "CycleCount", $iCycleCount) $iCycleCntFromStart = $iCycleCntFromStart + 1 IniWrite(@WorkingDir & "InConMon.INI", "Cumulative", "CycleCntFromStart", $iCycleCntFromStart) _CompareIpAddr() If $dLastYrMoDa <> $dYrMoDa And $sLastIpAddr <> "Startup" Then ; Process subtotals... If $iTodayChgs > 0 Then ; Daily subtotal... $iPrintProcessLog = 1 _DaySubTotal() If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 EndIf If @WDAY = "1" And $iWeekChgs > 0 Then ; Wekly subtotal... $iPrintProcessLog = 1 _WeekSubTotal() If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 EndIf If @MDAY = "01" And $iMonChgs > 0 Then ; Monthly subtotal... $iPrintProcessLog = 1 _MonSubTotal() If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 EndIf IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastYrMoDa", $dYrMoDa) $dLastYrMoDa = $dYrMoDa EndIf ; Begin end of cycle time processing. If $iCycleTimeCnt <> 0 Then $dif = TimerDiff($begin) / 1000 If $iCycleTimeCnt <> 0 Then $iCycleTime = $iCycleTime + $dif $iCycleTimeCnt = $iCycleTimeCnt + 1 If $iChgCycleFlg = 1 Then $iIPchgCycleTimeCnt = $iIPchgCycleTimeCnt + 1 $iChgCycleFlg = 0 $iChgTime = $iChgTime + $dif If $iChgTime > 20 Then _FileWriteLog(@WorkingDir & "ChgCycleTime.log", $iChgTime & @TAB & $iIPchgCycleTimeCnt) $iChgTime = 0 $iIPchgCycleTimeCnt = 0 EndIf EndIf $iInterval = 500 If $iCycleTimeCnt > $iInterval And $iCycleTime > 0 Then _WriteCyclTime() EndIf ; End of cycle time processing. ;MsgBox(0," Begin Sleep Code", " Line " & @ScriptLineNumber & " Begin Sleep Code, CycleCount = " & $iCycleCount) Select Case $iCycleCount < 200 ;2 sec Sleep($iShortInterval * 1000) Case $iCycleCount < 400 ;6 sec Sleep($iMediumInterval * 1000) Case Else ;15 sec Sleep($iLongInterval * 1000) EndSelect ;MsgBox(0," End of Sleep Code", " Line " & @ScriptLineNumber & " End of Sleep Code", 1 ) ; Begin cycle time recording. $begin = TimerInit() If $iCycleCount = 200 Or $iEmail = 1 Then $iEmail = 0 _PrepEmail() EndIf If $iRetry = 1 And $iCycleCount = 300 Then $iRetry = 0 _PrepEmail() If $iRetry = 0 Then While FileExists(@TempDir & "icm.err.log") FileDelete(@TempDir & "icm.err.log") WEnd EndIf EndIf IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastCycleDate", $dDateTimeNow) EndFunc ;==>_NextCycle Func _PrepEmail() $as_Body = FileRead(@WorkingDir & "Trak.HTM", FileGetSize(@WorkingDir & "Trak.HTM")) Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ;################################## ; Include JdeB's code ;################################## #Include<file.au3> ;################################## ; Variables ;################################## $s_SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED $s_FromName = " your name here " ; name from who the email was sent $s_FromAddress = "youracctname@gmail.com" ; address from where the mail should come $s_ToAddress = "youracctname@gmail.com" ; destination address of the email - REQUIRED $s_Subject = "IP Address change" ; subject from the email - can be anything you want it to be ;$as_Body = "The IP Address changed from " & $sLastIP & " to " & $PublicIP & " at 12:35." ; the messagebody from the mail - can be left blank but then you get a blank mail $s_AttachFiles = @TempDir & "icm.err.log" ; the file you want to attach- leave blank if not needed $s_CcAddress = "" ; address for cc - leave blank if not needed $s_BccAddress = "" ; address for bcc - leave blank if not needed $s_Username = "youracctname@gmail.com" ; username for the account used from where the mail gets sent - REQUIRED $s_Password = "password" ; 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 ;################################## ; Script ;################################## $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl) If @error Then FileWrite(@TempDir & "icm.err.log", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Error sending message, Error code:" & @error & " Description:" & $rc & @CRLF) ;MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc) $iRetry = 1 Else While FileExists(@TempDir & "icm.err.log") FileDelete(@TempDir & "icm.err.log") WEnd $iRetry = 0 EndIf EndFunc ;==>_PrepEmail Func _ReadINI() $iMaxRows = IniRead(@WorkingDir & "InConMon.INI", "Start", "MaxRows", "15") $dLastYrMoDa = IniRead(@WorkingDir & "InConMon.INI", "Last", "LastYrMoDa", "0") $sLastIpAddr = IniRead(@WorkingDir & "InConMon.INI", "Last", "LastIpAddr", "") $dLastChgDate = IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", "") $dLastCycleDate = IniRead(@WorkingDir & "InConMon.INI", "Last", "LastCycleDate", "") $iCycleCount = IniRead(@WorkingDir & "InConMon.INI", "Last", "CycleCount", "") $iChgCount = IniRead(@WorkingDir & "InConMon.INI", "Last", "ChgCount", "") $iShortInterval = IniRead(@WorkingDir & "InConMon.INI", "Interval", "ShortInterval", "") $iMediumInterval = IniRead(@WorkingDir & "InConMon.INI", "Interval", "MediumInterval", "") $iLongInterval = IniRead(@WorkingDir & "InConMon.INI", "Interval", "LongInterval", "") $dLogStarted = IniRead(@WorkingDir & "InConMon.INI", "Start", "LogStarted", "") $iChgCntFromStart = IniRead(@WorkingDir & "InConMon.INI", "Cumulative", "ChgCntFromStart", "") $iCycleCntFromStart = IniRead(@WorkingDir & "InConMon.INI", "Cumulative", "CycleCntFromStart", "") $iMonChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "MonChgs", 0) $iMonDownChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "MonDownChgs", 0) $iMonDownSecs = IniRead(@WorkingDir & "InConMon.INI", "History", "MonDownSecs", 0) $iTodayChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "TodayChgs", 0) $iTodayDownChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "TodayDownChgs", 0) $iTodayDownSecs = IniRead(@WorkingDir & "InConMon.INI", "History", "TodayDownSecs", 0) $iWeekChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "WeekChgs", 0) $iWeekDownChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "WeekDownChgs", 0) $iWeekDownSecs = IniRead(@WorkingDir & "InConMon.INI", "History", "WeekDownSecs", 0) EndFunc ;==>_ReadINI Func _WriteToLog() $iResponse = _FileWriteToLine(@WorkingDir & "Trak.HTM", 59, $sTrakHtm, 0) $iError = @error $sTrakHtm = "" Select Case $iError = 0 Case $iError = 1 FileWrite(@TempDir & "icm.err.log", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Log File Write Error Msg - File has too few lines. " & @CRLF) Case $iError = 2 FileWrite(@TempDir & "icm.err.log", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Log File Write Error Msg - Log file does not exist in working folder. " & @CRLF) Case $iError = 3 FileWrite(@TempDir & "icm.err.log", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Log File Write Error Msg - Error when opening the log file. " & @CRLF) Case $iError = 4 FileWrite(@TempDir & "icm.err.log", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Log File Write Error Msg - The location in the file where text to be added to the log is invalid. " & @CRLF) Case $iError = 5 FileWrite(@TempDir & "icm.err.log", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Log File Write Error Msg - The OverWrite flag is invalid. " & @CRLF) Case $iError = 6 FileWrite(@TempDir & "icm.err.log", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Log File Write Error Msg - The text to be added to the log is invalid. " & @CRLF) EndSelect EndFunc ;==>_WriteToLog ; 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 _linenums:0'>#compiler_aut2exe=C:Program FilesAutoIt3betaAut2ExeAut2Exe.exe #compiler_icon= #compiler_outfile=K:My Documents_Dev_ProjectsInternetConnectionMonitorInternetConnectionMonitorInternetConnectionMonitor(shared 1.104).au3.exe #compiler_Compression=4 #compiler_PassPhrase= #compiler_Allow_Decompile=4 ;[Res] #compiler_res_comment=Tracks Internet uptime based on the external IP Address. #compiler_res_description=Tracks Internet uptime based on the external IP Address. #compiler_res_fileversion=0.0.1.104 #compiler_res_fileversion_autoincrement=n #compiler_res_legalcopyright=Eugene T. Sears 2007 gtsears@yahoo.com #compiler_res_field1name=Version #compiler_res_field1value=0.0.1.104 ;[Other] #compiler_Run_AU3Check=1 #compiler_Run_Before= #compiler_Run_After= #include <Date.au3> #include <Inet.au3> #include <File.au3> #include <String.au3> Global $PublicIP, $sIpConn, $iInterval, $sLastIP, $sLastIpAddr, $dLastChgDate, $dLastCycleDate, $iChgCntFromStart Global $iCycleCount, $iChgCount, $iShortInterval, $iLongInterval, $dLogStarted, $sTrakHtm, $dNow, $iCycleCntFromStart Global $dDateTimeNow, $iDateDiff, $iMaxRows, $iEmail, $iRetry, $iHours, $iMins, $iSecs, $dLastYrMoDa, $iMonDownChgs Global $iMonDownSecs, $iTodayDownChgs, $iTodayDownSecs, $iWeekDownChgs, $iWeekDownSecs, $iMonChgs, $iTodayChgs, $iWeekChgs Global $iMediumInterval, $iPush, $iDownSec, $sVarContent, $iScriptLine, $iResponse, $iError, $dYrMoDa, $dStartTime Global $iCycleTimeCnt, $dif, $iCycleTime, $sLogMsg, $begin, $iPrintProcessLog, $iChgTime, $iIPchgCycleTimeCnt, $iChgCycleFlg Global $oMyRet[2] Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $iInterval = 0 If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 $dStartTime = _NowCalc() If FileExists(@WorkingDir & "InConMon.INI") Then _ReadINI() Else _Chek4HTMfile() _CreateINI() EndIf If Not FileExists(@WorkingDir & "Trak.HTM") Then _Chek4HTMfile() EndIf While 1 $dDateTimeNow = _NowCalc() $dYrMoDa = @YEAR & "-" & @MON & "-" & @MDAY _NextCycle() WEnd Exit Func OnAutoItExit() $sLogMsg = " Cumulative Cycle Time (" & Round($iCycleTime, 4) & ") Divided by " & $iCycleTimeCnt & " Cycles = " & Round(($iCycleTime / $iCycleTimeCnt), 4) & " Seconds per Cycle. " _FileWriteLog(@WorkingDir & "TimingLog.log", $sLogMsg & " Data flushed on shutdownn. ") _FileWriteLog(@WorkingDir & "ChgCycleTime.log", $iChgTime & @TAB & $iIPchgCycleTimeCnt & @TAB & " Data flushed on shutdownn. ") EndFunc ;==>OnAutoItExit Func _VarContent($iScriptLine, $sMessage) ;If $iPrintProcessLog = 1 Then If $iPrintProcessLog = 3 Then $sVarContent = $iScriptLine & "|" & $sMessage & "|" & $PublicIP & "|" & $sLastIpAddr & "|" & $dLastChgDate & "|" & $dDateTimeNow & "|" & $iDownSec & "|" & $dLastYrMoDa & "|" & $dYrMoDa & "|" & $iChgCount & "|" & $iDateDiff & "|" & $iDownSec & "|" & $iMonChgs & "|" & $iMonDownChgs & "|" & $iMonDownSecs & "|" & $iTodayChgs & "|" & $iTodayDownChgs & "|" & $iTodayDownSecs & "|" & $iWeekChgs & "|" & $iWeekDownChgs & "|" & $iWeekDownSecs & @CRLF _FileWriteLog(@WorkingDir & "ProcessPath.log", $sVarContent) EndIf If $iPrintProcessLog = 0 Then _FileWriteLog(@WorkingDir & "ProcessPath.log", @CRLF & @CRLF & @CRLF) $iPrintProcessLog = 2 EndIf EndFunc ;==>_VarContent Func _AddressChanged() If $sLastIpAddr = "Startup" Then $iDateDiff = 0 $sTrakHtm = $sTrakHtm & "<tr>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $dDateTimeNow & "</td>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $sLastIpAddr & "</td>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $iDateDiff & "</td>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $PublicIP & "</td>" & @CR $sTrakHtm = $sTrakHtm & "</tr>" & @CR _WriteToLog() If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 $sTrakHtm = "" $iChgCount = 0 IniWrite(@WorkingDir & "InConMon.INI", "Last", "ChgCount", $iChgCount) $iMonDownChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownChgs", $iMonDownChgs) $iMonDownSecs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownSecs", $iMonDownSecs) $iTodayDownChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownChgs", $iTodayDownChgs) $iTodayDownSecs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownSecs", $iTodayDownSecs) $iWeekDownChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownChgs", $iWeekDownChgs) $iWeekDownSecs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownSecs", $iWeekDownSecs) $iMonChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonChgs", $iMonChgs) $iTodayChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayChgs", $iTodayChgs) $iWeekChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekChgs", $iWeekChgs) Else $iPrintProcessLog = 1 If $sLastIpAddr <> "Startup" And $sLastIpAddr <> "None" Then $iChgCycleFlg = 1 EndIf Select ;Case _DateDiff("M", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) > 1 ; $iDateDiff = _DateDiff("M", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) & " Months " Case _DateDiff("w", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) > 1 $iDateDiff = _DateDiff("w", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) & " Weeks " Case _DateDiff("D", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) > 1 $iDateDiff = _DateDiff("D", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) & " Days " Case _DateDiff("h", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) > 1 $iDateDiff = _DateDiff("h", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) & " Hours " Case _DateDiff("n", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) > 1 $iDateDiff = _DateDiff("n", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) & " Minutes " Case _DateDiff("S", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) > 0 $iDateDiff = _DateDiff("S", IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", ""), $dDateTimeNow) & " Seconds " EndSelect $dLastChgDate = IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", "") $iDownSec = _DateDiff("S", $dLastChgDate, $dDateTimeNow) If $iChgCount > $iMaxRows Then $iEmail = 1 $iChgCount = 0 $sTrakHtm = $sTrakHtm & "<tr>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center"><b><font size="4">Date & Time</font></b></td>' & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center"><b><font size="4">Last Ip Address</font></b></td>' & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center"><b><font size="4">Duration</font></b></td>' & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center"><b><font size="4">New Ip Address</font></b></td>' & @CR $sTrakHtm = $sTrakHtm & "</tr>" & @CR EndIf ; $iChgCount = $iMaxRows $sTrakHtm = $sTrakHtm & "<tr>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $dDateTimeNow & "</td>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $sLastIpAddr & "</td>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $iDateDiff & "</td>" & @CR $sTrakHtm = $sTrakHtm & ' <td width="20%" align="center" bgcolor="#CCFFFF">' & $PublicIP & "</td>" & @CR $sTrakHtm = $sTrakHtm & "</tr>" & @CR _WriteToLog() If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 $sTrakHtm = "" If $sLastIpAddr = "None" Then $iMonDownChgs = $iMonDownChgs + 1 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownChgs", $iMonDownChgs) $iMonDownSecs = $iMonDownSecs + $iDownSec IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownSecs", $iMonDownSecs) $iTodayDownChgs = $iTodayDownChgs + 1 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownChgs", $iTodayDownChgs) $iTodayDownSecs = $iTodayDownSecs + $iDownSec IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownSecs", $iTodayDownSecs) $iWeekDownChgs = $iWeekDownChgs + 1 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownChgs", $iWeekDownChgs) $iWeekDownSecs = $iWeekDownSecs + $iDownSec IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownSecs", $iWeekDownSecs) EndIf ; $sLastIpAddr = "None" $iMonChgs = $iMonChgs + 1 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonChgs", $iMonChgs) $iTodayChgs = $iTodayChgs + 1 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayChgs", $iTodayChgs) $iWeekChgs = $iWeekChgs + 1 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekChgs", $iWeekChgs) $iCycleCount = 0 IniWrite(@WorkingDir & "InConMon.INI", "Last", "CycleCount", $iCycleCount) IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", $dDateTimeNow) $iChgCount = $iChgCount + 1 IniWrite(@WorkingDir & "InConMon.INI", "Last", "ChgCount", $iChgCount) $iChgCntFromStart = $iChgCntFromStart + 1 IniWrite(@WorkingDir & "InConMon.INI", "Cumulative", "ChgCntFromStart", $iChgCntFromStart) If $sLastIpAddr <> $PublicIP Then IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastIpAddr", $PublicIP) $sLastIpAddr = $PublicIP EndIf EndIf If $sLastIpAddr = "Startup" Then If $sLastIpAddr = "Startup" Then $sLastIpAddr = $PublicIP IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastIpAddr", $PublicIP) $iError = @error If $iError > 0 Then Select Case $iError = 1 MsgBox(0, "Error Message", " Invalid $sType ") Case $iError = 2 MsgBox(0, "Error Message", " Invalid $sStartDate ") Case $iError = 3 MsgBox(0, "Error Message", " Invalid $sEndDate ") EndSelect EndIf EndIf EndFunc ;==>_AddressChanged Func _Chek4HTMfile() If Not FileExists(@WorkingDir & "Trak.HTM") Then FileInstall("Trak2.HTM", @WorkingDir & "Trak.HTM", 0) _ReplaceStringInFile(@WorkingDir & "Trak.HTM", "StartDateTime", $dStartTime, 0, 0) EndIf If Not FileExists(@WorkingDir & "InConMon.INI") Then FileInstall("InConMon2.INI", @WorkingDir & "InConMon.INI", 1) EndIf $dLastCycleDate = $dStartTime EndFunc ;==>_Chek4HTMfile Func _CompareIpAddr() $PublicIP = _GetIP() If $PublicIP = -1 Then $PublicIP = "None" $iPrintProcessLog = 1 EndIf $sLastIpAddr = IniRead(@WorkingDir & "InConMon.INI", "Last", "LastIpAddr", "None") If $PublicIP = $sLastIpAddr Then $sIpConn = "OK" If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 Else $sIpConn = "" $iPrintProcessLog = 1 _AddressChanged() EndIf EndFunc ;==>_CompareIpAddr Func _CreateINI() IniWrite(@WorkingDir & "InConMon.INI", "Start", "LogStarted", $dLogStarted) IniWrite(@WorkingDir & "InConMon.INI", "Start", "MaxRows", "20") $dLogStarted = IniRead(@WorkingDir & "InConMon.INI", "Last", "LogStarted", "") If $dLogStarted = "" Then $dLogStarted = _NowCalc() IniWrite(@WorkingDir & "InConMon.INI", "Start", "LogStarted", $dLogStarted) EndIf $dYrMoDa = @YEAR & "-" & @MON & "-" & @MDAY IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastYrMoDa", $dYrMoDa) IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastCycleDate", $dLastCycleDate) $PublicIP = _GetIP() IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastIpAddr", "Startup") IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", $dLogStarted) IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastCycleDate", $dLastCycleDate) IniWrite(@WorkingDir & "InConMon.INI", "Last", "CycleCount", "1") IniWrite(@WorkingDir & "InConMon.INI", "Last", "ChgCount", "1") IniWrite(@WorkingDir & "InConMon.INI", "Interval", "ShortInterval", "2") IniWrite(@WorkingDir & "InConMon.INI", "Interval", "MediumInterval", "6") IniWrite(@WorkingDir & "InConMon.INI", "Interval", "LongInterval", "15") IniWrite(@WorkingDir & "InConMon.INI", "Cumulative", "ChgCntFromStart", "0") IniWrite(@WorkingDir & "InConMon.INI", "Cumulative", "CycleCntFromStart", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "MonChgs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownChgs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownSecs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayChgs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownChgs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownSecs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekChgs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownChgs", "0") IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownSecs", "0") EndFunc ;==>_CreateINI Func _DaySubTotal() $iPrintProcessLog = 1 $iTodayChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "TodayChgs", "") If $iTodayChgs = 0 Then If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 Return EndIf $sTrakHtm = "<tr>" & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#00FFCC"><font size="4"><b>Daily' & @CR $sTrakHtm = $sTrakHtm & 'Subtotal<br>' & @CR $sTrakHtm = $sTrakHtm & '<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & $dLastYrMoDa & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#00FFCC"><font size="4"><b>Changes Today<br>' & @CR $sTrakHtm = $sTrakHtm & "Ttl. = " & $iTodayChgs & '<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & " Down = " & $iTodayDownChgs & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#00FFCC"><font size="4"><b>Down Time<br>' & @CR $sTrakHtm = $sTrakHtm & '(seconds)<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & _StringAddComma($iTodayDownSecs) & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#00FFCC"><font size="4"><b>Average Down Time<br>' & @CR $sTrakHtm = $sTrakHtm & '(down secs/down chgs)<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & _StringAddComma(Round(($iTodayDownSecs / $iTodayDownChgs), 1)) & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '</tr>' & @CR _WriteToLog() $sTrakHtm = "" $iTodayDownChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownChgs", $iTodayDownChgs) $iTodayDownSecs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayDownSecs", $iTodayDownSecs) $iTodayChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "TodayChgs", $iTodayChgs) If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 EndFunc ;==>_DaySubTotal Func _WeekSubTotal() $iPrintProcessLog = 1 $iWeekChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "WeekChgs", "") If $iWeekChgs = 0 Then If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 Return EndIf $sTrakHtm = "<tr>" & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#FFCCFF"><font size="4"><b>Weekly' & @CR $sTrakHtm = $sTrakHtm & 'Subtotal<br>' & @CR $sTrakHtm = $sTrakHtm & '<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & $dLastYrMoDa & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#FFCCFF"><font size="4"><b>Changes Week<br>' & @CR $sTrakHtm = $sTrakHtm & " Ttl. = " & $iWeekChgs & '<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & " Down = " & $iWeekDownChgs & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#FFCCFF"><font size="4"><b>Down Time<br>' & @CR $sTrakHtm = $sTrakHtm & '(seconds)<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & _StringAddComma($iWeekDownSecs) & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#FFCCFF"><font size="4"><b>Average Down Time<br>' & @CR $sTrakHtm = $sTrakHtm & '(down secs/down chgs)<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & _StringAddComma(Round(($iWeekDownSecs / $iWeekDownChgs), 1)) & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '</tr>' & @CR _WriteToLog() $sTrakHtm = "" $iWeekDownChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownChgs", $iWeekDownChgs) $iWeekDownSecs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekDownSecs", $iWeekDownSecs) $iWeekChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "WeekChgs", $iWeekChgs) If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 EndFunc ;==>_WeekSubTotal Func _MonSubTotal() $iPrintProcessLog = 1 $iMonChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "MonChgs", "") If $iMonChgs = 0 Then If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 Return EndIf $sTrakHtm = "<tr>" & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#CCFF33"><font size="4"><b>Monthly' & @CR $sTrakHtm = $sTrakHtm & 'Subtotal<br>' & @CR $sTrakHtm = $sTrakHtm & '<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & $dLastYrMoDa & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#CCFF33"><font size="4"><b>Changes Mon<br>' & @CR $sTrakHtm = $sTrakHtm & " Ttl. = " & $iMonChgs & '<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & " Down = " & $iMonDownChgs & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#CCFF33"><font size="4"><b>Down Time<br>' & @CR $sTrakHtm = $sTrakHtm & '(seconds)<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & _StringAddComma($iMonDownSecs) & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '<td width="20%" align="center" bgcolor="#CCFF33"><font size="4"><b>Average Down Time<br>' & @CR $sTrakHtm = $sTrakHtm & '(down secs/down chgs)<br>' & @CR $sTrakHtm = $sTrakHtm & '</b>' & @CR $sTrakHtm = $sTrakHtm & _StringAddComma(Round(($iMonDownSecs / $iMonDownChgs), 1)) & '</font></td>' & @CR $sTrakHtm = $sTrakHtm & '</tr>' & @CR _WriteToLog() $sTrakHtm = "" $iMonDownChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownChgs", $iMonDownChgs) $iMonDownSecs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonDownSecs", $iMonDownSecs) $iMonChgs = 0 IniWrite(@WorkingDir & "InConMon.INI", "History", "MonChgs", $iMonChgs) If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 EndFunc ;==>_MonSubTotal 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) ; JdeB's code $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 Func _WriteCyclTime() $sLogMsg = " Cumulative Cycle Time (" & Round($iCycleTime, 4) & ") Divided by " & $iCycleTimeCnt & " Cycles = " & Round(($iCycleTime / $iCycleTimeCnt), 4) & " Seconds per Cycle. " _FileWriteLog(@WorkingDir & "TimingLog.log", $sLogMsg) $iCycleTime = 0 $iCycleTimeCnt = 0 $dif = 0 EndFunc ;==>_WriteCyclTime Func _NextCycle() $iCycleCount = $iCycleCount + 1 IniWrite(@WorkingDir & "InConMon.INI", "Last", "CycleCount", $iCycleCount) $iCycleCntFromStart = $iCycleCntFromStart + 1 IniWrite(@WorkingDir & "InConMon.INI", "Cumulative", "CycleCntFromStart", $iCycleCntFromStart) _CompareIpAddr() If $dLastYrMoDa <> $dYrMoDa And $sLastIpAddr <> "Startup" Then ; Process subtotals... If $iTodayChgs > 0 Then ; Daily subtotal... $iPrintProcessLog = 1 _DaySubTotal() If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 EndIf If @WDAY = "1" And $iWeekChgs > 0 Then ; Wekly subtotal... $iPrintProcessLog = 1 _WeekSubTotal() If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 EndIf If @MDAY = "01" And $iMonChgs > 0 Then ; Monthly subtotal... $iPrintProcessLog = 1 _MonSubTotal() If $iPrintProcessLog = 1 Then $iPrintProcessLog = 0 EndIf IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastYrMoDa", $dYrMoDa) $dLastYrMoDa = $dYrMoDa EndIf ; Begin end of cycle time processing. If $iCycleTimeCnt <> 0 Then $dif = TimerDiff($begin) / 1000 If $iCycleTimeCnt <> 0 Then $iCycleTime = $iCycleTime + $dif $iCycleTimeCnt = $iCycleTimeCnt + 1 If $iChgCycleFlg = 1 Then $iIPchgCycleTimeCnt = $iIPchgCycleTimeCnt + 1 $iChgCycleFlg = 0 $iChgTime = $iChgTime + $dif If $iChgTime > 20 Then _FileWriteLog(@WorkingDir & "ChgCycleTime.log", $iChgTime & @TAB & $iIPchgCycleTimeCnt) $iChgTime = 0 $iIPchgCycleTimeCnt = 0 EndIf EndIf $iInterval = 500 If $iCycleTimeCnt > $iInterval And $iCycleTime > 0 Then _WriteCyclTime() EndIf ; End of cycle time processing. ;MsgBox(0," Begin Sleep Code", " Line " & @ScriptLineNumber & " Begin Sleep Code, CycleCount = " & $iCycleCount) Select Case $iCycleCount < 200 ;2 sec Sleep($iShortInterval * 1000) Case $iCycleCount < 400 ;6 sec Sleep($iMediumInterval * 1000) Case Else ;15 sec Sleep($iLongInterval * 1000) EndSelect ;MsgBox(0," End of Sleep Code", " Line " & @ScriptLineNumber & " End of Sleep Code", 1 ) ; Begin cycle time recording. $begin = TimerInit() If $iCycleCount = 200 Or $iEmail = 1 Then $iEmail = 0 _PrepEmail() EndIf If $iRetry = 1 And $iCycleCount = 300 Then $iRetry = 0 _PrepEmail() If $iRetry = 0 Then While FileExists(@TempDir & "icm.err.log") FileDelete(@TempDir & "icm.err.log") WEnd EndIf EndIf IniWrite(@WorkingDir & "InConMon.INI", "Last", "LastCycleDate", $dDateTimeNow) EndFunc ;==>_NextCycle Func _PrepEmail() $as_Body = FileRead(@WorkingDir & "Trak.HTM", FileGetSize(@WorkingDir & "Trak.HTM")) Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ;################################## ; Include JdeB's code ;################################## #Include<file.au3> ;################################## ; Variables ;################################## $s_SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED $s_FromName = " your name here " ; name from who the email was sent $s_FromAddress = "youracctname@gmail.com" ; address from where the mail should come $s_ToAddress = "youracctname@gmail.com" ; destination address of the email - REQUIRED $s_Subject = "IP Address change" ; subject from the email - can be anything you want it to be ;$as_Body = "The IP Address changed from " & $sLastIP & " to " & $PublicIP & " at 12:35." ; the messagebody from the mail - can be left blank but then you get a blank mail $s_AttachFiles = @TempDir & "icm.err.log" ; the file you want to attach- leave blank if not needed $s_CcAddress = "" ; address for cc - leave blank if not needed $s_BccAddress = "" ; address for bcc - leave blank if not needed $s_Username = "youracctname@gmail.com" ; username for the account used from where the mail gets sent - REQUIRED $s_Password = "password" ; 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 ;################################## ; Script ;################################## $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl) If @error Then FileWrite(@TempDir & "icm.err.log", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Error sending message, Error code:" & @error & " Description:" & $rc & @CRLF) ;MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc) $iRetry = 1 Else While FileExists(@TempDir & "icm.err.log") FileDelete(@TempDir & "icm.err.log") WEnd $iRetry = 0 EndIf EndFunc ;==>_PrepEmail Func _ReadINI() $iMaxRows = IniRead(@WorkingDir & "InConMon.INI", "Start", "MaxRows", "15") $dLastYrMoDa = IniRead(@WorkingDir & "InConMon.INI", "Last", "LastYrMoDa", "0") $sLastIpAddr = IniRead(@WorkingDir & "InConMon.INI", "Last", "LastIpAddr", "") $dLastChgDate = IniRead(@WorkingDir & "InConMon.INI", "Last", "LastChgDate", "") $dLastCycleDate = IniRead(@WorkingDir & "InConMon.INI", "Last", "LastCycleDate", "") $iCycleCount = IniRead(@WorkingDir & "InConMon.INI", "Last", "CycleCount", "") $iChgCount = IniRead(@WorkingDir & "InConMon.INI", "Last", "ChgCount", "") $iShortInterval = IniRead(@WorkingDir & "InConMon.INI", "Interval", "ShortInterval", "") $iMediumInterval = IniRead(@WorkingDir & "InConMon.INI", "Interval", "MediumInterval", "") $iLongInterval = IniRead(@WorkingDir & "InConMon.INI", "Interval", "LongInterval", "") $dLogStarted = IniRead(@WorkingDir & "InConMon.INI", "Start", "LogStarted", "") $iChgCntFromStart = IniRead(@WorkingDir & "InConMon.INI", "Cumulative", "ChgCntFromStart", "") $iCycleCntFromStart = IniRead(@WorkingDir & "InConMon.INI", "Cumulative", "CycleCntFromStart", "") $iMonChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "MonChgs", 0) $iMonDownChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "MonDownChgs", 0) $iMonDownSecs = IniRead(@WorkingDir & "InConMon.INI", "History", "MonDownSecs", 0) $iTodayChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "TodayChgs", 0) $iTodayDownChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "TodayDownChgs", 0) $iTodayDownSecs = IniRead(@WorkingDir & "InConMon.INI", "History", "TodayDownSecs", 0) $iWeekChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "WeekChgs", 0) $iWeekDownChgs = IniRead(@WorkingDir & "InConMon.INI", "History", "WeekDownChgs", 0) $iWeekDownSecs = IniRead(@WorkingDir & "InConMon.INI", "History", "WeekDownSecs", 0) EndFunc ;==>_ReadINI Func _WriteToLog() $iResponse = _FileWriteToLine(@WorkingDir & "Trak.HTM", 59, $sTrakHtm, 0) $iError = @error $sTrakHtm = "" Select Case $iError = 0 Case $iError = 1 FileWrite(@TempDir & "icm.err.log", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Log File Write Error Msg - File has too few lines. " & @CRLF) Case $iError = 2 FileWrite(@TempDir & "icm.err.log", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Log File Write Error Msg - Log file does not exist in working folder. " & @CRLF) Case $iError = 3 FileWrite(@TempDir & "icm.err.log", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Log File Write Error Msg - Error when opening the log file. " & @CRLF) Case $iError = 4 FileWrite(@TempDir & "icm.err.log", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Log File Write Error Msg - The location in the file where text to be added to the log is invalid. " & @CRLF) Case $iError = 5 FileWrite(@TempDir & "icm.err.log", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Log File Write Error Msg - The OverWrite flag is invalid. " & @CRLF) Case $iError = 6 FileWrite(@TempDir & "icm.err.log", @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Log File Write Error Msg - The text to be added to the log is invalid. " & @CRLF) EndSelect EndFunc ;==>_WriteToLog ; 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 Ver. 1.104 had 6 downloads.
-
Having looked at your files and GUI (which is nice) for the near term and in order to flatten the learning curve somewhat, you could use multiplr INI files to get around their size limitations. As I said before thats not the best method in the long term, but how many new things do you want to learn at the same time. In your current record's fieldset there is little need for relational capability. You could have just 26 INI files if you name them with single letters or a potential of 676 if you used 2 letters to name them. It would undoubtedly be less because the 2 letters would be the first 2 from the members last name. Even so, some of the INIs could be very crowded. The potential number of files using 3 letters doesn't bear thinking about. A flat file is probably easier to manage than multiple INI files. A flat file is one where the data is laidout in records instead of fields. Example of a flat file record: KeyField|Address|Suburb|State|Postcode|Phone|Fax|Mobile|Photo|Payments|MotherName|MotherMobile|Mothe rWork|FatherName|FatherMobile|FatherWork|MotherWorkPhone|MotherMobilePhone|FatherWorkPhone|FatherMob ilePhone|Notes The vertical characters between the fields are AutoIt's default data dividers. Unless a file is HUGE you can load it all at once, then manage it in RAM. There is some risk in that. You can also manage the file from disk, there are many built-in functions and furnished UDFs to help you manage your data in RAM or on disk. Flat files are very stable, the last time I checked you could have about 4000 characters on a row, it may be higher now. The then there is SQL in the long term for lots of data, it's the way to go. There is much to be said for investing time in all 3 methods starting with INI files. The only way to really know when and why to use or not use a method is when you have used them before. This could turn into a really cool project.
-
I do like analytical debate, and not one made up of sound bytes. What is wrong with that? Obviously it doesn't show, but I hate typing even though it is a requirement for communication. I looked at about 20 or so posts, but I was struck by the first response to you and your response to him. It was about your phone home technique for control. Your response indicated there were probably reasons other than just the one he suggested as well. I began to wonder what they might be. The only opinion of you that I posted was that I didn't think you would use your method of control to do nefarious things and I admitted that I couldn't know. Was what I said about Valik incorrect? As I recall, those posts of his discussed how or that capabilities requested could be used, not how he thought the people requesting them would use them. You can't seriously believe that a "phone home" feature could not be used for malicious purposes. Going back to the post that upset you, I quote... "There is (without making an accusation) however another question to ask. One has to wonder what other features there may be included that you might decide to turn on later? For that matter what additional code might be included in each obfuscated script that could also be turned on or off later." That is no accusation, it does point out the possibility of extra abilities. Since I have never used the EnCoder, I couldn't know what the output would look like, but if it is easily readable, what would the purpose be? "Now, from your general demeanor on the forum and reading your posts, I doubt you would do something like that, but who could know for a fact?" I can see how the last 7 words there could bother you, but it really just acknowledges that I know as little about you as you know about me. "The reason I don't use the Encoder is because I don't user any software that MUST phone home in order to operate. I appreciate your telling me about that up front." I gave you my reason for this and you blew it off. Again, "You can't seriously believe that a "phone home" feature could not be used for malicious purposes". "No matter how good and well intentioned you are, you are helping set the stage for a lot of future unpleasantness." That would only be ridiculous if you were not an important contributor to the forum. You are capable of engendering methods and setting styles. Yet again, "You can't seriously believe that a "phone home" feature could not be used for malicious purposes". The "thin skinned" comment comes from the fact that although I took your "Phone Home" method to task because of its potential to be used as a backdoor, you apparently perceived it as a personal attack. I have long known that a personal verbal attack does little to change someone's methods, but if people can't attack/take to task/take issue with/or a phrase of similar effect, your method, what can they do? You also said something about me making read-between-the-lines posts, I'll have to review my posts to check that. I probably have, I don't think that would put me in either a small or necessarily ill-mannered group. There is one other thing, the magnitude of your reaction gave my post more importance than I had thought it had. Gene
-
If I had questioned your integrity it would have been explicit! You wouldn't have had to wander back and forth! I have never used EnCodeIt for the reason I stated and no others. I didn't think you were this thin skinned, nobody who writes software should be thin skinned. Besides ever since I joined this forum I and I feel sure you have too seen many posts recomending folks to post their source and for people to examine it closely before running it. You heard about that incident because that is what I remembered as I thought about the possible ramifications of software the HAS to PHONE home to run. Everything I mentioned is possible. I didn't think you would do those things so I said so! Yes I know we all have opinions, mine were that you wouldn't be creating software time bombs and that you wouldn't be upset as you are. Well, I got the second one wrong. Software that phones home still bothers me not for what you have done or even might do. It bothers me because of what it can be used to do. If/As other people use a similar method to allow use of an application, people will become accustomed to it. How many times have you read Valik berating people for asking for tools that can be used for nefarious purposes. No matter how good and well intentioned you are, you are helping set the stage for a lot of future unpleasantness. Gene
-
I really like this tool. However, the "New Clip Text" balloon stays up ALL the time. In the image, you see it up in front of the Forum. If it is a bug I hope you can fix it soon, what I'd really like is an option in Config to toggle it on or OFF. I'm using XP Pro SP2. I downloaded AutoIt and Scite fresh just after the last AutoIt Release.
-
Hi, it is my understanding from Valik that INI files as datadases are quite unstable when they exceed a certain size. I'm not sure of the exact size, but between 200 and 300 items sounds familiar. Of course you could split up the records into smaller INI files based on the alphabet, but that would be kind of kludgy. You could jump into one of the flavors of SQL and associated UDFs to be found on the forum. This would probably be harder in the short term, but better in the longer term. If you don't have very many fields per record and don't expect more the 500 to 700 records you could keep the records in a sorted flat file and load the entire thing into RAM on startup for whatever management is needed. Be sure to automatically save the file each time changes are made.
-
I understand your not wanting to share the source code and have no problem with it. There is (without making an accusation) however another question to ask. One has to wonder what other features there may be included that you might decide to turn on later? For that matter what additional code might be included in each obfuscated script that could also be turned on or off later. I remember an incident from a few years back, a company purchased a major piece of niche software and a service contract. A couple years later the service got very poor. The purchaser negotiated with the vendor repeatedly, the vendor committed to better service but didn't follow through. The company canceled the service contract. The vendor was enraged and demanded that the company pickup the service contract and at the higher current rate. The company refused, 3 weeks later the vendor used a backdoor and shutdown the software. The company failed before the courts could provide any relief. Now, from your general demeanor on the forum and reading your posts, I doubt you would do something like that, but who could know for a fact? The reason I don't use the Encoder is because I don't user any software that MUST phone home in order to operate. I appreciate your telling me about that up front.