twitchyliquid64 Posted July 11, 2008 Share Posted July 11, 2008 Hi Guys. I'm Experiencing some problems with a script I'm developing. It functions are to: autologon to hotmail(notdone), to transalate words(done), and to check my website for msgs. However when I change from one function to another, It takes soooo long for the controls to hide, and then show the appropriate ones. Can someone help me optimize my script? Sorry if it's poorly written...Im only 13.expandcollapse popup#cs ---------------------------------------------------------- AutoIt Version: 3.2.6.0 Author: Hyperzap (Course I'm not giving you my real name.) Script Function: Utility program for school students. (ie. ME, yr 8!) #ce ---------------------------------------------------------------------------- Global $max = 10 Dim $aRecords ; Declare a lot of variables. (I hope I didn't leave one out :) )Okay. Maybe it's Not ; Very many variables.Oh, I'm distracting you. That is UNKOOL. :( Dim $msg, $traymsg, $i, $j #NoTrayIcon #include <array.au3> #Include <GuiListView.au3> #include <GUIConstants.au3> #include <Constants.au3> #include <String.au3> #include <File.au3> #include "Misc.au3" #include "Inet.au3" $Flashstate = 1 TraySetPauseIcon( @ScriptDir & "/img/del.ico",1) TraySetIcon( @ScriptDir & "/img/enable_server.bmp", 1) $win = GUICreate("spi net", 670, 500) GUISetState() Global $defaultstatus = "Ready. No alarms" Global $status ;creates all the controls. 38... I think. $statuslabel = GUICtrlCreateLabel ($defaultstatus,0,485,600,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image $stat = GUICtrlCreatePic( "NRMgood.gif", 610, 430, 50, 50) $progress = GUICtrlCreateProgress( 610, 483, 50, 10, $PBS_SMOOTH) GUICtrlSetBkColor( -1, 0x000000) GUICtrlSetColor( -1, 0xFFFF00 ) GuiCtrlSetData( $progress, 0) GUISetBkColor( 0x000000, $win ) $pinggroup = GUICtrlCreateGroup( "monitor", 50, 30, 470, 420) GUICtrlSetBkColor( $pinggroup, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $ping1 = GUICtrlCreateInput( "", 70, 50, 100, 20) GUICtrlSetBkColor( $ping1, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph1 = GUICtrlCreatePic( "NRM.gif", 470, 45, 30, 30) $pingbutton1 = GUICtrlCreateButton( " exc ", 380, 50) GUICtrlSetBkColor( $pingbutton1, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab1 = GUICtrlCreateLabel ( "",220,55,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $ping2 = GUICtrlCreateInput( "", 70, 100, 100, 20) GUICtrlSetBkColor( $ping2, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph2 = GUICtrlCreatePic( "NRM.gif", 470, 95, 30, 30) $pingbutton2 = GUICtrlCreateButton( " exc ", 380, 100) GUICtrlSetBkColor( $pingbutton2, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab2 = GUICtrlCreateLabel ( "",220,105,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $ping3 = GUICtrlCreateInput( "", 70, 150, 100, 20) GUICtrlSetBkColor( $ping3, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph3 = GUICtrlCreatePic( "NRM.gif", 470, 145, 30, 30) $pingbutton3 = GUICtrlCreateButton( " exc ", 380, 150) GUICtrlSetBkColor( $pingbutton3, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab3 = GUICtrlCreateLabel ( "",220,155,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $ping4 = GUICtrlCreateInput( "", 70, 200, 100, 20) GUICtrlSetBkColor( $ping4, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph4 = GUICtrlCreatePic( "NRM.gif", 470, 195, 30, 30) $pingbutton4 = GUICtrlCreateButton( " exc ", 380, 200) GUICtrlSetBkColor( $pingbutton4, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab4 = GUICtrlCreateLabel ( "",220,205,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $ping5 = GUICtrlCreateInput( "", 70, 250, 100, 20) GUICtrlSetBkColor( $ping5, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph5 = GUICtrlCreatePic( "NRM.gif", 470, 245, 30, 30) $pingbutton5 = GUICtrlCreateButton( " exc ", 380, 250) GUICtrlSetBkColor( $pingbutton5, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab5 = GUICtrlCreateLabel ( "",220,255,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $msglab = GUICtrlCreateLabel ( "Waiting for update stream",310,40,200,100) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( -1, $GUI_HIDE) $msggroup = GUICtrlCreateGroup( "Aloysnet Messages", 290, 25, 235, 135) GUICtrlSetBkColor( $msggroup, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( -1, $GUI_HIDE) $umsggroup = GUICtrlCreateGroup( "Aloysnet Alerts", 40, 25, 235, 135) GUICtrlSetBkColor( $msggroup, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( -1, $GUI_HIDE) $umsglab = GUICtrlCreateLabel ( "Waiting for update stream",60,40,200,100) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( -1, $GUI_HIDE) $output = GUICtrlCreateEdit("Please wait. Loading...", 60, 300, 450, 130, $ES_AUTOVSCROLL+$WS_VSCROLL) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $output, 0x000000) $refresh = GUICtrlCreateButton( " Refresh ", 420, 270) GUICtrlSetBkColor( $refresh, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( $refresh, $GUI_HIDE) $msncheck = GUICtrlCreateButton( "Msn online checker [disabled]", 10, 0) GUICtrlSetBkColor( $msncheck, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $aloysnet = GUICtrlCreateButton( " aloysnet ", 170, 0) GUICtrlSetColor( -1, 0x00ff00 ) $trans = GUICtrlCreateButton( " Transolator ", 235, 0) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $trans, 0x000000) $prog = GUICtrlCreateProgress( 30, 40, 620, 20, $PBS_SMOOTH) GUICtrlSetColor( -1, 0xFFFF00) GUICtrlSetBkColor( $prog, 0x000000) GUiCtrlSetData( $prog, 0) Global $Input1 = GUICtrlCreateInput("a", 176, 68, 300, 21, $SS_NOTIFY) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $Input1, 0x000000) Global $search = GUICtrlCreateButton("Search french", 476, 306, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search, 0x000000) Global $search2 = GUICtrlCreateButton("Search Italian", 476, 326, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search2, 0x000000) Global $search3 = GUICtrlCreateButton("Search German", 476, 346, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search3, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search, 0x000000) Global $search4 = GUICtrlCreateButton("Search Spanish", 476, 366, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search4, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search, 0x000000) Global $searchall = GUICtrlCreateButton("Search all", 476, 406, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $searchall, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search, 0x000000) Global $search5 = GUICtrlCreateButton("Search Portuguese", 476, 386, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search5, 0x000000) Global $Main = GUICtrlCreateListView("# |Name ", 176, 90, 300, 280) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $Main, 0x000000) GUISetState() GUICtrlSetBkColor( $aloysnet, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUISetState() ;defines the correct controls for inital display monithide() aloysnethide() translation() ;==> ;development checking. will NOT in final version HotKeySet( "{HOME}", "monithide") HotKeySet( "{END}", "monitshow") HotKeySet( "{PGUP}", "aloysnetshow") HotKeySet( "{PGDN}", "aloysnethide") ;==> GUICtrlSetBkColor( $progress, 0x000000) GUICtrlSetData( $output, "Welcome to the aloysnet panel. Here you have access to the messages posted by myself in relation to students, events etc. Here you also have access to weather, forums, sites and other useful things.") While 1 $msg = GUIGetMsg() select ;the reason I disabled the MSN check was because it was illegal. (in australia). ;It works be finding the internet speed of the dest. computer, then pinging it, ;and finding the most likely thing that computer is doing along with a chance of error ;report. (in percentage) Case $msg = $Search Search() Case $msg = $Search2 Search2() Case $msg = $Search3 Search3() Case $msg = $Search4 Search4() Case $msg = $Search5 Search5() Case $msg = $Searchall Searchall() Case $msg = $aloysnet ProgressOn( "Aloysnet", "Loading agent", "loading. Please wait") monithide() aloysnetshow() detranslation() Progressoff() Case $msg = $trans ProgressOn( "Transolation database", "Loading agent", "loading. Please wait") monithide() aloysnethide() translation() Progressoff() Case $msg = $msncheck ProgressOn( "Monit", "Loading agent", "Loading. Please wait") AdlibDisable() detranslation() monitshow() aloysnethide() Progressoff() Case $msg = $refresh aloysnetupdate() Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func monithide();hides the MSN system controls GUiCtrlSetState( $pinggraph1, $GUI_HIDE) GUiCtrlSetState( $pinggraph2, $GUI_HIDE) GUiCtrlSetState( $pinggraph3, $GUI_HIDE) GUiCtrlSetState( $pinggraph4, $GUI_HIDE) GUiCtrlSetState( $pinggraph5, $GUI_HIDE) GUiCtrlSetState( $ping1, $GUI_HIDE) GUiCtrlSetState( $ping2, $GUI_HIDE) GUiCtrlSetState( $ping3, $GUI_HIDE) GUiCtrlSetState( $ping4, $GUI_HIDE) GUiCtrlSetState( $ping5, $GUI_HIDE) GUiCtrlSetState( $pinglab1, $GUI_HIDE) GUiCtrlSetState( $pinglab2, $GUI_HIDE) GUiCtrlSetState( $pinglab3, $GUI_HIDE) GUiCtrlSetState( $pinglab4, $GUI_HIDE) GUiCtrlSetState( $pinglab5, $GUI_HIDE) GUiCtrlSetState( $pingbutton1, $GUI_HIDE) GUiCtrlSetState( $pingbutton2, $GUI_HIDE) GUiCtrlSetState( $pingbutton3, $GUI_HIDE) GUiCtrlSetState( $pingbutton4, $GUI_HIDE) GUiCtrlSetState( $pingbutton5, $GUI_HIDE) GUiCtrlSetState( $pinggroup, $GUI_HIDE) GUICtrlSetData( $output, "Loading...") Endfunc Func aloysnetupdate();updates info for aloysnet GUICtrlSetData( $output, "Updating...") GUICtrlSetData( $umsglab, "Updating...") GUICtrlSetData( $msglab, "Updating...") if FileExists( @scriptdir & "/sysdata.dat") Then FileDelete( @scriptdir & "/sysdata.dat") $msg = "error connecting to aloysnet. Please ensure internet is operational and online." InetGet( "http://hyperzap.googlepages.com/sysdata.dat", @scriptdir & "/sysdata.dat") Sleep(500) if FileExists( @scriptdir & "/sysdata.dat") Then $dir = IniRead( @scriptdir & "/sysdata.dat", "sys", "dwndir", "http://hyperzap.googlepages.com/") $msg = IniRead( @scriptdir & "/sysdata.dat", "message", "dwnmsg", "Error connecting to aloysnet messaging system.") $urgmsg = IniRead( @scriptdir & "/sysdata.dat", "message", "urgentmsg", "N/A") $urgmsgrd = IniRead( @scriptdir & "/sysdata.dat", "message", "urgentmsgdisplay", "0") GUICtrlSetData( $msglab, $msg) GUICtrlSetData( $output, "Data updated successfully.") GUICtrlSetData( $umsglab, $urgmsg) Else GUICtrlSetData( $msglab, $msg) GUICtrlSetData( $output, "Error occurred connecting to the aloysnet server. Please verify the internet is working") GUICtrlSetData( $umsglab, "N/A") TrayTip( "error updating infomation", "Spi Net failed to update system. Please check your internet connection", 5, 2) EndIf Endfunc Func aloysnethide();hides the aloysnet system controls. AdlibDisable() GUICtrlSetState( $refresh, $GUI_HIDE) GUICtrlSetState( $msggroup, $GUI_HIDE) GUICtrlSetState( $msglab, $GUI_HIDE) GUICtrlSetState( $umsggroup, $GUI_HIDE) GUICtrlSetState( $umsglab, $GUI_HIDE) EndFunc Func aloysnetshow();shows the aloysnet system controls GUICtrlSetData( $output, "Welcome to the aloysnet panel. Here you have access to the messages posted by myself in relation to students, events etc. Here you also have access to weather, forums, sites and other useful things." & @CRLF & @CRLF & "WAITING FOR MESSAGE UPDATE STREAM:") GUICtrlSetState( $refresh, $GUI_SHOW) GUICtrlSetState( $msggroup, $GUI_SHOW) GUICtrlSetState( $msglab, $GUI_SHOW) GUICtrlSetState( $umsggroup, $GUI_SHOW) GUICtrlSetState( $umsglab, $GUI_SHOW) GUICtrlSetState( $output, $GUI_SHOW) AdlibEnable( "aloysnetupdate", 10000) EndFunc Func monitshow();shows the MSN check controls GUICtrlSetState( $output, $GUI_SHOW) GUiCtrlSetState( $pinggraph1, $GUI_SHOW) GUiCtrlSetState( $pinggraph2, $GUI_SHOW) GUiCtrlSetState( $pinggraph3, $GUI_SHOW) GUiCtrlSetState( $pinggraph4, $GUI_SHOW) GUiCtrlSetState( $pinggraph5, $GUI_SHOW) GUiCtrlSetState( $ping1, $GUI_SHOW) GUiCtrlSetState( $ping2, $GUI_SHOW) GUiCtrlSetState( $ping3, $GUI_SHOW) GUiCtrlSetState( $ping4, $GUI_SHOW) GUiCtrlSetState( $ping5, $GUI_SHOW) GUiCtrlSetState( $pinglab1, $GUI_SHOW) GUiCtrlSetState( $pinglab2, $GUI_SHOW) GUiCtrlSetState( $pinglab3, $GUI_SHOW) GUiCtrlSetState( $pinglab4, $GUI_SHOW) GUiCtrlSetState( $pinglab5, $GUI_SHOW) GUiCtrlSetState( $pingbutton1, $GUI_SHOW) GUiCtrlSetState( $pingbutton2, $GUI_SHOW) GUiCtrlSetState( $pingbutton3, $GUI_SHOW) GUiCtrlSetState( $pingbutton4, $GUI_SHOW) GUiCtrlSetState( $pingbutton5, $GUI_SHOW) GUiCtrlSetState( $pinggroup, $GUI_SHOW) GUICtrlSetData( $output, "By order of a new legislation of privacy (2007) and influences from (certain) people, the computer MSN online check has been disabled. Soz and dont blame ME!") Endfunc func translation();shows the translation controls GUICtrlSetData( $prog, 20 ) GUICtrlSetState( $Main, $GUI_SHOW) GUICtrlSetState( $prog, $GUI_SHOW) GUICtrlSetData( $prog, 60 ) GUICtrlSetState( $Input1, $GUI_SHOW) GUICtrlSetState( $search, $GUI_SHOW) GUICtrlSetData( $prog, 90 ) GUICtrlSetState( $search2, $GUI_SHOW) GUICtrlSetState( $search4, $GUI_SHOW) GUICtrlSetState( $search5, $GUI_SHOW) GUICtrlSetState( $searchall, $GUI_SHOW) GUICtrlSetData( $prog, 95 ) GUICtrlSetState( $search3, $GUI_SHOW) GUICtrlSetState( $output, $GUI_HIDE) GUICtrlSetData( $prog, 100 ) Search() Sleep(500) _GUICtrlListViewScroll ($main, 0, 99236) EndFunc func detranslation();unshows (excuse grammar) the translation controls GUICtrlSetData( $prog, 20 ) GUICtrlSetState( $Main, $GUI_HIDE) GUICtrlSetData( $prog, 60 ) GUICtrlSetState( $Input1, $GUI_HIDE) GUICtrlSetState( $search, $GUI_HIDE) GUICtrlSetData( $prog, 90 ) GUICtrlSetState( $search2, $GUI_HIDE) GUICtrlSetState( $search4, $GUI_HIDE) GUICtrlSetState( $search5, $GUI_HIDE) GUICtrlSetState( $searchall, $GUI_HIDE) GUICtrlSetData( $prog, 95 ) GUICtrlSetState( $search3, $GUI_HIDE) GUICtrlSetState( $output, $GUI_SHOW) GUICtrlSetData( $prog, 100 ) GUICtrlSetState( $prog, $GUI_HIDE) Search() Sleep(500) _GUICtrlListViewScroll ($main, 0, 99236);scrolls to the last entry EndFunc Func Search() GUICtrlSetData( $prog, 20 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("French.qdf",$aRecords) Then error();checks if the transalator file exists For $count = 1 to $aRecords[0] step 1;searches for correct entries and displays them. also calculates progress $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236);scrolls to the last entry EndFunc Func Search2() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Italian.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func Search3() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("German.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func Search4() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Spanish.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func Search5() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Portuguese.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func Searchall() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Portuguese.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Spanish.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("German.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Italian.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("French.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func error() ProgressOn( "Error", "CRITICAL ERROR", "An error has occurred. The computer is annoyed") For $x = 0 to 100 step 1 ProgressSet( $x) Sleep(50) Next EndFuncA fully functional stable EXE with required files is found HERE ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search Link to comment Share on other sites More sharing options...
tele Posted July 14, 2008 Share Posted July 14, 2008 Hi, Where did you run your code? I have similar experience when I tried to run my code in a notebook (various type). However, the same programme does not suffer the same when it was run on a Desktop. Terry Hi Guys. I'm Experiencing some problems with a script I'm developing. It functions are to: autologon to hotmail(notdone), to transalate words(done), and to check my website for msgs. However when I change from one function to another, It takes soooo long for the controls to hide, and then show the appropriate ones. Can someone help me optimize my script? Sorry if it's poorly written...Im only 13. expandcollapse popup#cs ---------------------------------------------------------- AutoIt Version: 3.2.6.0 Author: Hyperzap (Course I'm not giving you my real name.) Script Function: Utility program for school students. (ie. ME, yr 8!) #ce ---------------------------------------------------------------------------- Global $max = 10 Dim $aRecords ; Declare a lot of variables. (I hope I didn't leave one out :) )Okay. Maybe it's Not ; Very many variables.Oh, I'm distracting you. That is UNKOOL. :( Dim $msg, $traymsg, $i, $j #NoTrayIcon #include <array.au3> #Include <GuiListView.au3> #include <GUIConstants.au3> #include <Constants.au3> #include <String.au3> #include <File.au3> #include "Misc.au3" #include "Inet.au3" $Flashstate = 1 TraySetPauseIcon( @ScriptDir & "/img/del.ico",1) TraySetIcon( @ScriptDir & "/img/enable_server.bmp", 1) $win = GUICreate("spi net", 670, 500) GUISetState() Global $defaultstatus = "Ready. No alarms" Global $status ;creates all the controls. 38... I think. $statuslabel = GUICtrlCreateLabel ($defaultstatus,0,485,600,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image $stat = GUICtrlCreatePic( "NRMgood.gif", 610, 430, 50, 50) $progress = GUICtrlCreateProgress( 610, 483, 50, 10, $PBS_SMOOTH) GUICtrlSetBkColor( -1, 0x000000) GUICtrlSetColor( -1, 0xFFFF00 ) GuiCtrlSetData( $progress, 0) GUISetBkColor( 0x000000, $win ) $pinggroup = GUICtrlCreateGroup( "monitor", 50, 30, 470, 420) GUICtrlSetBkColor( $pinggroup, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $ping1 = GUICtrlCreateInput( "", 70, 50, 100, 20) GUICtrlSetBkColor( $ping1, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph1 = GUICtrlCreatePic( "NRM.gif", 470, 45, 30, 30) $pingbutton1 = GUICtrlCreateButton( " exc ", 380, 50) GUICtrlSetBkColor( $pingbutton1, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab1 = GUICtrlCreateLabel ( "",220,55,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $ping2 = GUICtrlCreateInput( "", 70, 100, 100, 20) GUICtrlSetBkColor( $ping2, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph2 = GUICtrlCreatePic( "NRM.gif", 470, 95, 30, 30) $pingbutton2 = GUICtrlCreateButton( " exc ", 380, 100) GUICtrlSetBkColor( $pingbutton2, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab2 = GUICtrlCreateLabel ( "",220,105,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $ping3 = GUICtrlCreateInput( "", 70, 150, 100, 20) GUICtrlSetBkColor( $ping3, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph3 = GUICtrlCreatePic( "NRM.gif", 470, 145, 30, 30) $pingbutton3 = GUICtrlCreateButton( " exc ", 380, 150) GUICtrlSetBkColor( $pingbutton3, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab3 = GUICtrlCreateLabel ( "",220,155,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $ping4 = GUICtrlCreateInput( "", 70, 200, 100, 20) GUICtrlSetBkColor( $ping4, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph4 = GUICtrlCreatePic( "NRM.gif", 470, 195, 30, 30) $pingbutton4 = GUICtrlCreateButton( " exc ", 380, 200) GUICtrlSetBkColor( $pingbutton4, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab4 = GUICtrlCreateLabel ( "",220,205,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $ping5 = GUICtrlCreateInput( "", 70, 250, 100, 20) GUICtrlSetBkColor( $ping5, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph5 = GUICtrlCreatePic( "NRM.gif", 470, 245, 30, 30) $pingbutton5 = GUICtrlCreateButton( " exc ", 380, 250) GUICtrlSetBkColor( $pingbutton5, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab5 = GUICtrlCreateLabel ( "",220,255,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $msglab = GUICtrlCreateLabel ( "Waiting for update stream",310,40,200,100) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( -1, $GUI_HIDE) $msggroup = GUICtrlCreateGroup( "Aloysnet Messages", 290, 25, 235, 135) GUICtrlSetBkColor( $msggroup, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( -1, $GUI_HIDE) $umsggroup = GUICtrlCreateGroup( "Aloysnet Alerts", 40, 25, 235, 135) GUICtrlSetBkColor( $msggroup, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( -1, $GUI_HIDE) $umsglab = GUICtrlCreateLabel ( "Waiting for update stream",60,40,200,100) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( -1, $GUI_HIDE) $output = GUICtrlCreateEdit("Please wait. Loading...", 60, 300, 450, 130, $ES_AUTOVSCROLL+$WS_VSCROLL) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $output, 0x000000) $refresh = GUICtrlCreateButton( " Refresh ", 420, 270) GUICtrlSetBkColor( $refresh, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( $refresh, $GUI_HIDE) $msncheck = GUICtrlCreateButton( "Msn online checker [disabled]", 10, 0) GUICtrlSetBkColor( $msncheck, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $aloysnet = GUICtrlCreateButton( " aloysnet ", 170, 0) GUICtrlSetColor( -1, 0x00ff00 ) $trans = GUICtrlCreateButton( " Transolator ", 235, 0) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $trans, 0x000000) $prog = GUICtrlCreateProgress( 30, 40, 620, 20, $PBS_SMOOTH) GUICtrlSetColor( -1, 0xFFFF00) GUICtrlSetBkColor( $prog, 0x000000) GUiCtrlSetData( $prog, 0) Global $Input1 = GUICtrlCreateInput("a", 176, 68, 300, 21, $SS_NOTIFY) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $Input1, 0x000000) Global $search = GUICtrlCreateButton("Search french", 476, 306, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search, 0x000000) Global $search2 = GUICtrlCreateButton("Search Italian", 476, 326, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search2, 0x000000) Global $search3 = GUICtrlCreateButton("Search German", 476, 346, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search3, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search, 0x000000) Global $search4 = GUICtrlCreateButton("Search Spanish", 476, 366, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search4, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search, 0x000000) Global $searchall = GUICtrlCreateButton("Search all", 476, 406, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $searchall, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search, 0x000000) Global $search5 = GUICtrlCreateButton("Search Portuguese", 476, 386, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search5, 0x000000) Global $Main = GUICtrlCreateListView("# |Name ", 176, 90, 300, 280) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $Main, 0x000000) GUISetState() GUICtrlSetBkColor( $aloysnet, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUISetState() ;defines the correct controls for inital display monithide() aloysnethide() translation() ;==> ;development checking. will NOT in final version HotKeySet( "{HOME}", "monithide") HotKeySet( "{END}", "monitshow") HotKeySet( "{PGUP}", "aloysnetshow") HotKeySet( "{PGDN}", "aloysnethide") ;==> GUICtrlSetBkColor( $progress, 0x000000) GUICtrlSetData( $output, "Welcome to the aloysnet panel. Here you have access to the messages posted by myself in relation to students, events etc. Here you also have access to weather, forums, sites and other useful things.") While 1 $msg = GUIGetMsg() select ;the reason I disabled the MSN check was because it was illegal. (in australia). ;It works be finding the internet speed of the dest. computer, then pinging it, ;and finding the most likely thing that computer is doing along with a chance of error ;report. (in percentage) Case $msg = $Search Search() Case $msg = $Search2 Search2() Case $msg = $Search3 Search3() Case $msg = $Search4 Search4() Case $msg = $Search5 Search5() Case $msg = $Searchall Searchall() Case $msg = $aloysnet ProgressOn( "Aloysnet", "Loading agent", "loading. Please wait") monithide() aloysnetshow() detranslation() Progressoff() Case $msg = $trans ProgressOn( "Transolation database", "Loading agent", "loading. Please wait") monithide() aloysnethide() translation() Progressoff() Case $msg = $msncheck ProgressOn( "Monit", "Loading agent", "Loading. Please wait") AdlibDisable() detranslation() monitshow() aloysnethide() Progressoff() Case $msg = $refresh aloysnetupdate() Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func monithide();hides the MSN system controls GUiCtrlSetState( $pinggraph1, $GUI_HIDE) GUiCtrlSetState( $pinggraph2, $GUI_HIDE) GUiCtrlSetState( $pinggraph3, $GUI_HIDE) GUiCtrlSetState( $pinggraph4, $GUI_HIDE) GUiCtrlSetState( $pinggraph5, $GUI_HIDE) GUiCtrlSetState( $ping1, $GUI_HIDE) GUiCtrlSetState( $ping2, $GUI_HIDE) GUiCtrlSetState( $ping3, $GUI_HIDE) GUiCtrlSetState( $ping4, $GUI_HIDE) GUiCtrlSetState( $ping5, $GUI_HIDE) GUiCtrlSetState( $pinglab1, $GUI_HIDE) GUiCtrlSetState( $pinglab2, $GUI_HIDE) GUiCtrlSetState( $pinglab3, $GUI_HIDE) GUiCtrlSetState( $pinglab4, $GUI_HIDE) GUiCtrlSetState( $pinglab5, $GUI_HIDE) GUiCtrlSetState( $pingbutton1, $GUI_HIDE) GUiCtrlSetState( $pingbutton2, $GUI_HIDE) GUiCtrlSetState( $pingbutton3, $GUI_HIDE) GUiCtrlSetState( $pingbutton4, $GUI_HIDE) GUiCtrlSetState( $pingbutton5, $GUI_HIDE) GUiCtrlSetState( $pinggroup, $GUI_HIDE) GUICtrlSetData( $output, "Loading...") Endfunc Func aloysnetupdate();updates info for aloysnet GUICtrlSetData( $output, "Updating...") GUICtrlSetData( $umsglab, "Updating...") GUICtrlSetData( $msglab, "Updating...") if FileExists( @scriptdir & "/sysdata.dat") Then FileDelete( @scriptdir & "/sysdata.dat") $msg = "error connecting to aloysnet. Please ensure internet is operational and online." InetGet( "http://hyperzap.googlepages.com/sysdata.dat", @scriptdir & "/sysdata.dat") Sleep(500) if FileExists( @scriptdir & "/sysdata.dat") Then $dir = IniRead( @scriptdir & "/sysdata.dat", "sys", "dwndir", "http://hyperzap.googlepages.com/") $msg = IniRead( @scriptdir & "/sysdata.dat", "message", "dwnmsg", "Error connecting to aloysnet messaging system.") $urgmsg = IniRead( @scriptdir & "/sysdata.dat", "message", "urgentmsg", "N/A") $urgmsgrd = IniRead( @scriptdir & "/sysdata.dat", "message", "urgentmsgdisplay", "0") GUICtrlSetData( $msglab, $msg) GUICtrlSetData( $output, "Data updated successfully.") GUICtrlSetData( $umsglab, $urgmsg) Else GUICtrlSetData( $msglab, $msg) GUICtrlSetData( $output, "Error occurred connecting to the aloysnet server. Please verify the internet is working") GUICtrlSetData( $umsglab, "N/A") TrayTip( "error updating infomation", "Spi Net failed to update system. Please check your internet connection", 5, 2) EndIf Endfunc Func aloysnethide();hides the aloysnet system controls. AdlibDisable() GUICtrlSetState( $refresh, $GUI_HIDE) GUICtrlSetState( $msggroup, $GUI_HIDE) GUICtrlSetState( $msglab, $GUI_HIDE) GUICtrlSetState( $umsggroup, $GUI_HIDE) GUICtrlSetState( $umsglab, $GUI_HIDE) EndFunc Func aloysnetshow();shows the aloysnet system controls GUICtrlSetData( $output, "Welcome to the aloysnet panel. Here you have access to the messages posted by myself in relation to students, events etc. Here you also have access to weather, forums, sites and other useful things." & @CRLF & @CRLF & "WAITING FOR MESSAGE UPDATE STREAM:") GUICtrlSetState( $refresh, $GUI_SHOW) GUICtrlSetState( $msggroup, $GUI_SHOW) GUICtrlSetState( $msglab, $GUI_SHOW) GUICtrlSetState( $umsggroup, $GUI_SHOW) GUICtrlSetState( $umsglab, $GUI_SHOW) GUICtrlSetState( $output, $GUI_SHOW) AdlibEnable( "aloysnetupdate", 10000) EndFunc Func monitshow();shows the MSN check controls GUICtrlSetState( $output, $GUI_SHOW) GUiCtrlSetState( $pinggraph1, $GUI_SHOW) GUiCtrlSetState( $pinggraph2, $GUI_SHOW) GUiCtrlSetState( $pinggraph3, $GUI_SHOW) GUiCtrlSetState( $pinggraph4, $GUI_SHOW) GUiCtrlSetState( $pinggraph5, $GUI_SHOW) GUiCtrlSetState( $ping1, $GUI_SHOW) GUiCtrlSetState( $ping2, $GUI_SHOW) GUiCtrlSetState( $ping3, $GUI_SHOW) GUiCtrlSetState( $ping4, $GUI_SHOW) GUiCtrlSetState( $ping5, $GUI_SHOW) GUiCtrlSetState( $pinglab1, $GUI_SHOW) GUiCtrlSetState( $pinglab2, $GUI_SHOW) GUiCtrlSetState( $pinglab3, $GUI_SHOW) GUiCtrlSetState( $pinglab4, $GUI_SHOW) GUiCtrlSetState( $pinglab5, $GUI_SHOW) GUiCtrlSetState( $pingbutton1, $GUI_SHOW) GUiCtrlSetState( $pingbutton2, $GUI_SHOW) GUiCtrlSetState( $pingbutton3, $GUI_SHOW) GUiCtrlSetState( $pingbutton4, $GUI_SHOW) GUiCtrlSetState( $pingbutton5, $GUI_SHOW) GUiCtrlSetState( $pinggroup, $GUI_SHOW) GUICtrlSetData( $output, "By order of a new legislation of privacy (2007) and influences from (certain) people, the computer MSN online check has been disabled. Soz and dont blame ME!") Endfunc func translation();shows the translation controls GUICtrlSetData( $prog, 20 ) GUICtrlSetState( $Main, $GUI_SHOW) GUICtrlSetState( $prog, $GUI_SHOW) GUICtrlSetData( $prog, 60 ) GUICtrlSetState( $Input1, $GUI_SHOW) GUICtrlSetState( $search, $GUI_SHOW) GUICtrlSetData( $prog, 90 ) GUICtrlSetState( $search2, $GUI_SHOW) GUICtrlSetState( $search4, $GUI_SHOW) GUICtrlSetState( $search5, $GUI_SHOW) GUICtrlSetState( $searchall, $GUI_SHOW) GUICtrlSetData( $prog, 95 ) GUICtrlSetState( $search3, $GUI_SHOW) GUICtrlSetState( $output, $GUI_HIDE) GUICtrlSetData( $prog, 100 ) Search() Sleep(500) _GUICtrlListViewScroll ($main, 0, 99236) EndFunc func detranslation();unshows (excuse grammar) the translation controls GUICtrlSetData( $prog, 20 ) GUICtrlSetState( $Main, $GUI_HIDE) GUICtrlSetData( $prog, 60 ) GUICtrlSetState( $Input1, $GUI_HIDE) GUICtrlSetState( $search, $GUI_HIDE) GUICtrlSetData( $prog, 90 ) GUICtrlSetState( $search2, $GUI_HIDE) GUICtrlSetState( $search4, $GUI_HIDE) GUICtrlSetState( $search5, $GUI_HIDE) GUICtrlSetState( $searchall, $GUI_HIDE) GUICtrlSetData( $prog, 95 ) GUICtrlSetState( $search3, $GUI_HIDE) GUICtrlSetState( $output, $GUI_SHOW) GUICtrlSetData( $prog, 100 ) GUICtrlSetState( $prog, $GUI_HIDE) Search() Sleep(500) _GUICtrlListViewScroll ($main, 0, 99236);scrolls to the last entry EndFunc Func Search() GUICtrlSetData( $prog, 20 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("French.qdf",$aRecords) Then error();checks if the transalator file exists For $count = 1 to $aRecords[0] step 1;searches for correct entries and displays them. also calculates progress $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236);scrolls to the last entry EndFunc Func Search2() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Italian.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func Search3() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("German.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func Search4() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Spanish.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func Search5() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Portuguese.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func Searchall() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Portuguese.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Spanish.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("German.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Italian.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("French.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func error() ProgressOn( "Error", "CRITICAL ERROR", "An error has occurred. The computer is annoyed") For $x = 0 to 100 step 1 ProgressSet( $x) Sleep(50) Next EndFunc A fully functional stable EXE with required files is found HERE Link to comment Share on other sites More sharing options...
tele Posted July 14, 2008 Share Posted July 14, 2008 Hi, Where did you run your code? I have similar experience when I tried to run my code in a notebook (various type). However, the same programme does not suffer the same when it was run on a Desktop. Terry Hi Guys. I'm Experiencing some problems with a script I'm developing. It functions are to: autologon to hotmail(notdone), to transalate words(done), and to check my website for msgs. However when I change from one function to another, It takes soooo long for the controls to hide, and then show the appropriate ones. Can someone help me optimize my script? Sorry if it's poorly written...Im only 13. expandcollapse popup#cs ---------------------------------------------------------- AutoIt Version: 3.2.6.0 Author: Hyperzap (Course I'm not giving you my real name.) Script Function: Utility program for school students. (ie. ME, yr 8!) #ce ---------------------------------------------------------------------------- Global $max = 10 Dim $aRecords ; Declare a lot of variables. (I hope I didn't leave one out :) )Okay. Maybe it's Not ; Very many variables.Oh, I'm distracting you. That is UNKOOL. :( Dim $msg, $traymsg, $i, $j #NoTrayIcon #include <array.au3> #Include <GuiListView.au3> #include <GUIConstants.au3> #include <Constants.au3> #include <String.au3> #include <File.au3> #include "Misc.au3" #include "Inet.au3" $Flashstate = 1 TraySetPauseIcon( @ScriptDir & "/img/del.ico",1) TraySetIcon( @ScriptDir & "/img/enable_server.bmp", 1) $win = GUICreate("spi net", 670, 500) GUISetState() Global $defaultstatus = "Ready. No alarms" Global $status ;creates all the controls. 38... I think. $statuslabel = GUICtrlCreateLabel ($defaultstatus,0,485,600,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image $stat = GUICtrlCreatePic( "NRMgood.gif", 610, 430, 50, 50) $progress = GUICtrlCreateProgress( 610, 483, 50, 10, $PBS_SMOOTH) GUICtrlSetBkColor( -1, 0x000000) GUICtrlSetColor( -1, 0xFFFF00 ) GuiCtrlSetData( $progress, 0) GUISetBkColor( 0x000000, $win ) $pinggroup = GUICtrlCreateGroup( "monitor", 50, 30, 470, 420) GUICtrlSetBkColor( $pinggroup, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $ping1 = GUICtrlCreateInput( "", 70, 50, 100, 20) GUICtrlSetBkColor( $ping1, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph1 = GUICtrlCreatePic( "NRM.gif", 470, 45, 30, 30) $pingbutton1 = GUICtrlCreateButton( " exc ", 380, 50) GUICtrlSetBkColor( $pingbutton1, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab1 = GUICtrlCreateLabel ( "",220,55,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $ping2 = GUICtrlCreateInput( "", 70, 100, 100, 20) GUICtrlSetBkColor( $ping2, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph2 = GUICtrlCreatePic( "NRM.gif", 470, 95, 30, 30) $pingbutton2 = GUICtrlCreateButton( " exc ", 380, 100) GUICtrlSetBkColor( $pingbutton2, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab2 = GUICtrlCreateLabel ( "",220,105,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $ping3 = GUICtrlCreateInput( "", 70, 150, 100, 20) GUICtrlSetBkColor( $ping3, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph3 = GUICtrlCreatePic( "NRM.gif", 470, 145, 30, 30) $pingbutton3 = GUICtrlCreateButton( " exc ", 380, 150) GUICtrlSetBkColor( $pingbutton3, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab3 = GUICtrlCreateLabel ( "",220,155,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $ping4 = GUICtrlCreateInput( "", 70, 200, 100, 20) GUICtrlSetBkColor( $ping4, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph4 = GUICtrlCreatePic( "NRM.gif", 470, 195, 30, 30) $pingbutton4 = GUICtrlCreateButton( " exc ", 380, 200) GUICtrlSetBkColor( $pingbutton4, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab4 = GUICtrlCreateLabel ( "",220,205,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $ping5 = GUICtrlCreateInput( "", 70, 250, 100, 20) GUICtrlSetBkColor( $ping5, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) ;traffic light image (on yellow) $pinggraph5 = GUICtrlCreatePic( "NRM.gif", 470, 245, 30, 30) $pingbutton5 = GUICtrlCreateButton( " exc ", 380, 250) GUICtrlSetBkColor( $pingbutton5, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $pinglab5 = GUICtrlCreateLabel ( "",220,255,150,15,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUICtrlSetColor( -1, 0x00ff00 ) $msglab = GUICtrlCreateLabel ( "Waiting for update stream",310,40,200,100) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( -1, $GUI_HIDE) $msggroup = GUICtrlCreateGroup( "Aloysnet Messages", 290, 25, 235, 135) GUICtrlSetBkColor( $msggroup, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( -1, $GUI_HIDE) $umsggroup = GUICtrlCreateGroup( "Aloysnet Alerts", 40, 25, 235, 135) GUICtrlSetBkColor( $msggroup, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( -1, $GUI_HIDE) $umsglab = GUICtrlCreateLabel ( "Waiting for update stream",60,40,200,100) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( -1, $GUI_HIDE) $output = GUICtrlCreateEdit("Please wait. Loading...", 60, 300, 450, 130, $ES_AUTOVSCROLL+$WS_VSCROLL) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $output, 0x000000) $refresh = GUICtrlCreateButton( " Refresh ", 420, 270) GUICtrlSetBkColor( $refresh, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetState( $refresh, $GUI_HIDE) $msncheck = GUICtrlCreateButton( "Msn online checker [disabled]", 10, 0) GUICtrlSetBkColor( $msncheck, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) $aloysnet = GUICtrlCreateButton( " aloysnet ", 170, 0) GUICtrlSetColor( -1, 0x00ff00 ) $trans = GUICtrlCreateButton( " Transolator ", 235, 0) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $trans, 0x000000) $prog = GUICtrlCreateProgress( 30, 40, 620, 20, $PBS_SMOOTH) GUICtrlSetColor( -1, 0xFFFF00) GUICtrlSetBkColor( $prog, 0x000000) GUiCtrlSetData( $prog, 0) Global $Input1 = GUICtrlCreateInput("a", 176, 68, 300, 21, $SS_NOTIFY) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $Input1, 0x000000) Global $search = GUICtrlCreateButton("Search french", 476, 306, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search, 0x000000) Global $search2 = GUICtrlCreateButton("Search Italian", 476, 326, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search2, 0x000000) Global $search3 = GUICtrlCreateButton("Search German", 476, 346, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search3, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search, 0x000000) Global $search4 = GUICtrlCreateButton("Search Spanish", 476, 366, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search4, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search, 0x000000) Global $searchall = GUICtrlCreateButton("Search all", 476, 406, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $searchall, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search, 0x000000) Global $search5 = GUICtrlCreateButton("Search Portuguese", 476, 386, 181, 21) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $search5, 0x000000) Global $Main = GUICtrlCreateListView("# |Name ", 176, 90, 300, 280) GUICtrlSetState( -1, $GUI_HIDE) GUICtrlSetColor( -1, 0x00ff00 ) GUICtrlSetBkColor( $Main, 0x000000) GUISetState() GUICtrlSetBkColor( $aloysnet, 0x000000) GUICtrlSetColor( -1, 0x00ff00 ) GUISetState() ;defines the correct controls for inital display monithide() aloysnethide() translation() ;==> ;development checking. will NOT in final version HotKeySet( "{HOME}", "monithide") HotKeySet( "{END}", "monitshow") HotKeySet( "{PGUP}", "aloysnetshow") HotKeySet( "{PGDN}", "aloysnethide") ;==> GUICtrlSetBkColor( $progress, 0x000000) GUICtrlSetData( $output, "Welcome to the aloysnet panel. Here you have access to the messages posted by myself in relation to students, events etc. Here you also have access to weather, forums, sites and other useful things.") While 1 $msg = GUIGetMsg() select ;the reason I disabled the MSN check was because it was illegal. (in australia). ;It works be finding the internet speed of the dest. computer, then pinging it, ;and finding the most likely thing that computer is doing along with a chance of error ;report. (in percentage) Case $msg = $Search Search() Case $msg = $Search2 Search2() Case $msg = $Search3 Search3() Case $msg = $Search4 Search4() Case $msg = $Search5 Search5() Case $msg = $Searchall Searchall() Case $msg = $aloysnet ProgressOn( "Aloysnet", "Loading agent", "loading. Please wait") monithide() aloysnetshow() detranslation() Progressoff() Case $msg = $trans ProgressOn( "Transolation database", "Loading agent", "loading. Please wait") monithide() aloysnethide() translation() Progressoff() Case $msg = $msncheck ProgressOn( "Monit", "Loading agent", "Loading. Please wait") AdlibDisable() detranslation() monitshow() aloysnethide() Progressoff() Case $msg = $refresh aloysnetupdate() Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func monithide();hides the MSN system controls GUiCtrlSetState( $pinggraph1, $GUI_HIDE) GUiCtrlSetState( $pinggraph2, $GUI_HIDE) GUiCtrlSetState( $pinggraph3, $GUI_HIDE) GUiCtrlSetState( $pinggraph4, $GUI_HIDE) GUiCtrlSetState( $pinggraph5, $GUI_HIDE) GUiCtrlSetState( $ping1, $GUI_HIDE) GUiCtrlSetState( $ping2, $GUI_HIDE) GUiCtrlSetState( $ping3, $GUI_HIDE) GUiCtrlSetState( $ping4, $GUI_HIDE) GUiCtrlSetState( $ping5, $GUI_HIDE) GUiCtrlSetState( $pinglab1, $GUI_HIDE) GUiCtrlSetState( $pinglab2, $GUI_HIDE) GUiCtrlSetState( $pinglab3, $GUI_HIDE) GUiCtrlSetState( $pinglab4, $GUI_HIDE) GUiCtrlSetState( $pinglab5, $GUI_HIDE) GUiCtrlSetState( $pingbutton1, $GUI_HIDE) GUiCtrlSetState( $pingbutton2, $GUI_HIDE) GUiCtrlSetState( $pingbutton3, $GUI_HIDE) GUiCtrlSetState( $pingbutton4, $GUI_HIDE) GUiCtrlSetState( $pingbutton5, $GUI_HIDE) GUiCtrlSetState( $pinggroup, $GUI_HIDE) GUICtrlSetData( $output, "Loading...") Endfunc Func aloysnetupdate();updates info for aloysnet GUICtrlSetData( $output, "Updating...") GUICtrlSetData( $umsglab, "Updating...") GUICtrlSetData( $msglab, "Updating...") if FileExists( @scriptdir & "/sysdata.dat") Then FileDelete( @scriptdir & "/sysdata.dat") $msg = "error connecting to aloysnet. Please ensure internet is operational and online." InetGet( "http://hyperzap.googlepages.com/sysdata.dat", @scriptdir & "/sysdata.dat") Sleep(500) if FileExists( @scriptdir & "/sysdata.dat") Then $dir = IniRead( @scriptdir & "/sysdata.dat", "sys", "dwndir", "http://hyperzap.googlepages.com/") $msg = IniRead( @scriptdir & "/sysdata.dat", "message", "dwnmsg", "Error connecting to aloysnet messaging system.") $urgmsg = IniRead( @scriptdir & "/sysdata.dat", "message", "urgentmsg", "N/A") $urgmsgrd = IniRead( @scriptdir & "/sysdata.dat", "message", "urgentmsgdisplay", "0") GUICtrlSetData( $msglab, $msg) GUICtrlSetData( $output, "Data updated successfully.") GUICtrlSetData( $umsglab, $urgmsg) Else GUICtrlSetData( $msglab, $msg) GUICtrlSetData( $output, "Error occurred connecting to the aloysnet server. Please verify the internet is working") GUICtrlSetData( $umsglab, "N/A") TrayTip( "error updating infomation", "Spi Net failed to update system. Please check your internet connection", 5, 2) EndIf Endfunc Func aloysnethide();hides the aloysnet system controls. AdlibDisable() GUICtrlSetState( $refresh, $GUI_HIDE) GUICtrlSetState( $msggroup, $GUI_HIDE) GUICtrlSetState( $msglab, $GUI_HIDE) GUICtrlSetState( $umsggroup, $GUI_HIDE) GUICtrlSetState( $umsglab, $GUI_HIDE) EndFunc Func aloysnetshow();shows the aloysnet system controls GUICtrlSetData( $output, "Welcome to the aloysnet panel. Here you have access to the messages posted by myself in relation to students, events etc. Here you also have access to weather, forums, sites and other useful things." & @CRLF & @CRLF & "WAITING FOR MESSAGE UPDATE STREAM:") GUICtrlSetState( $refresh, $GUI_SHOW) GUICtrlSetState( $msggroup, $GUI_SHOW) GUICtrlSetState( $msglab, $GUI_SHOW) GUICtrlSetState( $umsggroup, $GUI_SHOW) GUICtrlSetState( $umsglab, $GUI_SHOW) GUICtrlSetState( $output, $GUI_SHOW) AdlibEnable( "aloysnetupdate", 10000) EndFunc Func monitshow();shows the MSN check controls GUICtrlSetState( $output, $GUI_SHOW) GUiCtrlSetState( $pinggraph1, $GUI_SHOW) GUiCtrlSetState( $pinggraph2, $GUI_SHOW) GUiCtrlSetState( $pinggraph3, $GUI_SHOW) GUiCtrlSetState( $pinggraph4, $GUI_SHOW) GUiCtrlSetState( $pinggraph5, $GUI_SHOW) GUiCtrlSetState( $ping1, $GUI_SHOW) GUiCtrlSetState( $ping2, $GUI_SHOW) GUiCtrlSetState( $ping3, $GUI_SHOW) GUiCtrlSetState( $ping4, $GUI_SHOW) GUiCtrlSetState( $ping5, $GUI_SHOW) GUiCtrlSetState( $pinglab1, $GUI_SHOW) GUiCtrlSetState( $pinglab2, $GUI_SHOW) GUiCtrlSetState( $pinglab3, $GUI_SHOW) GUiCtrlSetState( $pinglab4, $GUI_SHOW) GUiCtrlSetState( $pinglab5, $GUI_SHOW) GUiCtrlSetState( $pingbutton1, $GUI_SHOW) GUiCtrlSetState( $pingbutton2, $GUI_SHOW) GUiCtrlSetState( $pingbutton3, $GUI_SHOW) GUiCtrlSetState( $pingbutton4, $GUI_SHOW) GUiCtrlSetState( $pingbutton5, $GUI_SHOW) GUiCtrlSetState( $pinggroup, $GUI_SHOW) GUICtrlSetData( $output, "By order of a new legislation of privacy (2007) and influences from (certain) people, the computer MSN online check has been disabled. Soz and dont blame ME!") Endfunc func translation();shows the translation controls GUICtrlSetData( $prog, 20 ) GUICtrlSetState( $Main, $GUI_SHOW) GUICtrlSetState( $prog, $GUI_SHOW) GUICtrlSetData( $prog, 60 ) GUICtrlSetState( $Input1, $GUI_SHOW) GUICtrlSetState( $search, $GUI_SHOW) GUICtrlSetData( $prog, 90 ) GUICtrlSetState( $search2, $GUI_SHOW) GUICtrlSetState( $search4, $GUI_SHOW) GUICtrlSetState( $search5, $GUI_SHOW) GUICtrlSetState( $searchall, $GUI_SHOW) GUICtrlSetData( $prog, 95 ) GUICtrlSetState( $search3, $GUI_SHOW) GUICtrlSetState( $output, $GUI_HIDE) GUICtrlSetData( $prog, 100 ) Search() Sleep(500) _GUICtrlListViewScroll ($main, 0, 99236) EndFunc func detranslation();unshows (excuse grammar) the translation controls GUICtrlSetData( $prog, 20 ) GUICtrlSetState( $Main, $GUI_HIDE) GUICtrlSetData( $prog, 60 ) GUICtrlSetState( $Input1, $GUI_HIDE) GUICtrlSetState( $search, $GUI_HIDE) GUICtrlSetData( $prog, 90 ) GUICtrlSetState( $search2, $GUI_HIDE) GUICtrlSetState( $search4, $GUI_HIDE) GUICtrlSetState( $search5, $GUI_HIDE) GUICtrlSetState( $searchall, $GUI_HIDE) GUICtrlSetData( $prog, 95 ) GUICtrlSetState( $search3, $GUI_HIDE) GUICtrlSetState( $output, $GUI_SHOW) GUICtrlSetData( $prog, 100 ) GUICtrlSetState( $prog, $GUI_HIDE) Search() Sleep(500) _GUICtrlListViewScroll ($main, 0, 99236);scrolls to the last entry EndFunc Func Search() GUICtrlSetData( $prog, 20 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("French.qdf",$aRecords) Then error();checks if the transalator file exists For $count = 1 to $aRecords[0] step 1;searches for correct entries and displays them. also calculates progress $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236);scrolls to the last entry EndFunc Func Search2() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Italian.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func Search3() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("German.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func Search4() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Spanish.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func Search5() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Portuguese.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func Searchall() GUICtrlSetData( $prog, 10 ) _GUICtrlListViewDeleteAllItems( $main ) $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Portuguese.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Spanish.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("German.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("Italian.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next $terms = GuiCtrlREad( $input1 );reads the search terms If $terms = "" Then Return Endif $time = TimerInit( ) If Not _FileReadToArray("French.qdf",$aRecords) Then error() For $count = 1 to $aRecords[0] step 1 $result = 0 $result = StringInStr( $aRecords[$count], $terms) $percentdone = ($count/$aRecords[0])*100 $percentdone = Round(100*($percentdone/100),0 ) GUICtrlSetData( $prog, $percentdone ) If $result > 0 Then GUICtrlCreateListViewItem( $count & "|" & $aRecords[$count], $main ) Next _GUICtrlListViewScroll ($main, 0, 99236) EndFunc Func error() ProgressOn( "Error", "CRITICAL ERROR", "An error has occurred. The computer is annoyed") For $x = 0 to 100 step 1 ProgressSet( $x) Sleep(50) Next EndFunc A fully functional stable EXE with required files is found HERE Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now