Jump to content

Search the Community

Showing results for tags 'update'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 10 results

  1. Hi, I created a gui with date field but formatted as time in HH:mm. It always shows "now-time". Even if I try to set it with GUICtrlSetData. #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("My GUI get date", 200, 200, 800, 200) Local $idDate = GUICtrlCreateDate("", 20, 20, 100, 20, $DTS_TIMEFORMAT) ; to select a specific default format Local $sStyle = "HH:mm" ; Just display hours and minutes <<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSendMsg($idDate, $DTM_SETFORMATW, 0, $sStyle) ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUICtrlSetData($idDate, "00:00") ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUISetState(@SW_SHOW) ; Loop until the user exits. While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd MsgBox($MB_SYSTEMMODAL, "Time", GUICtrlRead($idDate)) EndFunc ;==>Example How can I set the time field with another time and how can this field be set blank? Regards, Conrad
  2. Include this script to your actual project and when SUP_Check() is called your script is going to download the next version and self update him self then restart. I am sorry but i did not bother to make a UDF or a more user friendly and flexible module since i still have a lot to go on my initial project 1- inside your project you include thoses line , all together and before your script actual code, beside your log system if you have one #include "self_update.au3" SUP_SetLogCallBack("_log") ; optional , used to send log to your allready log system if success self loggin is disable SUP_SetCheckCallBack("SUP_DownloadProgress") ; optional , will send the % of the download in progress SUP_Start("VALID HTTP URL To YPOUR NEW FILE","DOWNLOAD FULL FILE PATH NAME") ; mandatory 2- Now anywhere in your script you call this line to check for a newer version $fileVersionUrl: is if your using a custom web page to send fast information on the file like version that optional, if empty will always update when check $parentGui="": the self updated will create a gui with a progress bar and try to attach it self to the $parentGui , that optional SUP_Check($fileVersionUrl="",$parentGui="") 3- to check if your script has just restarted after a update if IsDeclared("updateComplete") then ConsoleWrite("Update Complete Sucess Bravo!") endif File: SUP_SelfUpdate.au3 The script can be compiled alone for debug purpose , look for 1 line to uncomment inside the script if running alone #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=e:SelfUpdate.exe #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include-once ;*************** Line to be use inside your own project************ ; ;~ #include "self_update.au3" ;~ SUP_SetLogCallBack("_log") ;~ SUP_SetCheckCallBack("SUP_DownloadProgress") ;~ SUP_Start("e:SelfUpdate_FF.exe",@TempDir&"SelfUpdate_FF.exe") ; ;******************************************************************* Global $SUP_LOGS_CALL[1] = [0] Global $SUP_DOWN_CALL[1] = [0] Global $SUP_URL Global $SUP_FILE Global $SUP_INFO_FILE Global $SUP_DEST_FILE Global $SUP_PID ;**************Uncomment to self debug that script alone************* ;~ SUP_Start(@ScriptDir&"SelfUpdate.exe",@TempDir&"SelfUpdate.exe") ;******************************************************************** Func SUP_Start($SUPURL,$SUPFILE) $SUP_URL = $SUPURL $SUP_FILE = $SUPFILE $SUP_INFO_FILE = $SUP_FILE&".info" if $CmdLine[0] > 0 Then Switch $CmdLine[1] case "update" SUP_InitInfo() if Not ProcessWaitClose($SUP_PID,30) Then SUP_Log("UPDATE - Could not complete since """&$SUP_DEST_FILE&""" will not close",false) Exit EndIf if Not FileCopy($SUP_FILE,$SUP_DEST_FILE,1) Then SUP_Log("UPDATE - Could not copy the new file to """&$SUP_DEST_FILE&"""",false) Exit EndIf Run($SUP_DEST_FILE&" updatecomplete") exit case "updatecomplete" SUP_Delete() ;~ SUP_Log("UPDATE - Complete sucess") Assign("updateComplete",true,2) EndSwitch ;~ Else ;~ SUP_Check() ;for testing to be remove when linked with main EndIf ;~ sleep(5000) EndFunc Func SUP_InitInfo() local $data = FileRead($SUP_INFO_FILE) $data = StringSplit($data,"|") if $data[0] <> 2 Or $data[1]="" or $data[2] = "" Then SUP_Log("UPDATE - Info File is invalid") sleep(4000) exit EndIf $SUP_PID = $data[1] $SUP_DEST_FILE = $data[2] EndFunc Func SUP_Delete() FileDelete($SUP_FILE) FileDelete($SUP_INFO_FILE) EndFunc Func SUP_SetCheckCallBack($funcCallBack) ReDim $SUP_DOWN_CALL[$SUP_DOWN_CALL[0]+2] $SUP_DOWN_CALL[0] += 1 $SUP_DOWN_CALL[$SUP_DOWN_CALL[0]] = $funcCallBack EndFunc Func SUP_Check($fileVersionUrl="",$parentGui="") ;~ if $RUN then return local $version = FileGetVersion(@AutoItExe) local $nextVersion = "always update" if $fileVersionUrl <> "" Then $nextVersion = BinaryToString(InetRead($fileVersionUrl,1)) ;~ SUP_Log($version&" "&$nextVersion) if $nextVersion = "" Or $version = $nextVersion Then SUP_Log("UPDATE - No new version found") Return EndIf SUP_Log("UPDATE - New version found") SUP_Log("UPDATE - Downloading version "&$nextVersion) local $size = InetGetSize($SUP_URL,1) FileDelete($SUP_FILE) local $handle = InetGet($SUP_URL,$SUP_FILE,1,1) local $byteRead, $error = false #include <WindowsConstants.au3> GUICreate("ProgressBar",200,30,-1,-1,BitOR($WS_MINIMIZEBOX,$WS_DLGFRAME,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS), BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST),$parentGui) local $progress = GUICtrlCreateProgress(0,0,200,30) GUISetState(@SW_SHOW) local $pct do Sleep(250) $byteRead = InetGetInfo($handle, 0) if @error Then $error = true ExitLoop EndIf GUICtrlSetData($progress,$byteRead*100/$size) $pct = Round($byteRead*100/$size,2) SUP_Log("UPDATE - Percent done: "&$pct) If $SUP_DOWN_CALL[0] > 0 Then For $i = 1 to $SUP_DOWN_CALL[0] Call($SUP_DOWN_CALL[$i],$pct) Next EndIf Until InetGetInfo($handle, 2) GUIDelete() if $error or Not InetGetInfo($handle,3) Then InetClose($handle) SUP_Log("UPDATE - Downloading next version failed") SUP_Delete() Return EndIf InetClose($handle) FileDelete($SUP_INFO_FILE) FileWrite($SUP_INFO_FILE,@AutoItPID&"|"&@ScriptFullPath) SUP_Log("UPDATE - Exiting to complete update") Run($SUP_FILE&" update") if @error Then SUP_Log("UPDATE - Unable to open the new file") SUP_Delete() Return endif SUP_Log("UPDATE - Exiting") sleep(1000) Exit EndFunc Func SUP_SetLogCallBack($funcCallBack) ReDim $SUP_LOGS_CALL[$SUP_LOGS_CALL[0]+2] $SUP_LOGS_CALL[0] += 1 $SUP_LOGS_CALL[$SUP_LOGS_CALL[0]] = $funcCallBack EndFunc Func SUP_Log($msg,$useCallBack=true) If $useCallBack And $SUP_LOGS_CALL[0] > 0 Then For $i = 1 to $SUP_LOGS_CALL[0] Call($SUP_LOGS_CALL[$i],$msg) Next Return EndIf if @Compiled Then MsgBox(0,"Message",$msg) ConsoleWrite($msg&@CRLF) EndFunc
  3. Hi, made this, may come handy to someone ^^ #Code with comments #NoTrayIcon Global $b = "http://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player", $url[3] = [$b & "_ax.exe", $b & ".exe", $b & "_ppapi.exe"] HttpSetUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36") ;Just trying to fit in Global $expectSameTableOrder = 0 ;WebSite table order may change, so use this as time concious setting $cur = _CurVer() ;Grabs the lastest versions available from adobe's website $ver = _GetFlashVersions() ;Grabs installed versions from the registry ;compare the versions For $x = 0 To 2 ;UBound($ver)-1 Local $idx = 0, $_match = 0 If $expectSameTableOrder Then $_match = 1 $idx = $x + 1 Else Do $_match = StringInStr($cur[$idx][1], $ver[$x][1]) $idx += 1 Until ($idx > (UBound($cur) - 1)) Or ($_match > 0) EndIf If $ver[$x][0] = "" Then $_match=0 If $_match > 0 Then If _VersionCompare($cur[$idx - 1][0], $ver[$x][0]) = 1 Then ;// outdated download url is $url[$x] ConsoleWrite("[Lastest:" & $cur[$x][0] & "|Installed:" & $ver[$x][0] & "]" & @TAB & $cur[$x][1] & " its outdated!" & @LF) EndIf EndIf Next Exit Func _CurVer() ;[0]ActiveX (IE) [1]NPAPI (firefox) [2]PPAPI (chrome/opera) Local $__page = BinaryToString(InetRead("https://www.adobe.com/software/flash/about/", 3), 4) Local $__rex = StringRegExp($__page, '(?s)(?:<td[^>]*>(.*?)(?:\\|</td>))', 3) ;_ArrayDisplay($__rex) Local $__ret[1][2], $_skip = 0 If @OSBuild >= 9200 Then $_skip = 1 For $x = 1 To 8 Step 2 If Not (($x = 1 And $_skip) Or ($x = 3 And Not $_skip)) Then $p = UBound($__ret) If $x < 6 Then ReDim $__ret[$p + 1][2] $__ret[$p - 1][1] = $__rex[$x] $__ret[$p - 1][0] = $__rex[$x + 1] EndIf Next Return $__ret EndFunc ;==>_CurVer Func _GetFlashVersions() Local $__fpver[3][2] = [['', "ActiveX"], ['', "PPAPI"], ['', "NPAPI"]] $__fpver[0][0] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Macromedia\FlashPlayerActiveX", "Version") ;IE $__fpver[1][0] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Macromedia\FlashPlayerPlugin", "Version") ;Firefox $__fpver[2][0] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Macromedia\FlashPlayerPepper", "Version") ;Chrome/opera Return $__fpver EndFunc ;==>_GetFlashVersions Func _VersionCompare($sVersion1, $sVersion2) If $sVersion1 = $sVersion2 Then Return 0 Local $aVersion1 = StringSplit($sVersion1, ".,"), _ $aVersion2 = StringSplit($sVersion2, ".,") If UBound($aVersion1) <> UBound($aVersion2) Or UBound($aVersion1) = 0 Then ; Compare as Strings If $sVersion1 > $sVersion2 Then Return SetExtended(1, 1) ; @extended set to 1 for string comparison. ElseIf $sVersion1 < $sVersion2 Then Return SetExtended(1, -1) ; @extended set to 1 for string comparison. EndIf Else For $i = 1 To UBound($aVersion1) - 1 ; Compare this segment as numbers If StringIsDigit($aVersion1[$i]) And StringIsDigit($aVersion2[$i]) And _ StringLen($aVersion1[$i]) = StringLen($aVersion2[$i]) Then ; <<<<<<<<<<<<<<<<<<<<<< If Number($aVersion1[$i]) > Number($aVersion2[$i]) Then Return SetExtended(2, 1) ; @extended set to 2 for number comparison. ElseIf Number($aVersion1[$i]) < Number($aVersion2[$i]) Then Return SetExtended(2, -1) ; @extended set to 2 for number comparison. EndIf Else ; Compare the segment as strings If $aVersion1[$i] > $aVersion2[$i] Then Return SetExtended(1, 1) ; @extended set to 1 for string comparison. ElseIf $aVersion1[$i] < $aVersion2[$i] Then Return SetExtended(1, -1) ; @extended set to 1 for string comparison. EndIf EndIf Next EndIf ; This point should never be reached Return SetError(2, 0, 0) EndFunc ;==>_VersionCompare Thanks to @jguinch for helping me with the regex EDIT1: Code updated, now skips inexistent installations, added $expectSameTableOrder for timewise routines, _VersionCompare fixed (didn't add "= 1" in the if statement,now seems to be working fine For someone looking for a GUI http://pxc-coding.com/portfolio/alternative-flash-player-auto-updater/ [Not mine]
  4. Hi... I am trying to add a record in Binary Table in an MSI file. As Binary table has two fields/columns Name &Data , I am giving any string for Name(column 1) and streaming binary data from a VBS file into Data(column 2) . I have tried with VB script and it is working fine, Here is the VB Script file Dim Installer Dim Database Dim View Dim Record Dim query query="INSERT INTO `Binary` (`Name`, `Data`) VALUES ('NewBlob', ?)" Set Installer = CreateObject("WindowsInstaller.Installer") Set Record = Installer.CreateRecord(1) Record.SetStream 1, "C:\Users\Admin\Desktop\coder\CA_Test.vbs" Set Database = Installer.OpenDatabase("C:\Users\Admin\Desktop\7z920.msi", 1) Set View = Database.OpenView(query) View.Execute Record Database.Commit when i tried the same thing in autoit it is not working and it is not giving any syntax error. AutoIt file: #include <File.au3> $idVarInput_CAName="CA_Test" $filepath="C:\Users\Admin\Desktop\coder\CA_Test.vbs" $idVarInput_MSIPath="C:\Users\Admin\Desktop\7z920.msi" $value="?" Local $Query = "INSERT INTO Binary(Name,Data) VALUES('" & $idVarInput_CAName & "','" & $value & "')" $oInstaller = ObjCreate("WindowsInstaller.Installer") $oRec=$oInstaller.CreateRecord(1) $r=$oRec.SetStream(1,$filepath) $oDB = $oInstaller.OpenDataBase($idVarInput_MSIPath,1) $oView = $oDB.OpenView($Query) $oView.Execute($oRec) $oDB.commit() Please Help! Thanks...
  5. Hello, Im using GUICtrlCreateListView to make table with items. But when it is new item with same first column a want just update allready existing row. Its posible? I cant figure it, if its better use other funkcion pls. tell me. Thank
  6. AutoIt&SciTEUpdater v1.0.2.1.au3 External files are included in script. If UAC Enable, Run as Admin the first time. Previous downloads : 611 Source : AutoItAndSciTEUpdater v1.0.2.1.au3 Executable : AutoIt&SciTEUpdater.exe For never miss AutoIt (Release/Beta) and SciTE4AutoIt3 updates.
  7. Hi guys, I'm using this startup example to allow the program menu to insert an option to "AutoStart" the script. What I'd like to do is update the checkbox of the menu item after they click it to then reflect the "AutoStart" state (on or off). How do I update the menu on the event someone clicks the menu option? The registry is updating correctly, and if I close and re-run the script the menu is updated, but not in the same script execution. I wasn't sure with TrayItemSetState for my "Func AutoStart()" Function what the "controlID" was. I tried 0 through to 3 and "AutoStart" text. Perhaps this is where I'm going wrong? ; Add custom tray icon menu #NoTrayIcon #include <MsgBoxConstants.au3> #include <TrayConstants.au3> Opt("TrayMenuMode", 3) Opt("TrayOnEventMode", 1) #include '_Startup.au3' TrayCreateItem("AutoStart") TrayItemSetOnEvent(-1, "AutoStart") If _StartupRegistry_Exists() Then TrayItemSetState(-1, $TRAY_CHECKED) Else TrayItemSetState(-1, $TRAY_UNCHECKED) EndIf TrayCreateItem("About") TrayItemSetOnEvent(-1, "About") TrayCreateItem("") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "ExitScript") TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "About") TraySetState($TRAY_ICONSTATE_SHOW) ; ################## ; ### OTHER CODE ### ; ################## Func About() MsgBox(0,"About","etc") EndFunc Func AutoStart() If _StartupRegistry_Exists() Then _StartupRegistry_Uninstall() TrayItemSetState("AutoStart", $TRAY_UNCHECKED) Else _StartupRegistry_Install() TrayItemSetState("AutoStart", $TRAY_CHECKED) EndIf EndFunc Func ExitScript() Exit EndFuncThanks!
  8. Sorry, this is my fourth thread for support today.... Please can you can explain me how to run a function every 3 minutes in the code snippet below? $GUI = GUICreate("GUI",350,350,-1,-1,-1,-1) GUISetState(@SW_SHOW, $GUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Thanks in Advance
  9. So i have been trying to find a way to auto update my SVN repo whenever someone commit a new file I found this commandline from google and i can get that to work with autoit np CD C:\Program Files\TortoiseSVN\bin\ START TortoiseProc.exe /command:update /path:"C:\www\MyRepo\" /closeonend:0 But what i want is everytime someone commits something and my repo aint the newest version, i want it to run the commandline. I tried googling and can't find anything is this even possible, if it is how? can you get the newest version with a command line to and compare it to your own version maybe ? Thanks
  10. Could anyone tell me the best way to sort my champion list as soon as i move one from the right list to the left list. At this point i tried to work with the array.au3 without succes. Here is my code. Global $sbselectform, $sbtargetlist, $sbtemplist1, $sbtemplist2 = "", $sbtemplist3, $sbtemplist2r, $sbaddbtn, $sbrembtn, $sbresetbtn, $sbokbtn, $sbmsg, $sbsourcelist, $sbsourcelistr, $sbchamplabel, $sbbanlabel $sbsourcelist = 'Aatrox|Ahri|Akali|Alistar|Amumu|Anivia|Annie|Ashe|Blitzcrank|Brand|Caitlyn|Cassiopeia|Cho''Gath|Corki|Darius|Diana|Dr. Mundo|Draven|Elise|Evelynn|Ezreal|Fiddlesticks|Fiora|Fizz|Galio|Gangplank|Garen|Gragas|Graves|Hecarim|Heimerdinger|Irelia|Janna|Jarvan IV|Jax|Jayce|Jinx|Karma|Karthus|Kassadin|Katarina|Kayle|Kennen|Kha''Zix|Kog''Maw|LeBlanc|Lee Sin|Leona|Lissandra|Lucian|Lulu|Lux|Malphite|Malzahar|Maokai|Master Yi|Miss Fortune|Mordekaiser|Morgana|Nami|Nasus|Nautilus|Nidalee|Nocturne|Nunu|Olaf|Orianna|Pantheon|Poppy|Quinn|Rammus|Renekton|Rengar|Riven|Rumble|Ryze|Sejuani|Shaco|Shen|Shyvana|Singed|Sion|Sivir|Skarner|Sona|Soraka|Swain|Syndra|Talon|Taric|Teemo|Thresh|Tristana|Trundle|Tryndamere|Twisted Fate|Twitch|Udyr|Urgot|Varus|Vayne|Veigar|Vi|Viktor|Vladimir|Volibear|Warwick|Wukong|Xerath|Xin Zhao|Yasuo|Yorick|Zac|Zed|Ziggs|Zilean|Zyra|' $sbtemplist2 = IniRead("banlist.ini", "Settings", "banlist", "") If $sbtemplist2 <> "" Then ;~ dump($sbtemplist2) $sbtemplist3 = StringTrimRight($sbtemplist2, 1) Local $sbremlist = StringSplit($sbtemplist3, '|') For $iCount = 1 To UBound($sbremlist) - 1 $sbsourcelist = StringReplace($sbsourcelist, $sbremlist[$iCount] & "|", "") ;~ dump($sbremlist[$iCount]) Next EndIf $sbsourcelistr = $sbsourcelist $sbtemplist2r = $sbtemplist2 $sbselectform = GUICreate("Ban list for Draft/Ranked mode", 335, 275, 227, 154) $sbchamplabel = GUICtrlCreateLabel("Champion List", 15, 15, 129, 15) $sbtemplist1 = GUICtrlCreateList("", 15, 32, 129, 227, 0x00200001) GUICtrlSetData($sbtemplist1, $sbsourcelist) $sbaddbtn = GUICtrlCreateButton(">>", 152, 40, 25, 25, 0) $sbrembtn = GUICtrlCreateButton("<<", 152, 70, 25, 25, 0) ;~ $sbresetbtn = GUICtrlCreateButton("C", 152, 189, 25, 25, 0) $sbokbtn = GUICtrlCreateButton("Ok", 152, 219, 25, 25, 0) $sbbanlabel = GUICtrlCreateLabel("Ban List", 185, 15, 129, 15) $sbtargetlist = GUICtrlCreateList("", 185, 32, 129, 227, 0x00200001) GUICtrlSetData($sbtargetlist, $sbtemplist2) GUICtrlSetState($sbokbtn, 256) GUISetState(@SW_SHOW) While 1 $sbmsg = GUIGetMsg() Select Case $sbmsg = $sbaddbtn If GUICtrlRead($sbtemplist1) == "" Then MsgBox(0, "", "select from left list before adding...") Else If (UBound(StringSplit($sbtemplist2, '|')) - 1) <= 9 Then $sbtemplist2 &= GUICtrlRead($sbtemplist1) & "|" $sbsourcelist = sbmove($sbtemplist1, $sbtargetlist, $sbsourcelist, GUICtrlRead($sbtemplist1)) Else MsgBox(0, "", "max 9") EndIf EndIf Case $sbmsg = $sbrembtn If GUICtrlRead($sbtargetlist) == "" Then MsgBox(0, "", "select from right list before removing...") Else $sbsourcelist = $sbsourcelist & GUICtrlRead($sbtargetlist) & "|" ;~ Local $sbremlist = StringSplit($sbsourcelist, '|') ;~ _ArraySort($sbremlist) ;~ $sbsourcelist = "" ;~ For $iCount = 1 To UBound($sbremlist) - 1 ;~ $sbsourcelist &= $sbremlist[$iCount] & "|" ;~ Next $sbtemplist2 = sbmove($sbtargetlist, $sbtemplist1, $sbtemplist2, GUICtrlRead($sbtargetlist)) EndIf ;~ Case $sbmsg = $sbresetbtn ;~ GUICtrlDelete($sbtemplist1) ;~ GUICtrlDelete($sbtargetlist) ;~ $sbtemplist1 = GUICtrlCreateList("", 15, 32, 129, 227, 0x00200001) ;~ GUICtrlSetData($sbtemplist1, $sbsourcelistr) ;~ $sbtargetlist = GUICtrlCreateList("", 185, 32, 129, 227, 0x00200001) ;~ GUICtrlSetData($sbtargetlist, $sbtemplist2r) Case $sbmsg = $sbokbtn IniWrite("banlist.ini", "Settings", "banlist", $sbtemplist2) ;~ MsgBox(64, "boob", $sbtargetlist) ExitLoop Case $sbmsg = -3 ExitLoop Case Else EndSelect WEnd Func sbmove($sbmove1, $sbmove2, $sbmove3, $sbmove4) Local $sbmove5 = StringSplit($sbmove3, '|'), $sbmove6 = '' For $iCount = 1 To UBound($sbmove5) - 1 If $sbmove5[$iCount] <> $sbmove4 And $sbmove5[$iCount] <> '' Then $sbmove6 &= $sbmove5[$iCount] & '|' EndIf Next GUICtrlSetData($sbmove1, '') GUICtrlSetData($sbmove1, $sbmove6) GUICtrlSetData($sbmove2, $sbmove4) Return $sbmove6 EndFunc ;==>sbmove Func dump($a) MsgBox(0, "", $a) EndFunc ;==>dump Func _ArraySort(ByRef $avArray, $iDescending = 0, $iStart = 0, $iEnd = 0, $iSubItem = 0) If Not IsArray($avArray) Then Return SetError(1, 0, 0) Local $iUBound = UBound($avArray) - 1 If $iEnd < 1 Or $iEnd > $iUBound Then $iEnd = $iUBound If $iStart < 0 Then $iStart = 0 If $iStart > $iEnd Then Return SetError(2, 0, 0) Switch UBound($avArray, 0) Case 1 __ArrayQuickSort1D($avArray, $iStart, $iEnd) If $iDescending Then _ArrayReverse($avArray, $iStart, $iEnd) Case 2 Local $iSubMax = UBound($avArray, 2) - 1 If $iSubItem > $iSubMax Then Return SetError(3, 0, 0) If $iDescending Then $iDescending = -1 Else $iDescending = 1 EndIf __ArrayQuickSort2D($avArray, $iDescending, $iStart, $iEnd, $iSubItem, $iSubMax) Case Else Return SetError(4, 0, 0) EndSwitch Return 1 EndFunc ;==>_ArraySort Func _ArrayReverse(ByRef $avArray, $iStart = 0, $iEnd = 0) If Not IsArray($avArray) Then Return SetError(1, 0, 0) If UBound($avArray, 0) <> 1 Then Return SetError(3, 0, 0) Local $vTmp, $iUBound = UBound($avArray) - 1 If $iEnd < 1 Or $iEnd > $iUBound Then $iEnd = $iUBound If $iStart < 0 Then $iStart = 0 If $iStart > $iEnd Then Return SetError(2, 0, 0) For $i = $iStart To Int(($iStart + $iEnd - 1) / 2) $vTmp = $avArray[$i] $avArray[$i] = $avArray[$iEnd] $avArray[$iEnd] = $vTmp $iEnd -= 1 Next Return 1 EndFunc ;==>_ArrayReverse Func __ArrayQuickSort1D(ByRef $avArray, ByRef $iStart, ByRef $iEnd) If $iEnd <= $iStart Then Return Local $vTmp If ($iEnd - $iStart) < 15 Then Local $vCur For $i = $iStart + 1 To $iEnd $vTmp = $avArray[$i] If IsNumber($vTmp) Then For $j = $i - 1 To $iStart Step -1 $vCur = $avArray[$j] If ($vTmp >= $vCur And IsNumber($vCur)) Or (Not IsNumber($vCur) And StringCompare($vTmp, $vCur) >= 0) Then ExitLoop $avArray[$j + 1] = $vCur Next Else For $j = $i - 1 To $iStart Step -1 If (StringCompare($vTmp, $avArray[$j]) >= 0) Then ExitLoop $avArray[$j + 1] = $avArray[$j] Next EndIf $avArray[$j + 1] = $vTmp Next Return EndIf Local $L = $iStart, $R = $iEnd, $vPivot = $avArray[Int(($iStart + $iEnd) / 2)], $fNum = IsNumber($vPivot) Do If $fNum Then While ($avArray[$L] < $vPivot And IsNumber($avArray[$L])) Or (Not IsNumber($avArray[$L]) And StringCompare($avArray[$L], $vPivot) < 0) $L += 1 WEnd While ($avArray[$R] > $vPivot And IsNumber($avArray[$R])) Or (Not IsNumber($avArray[$R]) And StringCompare($avArray[$R], $vPivot) > 0) $R -= 1 WEnd Else While (StringCompare($avArray[$L], $vPivot) < 0) $L += 1 WEnd While (StringCompare($avArray[$R], $vPivot) > 0) $R -= 1 WEnd EndIf If $L <= $R Then $vTmp = $avArray[$L] $avArray[$L] = $avArray[$R] $avArray[$R] = $vTmp $L += 1 $R -= 1 EndIf Until $L > $R __ArrayQuickSort1D($avArray, $iStart, $R) __ArrayQuickSort1D($avArray, $L, $iEnd) EndFunc ;==>__ArrayQuickSort1D Func __ArrayQuickSort2D(ByRef $avArray, ByRef $iStep, ByRef $iStart, ByRef $iEnd, ByRef $iSubItem, ByRef $iSubMax) If $iEnd <= $iStart Then Return Local $vTmp, $L = $iStart, $R = $iEnd, $vPivot = $avArray[Int(($iStart + $iEnd) / 2)][$iSubItem], $fNum = IsNumber($vPivot) Do If $fNum Then While ($iStep * ($avArray[$L][$iSubItem] - $vPivot) < 0 And IsNumber($avArray[$L][$iSubItem])) Or (Not IsNumber($avArray[$L][$iSubItem]) And $iStep * StringCompare($avArray[$L][$iSubItem], $vPivot) < 0) $L += 1 WEnd While ($iStep * ($avArray[$R][$iSubItem] - $vPivot) > 0 And IsNumber($avArray[$R][$iSubItem])) Or (Not IsNumber($avArray[$R][$iSubItem]) And $iStep * StringCompare($avArray[$R][$iSubItem], $vPivot) > 0) $R -= 1 WEnd Else While ($iStep * StringCompare($avArray[$L][$iSubItem], $vPivot) < 0) $L += 1 WEnd While ($iStep * StringCompare($avArray[$R][$iSubItem], $vPivot) > 0) $R -= 1 WEnd EndIf If $L <= $R Then For $i = 0 To $iSubMax $vTmp = $avArray[$L][$i] $avArray[$L][$i] = $avArray[$R][$i] $avArray[$R][$i] = $vTmp Next $L += 1 $R -= 1 EndIf Until $L > $R __ArrayQuickSort2D($avArray, $iStep, $iStart, $R, $iSubItem, $iSubMax) __ArrayQuickSort2D($avArray, $iStep, $L, $iEnd, $iSubItem, $iSubMax) EndFunc ;==>__ArrayQuickSort2D
×
×
  • Create New...