rich2323 Posted January 15, 2012 Share Posted January 15, 2012 (edited) Hi, I made a simple little script that goes and checks a webpage and then reports the info back to a tray tool tip. After compiling and running this script it takes close to 6 megs when running, which seems very excessive to me for the little bit its doing. I have cleaned up the script to the best of my knowledge and was wonder if you any had any suggestions to minimize the memory usage in my script. I would appreciate any suggestions. Thanks, Rich expandcollapse popup#include Opt("TrayOnEventMode",1) Opt("TrayMenuMode",3) HotKeySet("{ESC}", "quit") $oldresult = 0 $newresult = 0 Dim $howmanywho $statuspage = TrayCreateItem("Status Page") TrayItemSetOnEvent(-1, "statuspage") TrayCreateItem("") $refreshitem = TrayCreateItem("Refresh Now") TrayItemSetOnEvent(-1, "check") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TrayItemSetOnEvent(-1,"quit") TraySetToolTip ("Loading please wait.....") TraySetState() While 1 check () Sleeptime () WEnd Func check() Local $_InetRead = InetRead("somewebsite.com/") If Not @error Then Local $_BinaryToString = BinaryToString($_InetRead) EndIf ; how many is on: $_stinginstr = StringInStr ($_BinaryToString, "There are") $_stinginstrback = StringInStr ($_BinaryToString, "on currently") $totalStringinstr = $_stinginstrback - $_stinginstr $howmany = StringMid ($_BinaryToString,$_stinginstr,$totalStringinstr) $asResult = StringRegExp($howmany, '([0-9]{1,3})(?: users)', 1) ConsoleWrite (@CRLF & $asResult[0] & @CRLF) If $asResult[0] = 0 then ; do nothing if none one is in lobby Else ConsoleWrite (@CRLF & "old results: "& $oldresult & @CRLF) If $oldresult = 0 Then ; do nothing Else $newresult = $asResult[0] - $oldresult ;ConsoleWrite (@CRLF & "new results: "& $newresult & @CRLF) If $newresult > 0 Then SoundPlay(@WindowsDir & "mediatada.wav",1) Else EndIf Endif EndIf local $oldresult = $asResult[0] If $newresult = "-1" then SoundPlay(@WindowsDir & "mediaWindows Error.wav",1) local $_InetRead1 = InetRead(somewhebsite.") local $howmanywho = BinaryToString($_InetRead1) TraySetToolTip ("There are "& $asResult[0] & " people in Sanctum:" & @CRLF & $howmanywho) If $newresult > 0 Then TrayTip("Current Sanctum Players: ", $howmanywho, 3) EndFunc func Sleeptime () sleep (60000*5) ;5 minutes EndFunc func statuspage() ShellExecute(http://somewebsite") EndFunc func quit () Exit EndFunc Edited January 15, 2012 by rich2323 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 15, 2012 Moderators Share Posted January 15, 2012 rich2323,This script appears to access a game website. Please explain how this does not infringe the Forum Rules. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
rich2323 Posted January 15, 2012 Author Share Posted January 15, 2012 (edited) Sorry, I was not aware of this rule, I am just trying to under autoit better. I will delete my post. How can I learn autoit if I can use it for practical purposes? I think your being a little harsh. Thanks anyways. Rich Edited January 15, 2012 by rich2323 Link to comment Share on other sites More sharing options...
rich2323 Posted January 15, 2012 Author Share Posted January 15, 2012 I changed the code to a generic website name....is that more appropriate? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 15, 2012 Moderators Share Posted January 15, 2012 (edited) rich2323,How can I learn autoit if I can use it for practical purposes?Look at all the other threads which are not locked - plenty of ways to use AutoIt other than games. And yes we are draconian about game threads - just look at the archived game forum to see why. M23Edit: Just seen your last post - I am afraid not. Edited January 15, 2012 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts