Leaderboard
Popular Content
Showing content with the highest reputation on 01/24/2015 in all areas
-
Flash Player check for updates / versions
coffeeturtle reacted to Kyan for a topic
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]1 point -
TVmaze.com API UDF (TV-Series)
argumentum reacted to BBs19 for a topic
Hey guys, i wrote a small TVmaze.com API UDF for my TV-Show-Manager program. You can get any tv-show info you like with this UDF. Everything like tv-schedule, series info, cast list, episode list etc. including image links can be downloaded and will be returned in arrays. The API is way faster than for example tvrage.com. In case anyone ever needs it: Simple Example: #include "TVMazeAPI_UDF.au3" #include <Array.au3> ;===========TV Schedule for next 2 days========== $TV_Schedule=_GetTVSchedule() _ArrayDisplay($TV_Schedule,"TV Schedule") ;===============Search for a show================ $SearchResults=_SearchShow("person of interest") If @error then Exit _ArrayDisplay($SearchResults,"Searchresults") ;===============Get show info/details============ $ShowID=$SearchResults[0][1];Show id is taken from the searchresults first result $ShowInfo = _GetShowInfo($ShowID) _ArrayDisplay($ShowInfo,"Show Info") ;=============Get the cast of a show============= $Cast=_GetCast($ShowID) _ArrayDisplay($Cast,"Cast") ;============Get all Episodes of a Show========== $AllEpisodes = _GetShowEpisodes($ShowID) _ArrayDisplay($AllEpisodes,"All Episodes") ;========Filter Episodes by selected season====== $FilteredBySeason2 = _FilterBySeason($AllEpisodes, "2") _ArrayDisplay($FilteredBySeason2,"Filtered by episodes of season 2") ;====Get only last and next episode of a show==== $LastAndNextEpisode = _GetShowEpisodes($ShowID, 0, @TempDir, 0, 1) _ArrayDisplay($LastAndNextEpisode,"Last and Next Episodes only") Example usage(image): Updated 30.12.2015: - Bug fix TVMazeAPI_UDF.zip1 point -
boththose, _FileListToArrayRec uses an internal regex (created from the passed filter) to determine the return and I have often wondered whether to allow for a user defined regex in its place. Now the question has been raised I will look again at how it might be implemented. kylomas & JohnOne, From a future version of the Help file: Both Arrays and Maps use similar syntax, so care is required to ensure the variable is of the correct datatype - this is determined by the first declaration line for the variable: Using empty [ ] declares a Map: Local $vVar[] ; A Map Filling the [ ] with a dimension size declares an Array: Local $vVar[3] ; An Array Assigning element values when declaring makes the variable an Array - these three lines are functionally equivalent: Local $vVar[3] = [1, 2, 3] ; An Array Local $vVar[] = [1, 2, 3] ; An Array Local $vVar = [1, 2, 3] ; An Array M231 point
-
GuiBuilderNxt - Reboot [08/18/2016]
mesale0077 reacted to jaberwacky for a topic
Worked out some issues from last time. Made some progress on moving updown controls. dl: 261 point -
Tray Radio (Radio and MP3 player)
coffeeturtle reacted to SmOke_N for a topic
nend, Edit: Copy and pasted wrong post. The links were removed, topic was locked because the author (albeit his right) did not provide the source code for "example". While this is fine, I'll not have someone advertising their site by making the users go there to download an executable only download.1 point -
Multiprocessing UDF that likes same name of module in Python
argumentum reacted to oceanwaves for a topic
We all know Autoit has no threading concept. And I searched the forums, some peoples have written multiple process framework, but they look not very popular. Python support threading, but Python also have a module, it names multiprocessing. According to Python PEP: Python's GIL causes only one threading can be run at same time (CPython interpreter). So Python provide multiprocessing module, it is real parallel running. So I decide to simulate the Python's module and import into Autoit. It also my first UDF in forums. In shortly, I write 4 UDFs, Multiprocessing.au3, SimpleQueue.au3, SimpleSemaphore.au3 and SimpleLock.au3. Multiprocessing.au3 provides method that let your function will run in another process rather than main process. SimpleQueue.au3 provides a queue (FIFO) that can be used in IPC. SimpleLock.au3 as its name, if you familiar threading concept. Limitation: Pass Autoit type data into other process or queue, I use JSMN.au3 to data serialization. According to JSMN, multiple dimensions array, COM object and Dll struct etc. You can check at '?do=embed' frameborder='0' data-embedContent>> The UDFs has added at main script head also must add at Multiprocessing.au3. Another attention is please place Multiprocessing.au3 to end of #include, then Multiprocessing.au3 can find your what UDF need to use. Detailed information in these UDFs: When you include a UDF in your script, actually the UDF will run before your main script running. So I just determine the current process is main process or not (according to CmdLine[]). If it is main process, it will do some prepare action, pass your function parameter into memory then call the same script or exe --------child process. When child process startup, the Multiprocessing.au3 also running first and get parameter from memory, then use Autoit function Call(). This UDF also provide some methods to manger child process, it used MS jobs object to manager them. You can see the information at http://msdn.microsoft.com/en-us/library/windows/desktop/ms684161%28v=vs.85%29.aspx But interesting for this, A include B, B can find function in A but can't find other UDFs that are referred by A, so must add these UDF at B head. In attention, interpreters for 3.3.10.2 and 3.3.11.4 are different. Perhaps Autoit develop team can explain it, For SimpleQueue.au3, just using file mapping concept of MS, it also used JSMN.au3 to data serialization. Support data are limited by JSMN.au3. The queue is stored in file mapping. Set up a specific size memory and a lock, then each process can access it without conflict. SimpleLock.au3 and SimpleSemaphore.au3 can get detail information at MSDN. At last, I hope Autoit has own data serialization UDF that can support multiple dimension array and other can’t be supported by current JSMN.au3. If you find any bug, please point out to me, I’ll do my best to fix it. Sorry for my poor English. -----------------------History---------------------------------------- 2014.5.21. Update Multiprocessing.au3 ---- add new function AllSubProcess_Close Update SimpleSemaphore.au3 ---- add function head for each function and rewrite some function, remove redundant virables. Upload SimpleSemaphore_testing.au3 example. The example shows it has 3 semaphores and 6 child process wants to connect to a sqlite database, but I limit in same time maximum connection is 3, so if one child process has not gotten a semaphore, it must be waiting unless other child process release a semaphore. When you run the example script, maybe must know some standard SQLite UDF, you can check it on the Autoit help file. Multiprocessing.zip Multiprocessing_testing.zip Multiprocessing.au3 SimpleSemaphore.au3 SimpleSemaphore_testing.au31 point -
Update system date/time via HTTP (Firewall workaround)
ThomasLx reacted to TouchOdeath for a topic
I know this is an old thread, but I reworked the code to place everything in a func which changed globals to locals, and it returns the date/time in an array. so that way you can do 1 global variable array if one so desired. The missing backslashes are there. ;usage Global $currentdatetimearr = SetSysTime() ;or you could just do SetSysTime() without the global variable. func SetsysTime() ; For the ActiveTimeBias registry key: ; 4294967296 = 0 for UTC +X:YZ Time zones ; subtract value of key to get Time zone offset. ; EG: 4294976296-4294976236 = 60 = UTC +1:00; ; UTC Time zone uses 0 for the value; ; UTC -A:BC Time zones use the number of minutes of the offset ; EG: 480 = UTC -8:00; To-Do: ; 1. Add a timezone check to make sure the system is properly configured for its area ; EG: Time Zone is currently "Pacific Standard Time", is this correct? [Y/N] ; 2. Add error checking to _EndOfMonth() should the need arise [user editing of code] ; EG: -2 is not a valid month, you silly goose! ; ---------------------------------------------------------------------------------------------------------------------------------- ; Get Time from HTTP server (Defaults to google.com ... pool.ntp.org is a good alternative) ; ---------------------------------------------------------------------------------------------------------------------------------- $site = "www.google.com" $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", "http://" & $site & "/", False) $oHTTP.Send() $date = $oHTTP.GetResponseHeader("Date") ; ---------------------------------------------------------------------------------------------------------------------------------- ; ---------------------------------------------------------------------------------------------------------------------------------- ; ---------------------------------------------------------------------------------------------------------------------------------- ; Set Global variables used throughout the script ; ---------------------------------------------------------------------------------------------------------------------------------- ; $tzo: timezoneOffset (the number of hours by which the local machine varies from UTC) Local $tzo = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation", "ActiveTimeBias"), _ $y = StringMid($date, 13, 4), _ ; The current year $m = StringMid($date, 9, 3), _ ; The current month $d = StringMid($date, 6, 2), _ ; The current day of month $h = StringMid($date, 18, 2), _ ; The current hour $n = StringMid($date, 21, 2), _ ; The current minute $s = StringMid($date, 24, 2) ; The current second If $tzo < 1500 Then $tzo /= -60 Else $tzo = (4294967296 - $tzo) / 60 EndIf ; ---------------------------------------------------------------------------------------------------------------------------------- ; ---------------------------------------------------------------------------------------------------------------------------------- ; ---------------------------------------------------------------------------------------------------------------------------------- ; Calculate Time zone changes (correct the hour/day/month/year based on timezone/hour/day/month changes ; ---------------------------------------------------------------------------------------------------------------------------------- $h += $tzo ; Set the local hour based on offset from UTC Select ; If the hour changes day forward/backward, correct appropriate values. Case $h >= 24 $d += 1 $h -= 24 Case $h < 0 $d -= 1 $h += 24 EndSelect Switch $m Case 'JAN'; 31 days in month $m = 1 Case 'FEB'; 28/29 days in month $m = 2 Case 'MAR' ; 31 days in month $m = 3 Case 'APR'; 30 days in month $m = 4 Case 'MAY'; 31 days in month $m = 5 Case 'JUN' ; 30 days in month $m = 6 Case 'JUL' ; 31 days in month $m = 7 Case 'AUG' ; 31 days in month $m = 8 Case 'SEP' ; 30 days in month $m = 9 Case 'OCT' ; 31 days in month $m = 10 Case 'NOV' ; 30 days in month $m = 11 Case 'DEC' ; 31 days in month $m = 12 EndSwitch Local $epm = _EndOfMonth($m - 1), _ ; The last day of the previous month (28-31) $ecm = _EndOfMonth($m) ; The last day of the current month (28-31); Correct value for $tzo from the registry value to a +/- number of hours Switch $d ; If the day changes month forward/backward, correct appropriate values. Case $ecm + 1 $m += 1 $d = 1 Case 0 $m -= 1 $d = $epm EndSwitch Switch $m ; If the month changes year forward/backward, correct appropriate values. Case 0 $m = 12 $d = 31 $y -= 1 Case 13 $m = 1 $d = 1 $y += 1 EndSwitch ; ---------------------------------------------------------------------------------------------------------------------------------- ; ---------------------------------------------------------------------------------------------------------------------------------- ; ---------------------------------------------------------------------------------------------------------------------------------- ; Set system date/time using functions from #include ; ---------------------------------------------------------------------------------------------------------------------------------- _SetDate($d, $m, $y) _SetTime($h, $n, $s) local $sysdatetime[6] $sysdatetime[0] = $m $sysdatetime[1] = $d $sysdatetime[2] = $y $sysdatetime[3] = $h $sysdatetime[4] = $n $sysdatetime[5] = $s Return $sysdatetime ; ---------------------------------------------------------------------------------------------------------------------------------- ; ---------------------------------------------------------------------------------------------------------------------------------- ; ---------------------------------------------------------------------------------------------------------------------------------- ; FUNCTION: _EndOfMonth ::: Determine the ending date of the month (28, 29, 30, or 31) ; ---------------------------------------------------------------------------------------------------------------------------------- EndFunc Func _EndOfMonth($vMON) Local $end Switch $vMON Case 0, 1, 3, 5, 7, 8, 10, 12, 13 $end = 31 Case 4, 6, 9, 11 $end = 30 Case 2 If IsInt(@YEAR / 4) Then $end = 29 Else $end = 28 EndIf Case Else SetError(-1) Return (0) EndSwitch Return ($end) EndFunc ;==>_EndOfMonth1 point -
_WinAPI_CreateGUID from WinAPIEx and it's uniqueness.
argumentum reacted to guinness for a topic
A globally unique identifier (GUID) is a unique reference number used as an identifier in computer software. The chance of 2 GUIDs being generated is highly unlikely, though not impossible. Source: https://en.wikipedia.org/wiki/Globally_unique_identifier #include <Array.au3> #include <StringConstants.au3> #include <WinAPICom.au3> Example() Func Example() Local $aArray[1000] For $i = 0 To UBound($aArray) - 1 $aArray[$i] = _WinAPI_CreateGUID() Next Local $hTimer = TimerInit() Local $bReturn = _ArrayUniqueFast($aArray, True) ; The standard _ArrayUnqiue() is very slow when using large arrays. ConsoleWrite('Time: ' & TimerDiff($hTimer) & @CRLF) ConsoleWrite('Return: ' & $bReturn & @CRLF) _ArrayDisplay($aArray) ; The last index should be 9999. This shows that _WinAPI_CreateGUID is unique. EndFunc ;==>Example Func _ArrayUniqueFast(ByRef $aArray, $bIsCaseSensitive = False) Local Const $AUF_DELIM = ChrW(160), $AUF_LENGTH = 2, $AUF_LOCAL = 1 Local $sOutput = '', $sString = '' For $i = 0 To UBound($aArray) - 1 $sString = StringTrimLeft(StringToBinary($bIsCaseSensitive ? $aArray[$i] : StringLower($aArray[$i])), $AUF_LENGTH) If Not IsDeclared($sString) Then Assign($sString, 0, $AUF_LOCAL) $sOutput &= $aArray[$i] & $AUF_DELIM EndIf Next $sOutput = StringTrimRight($sOutput, StringLen($AUF_DELIM)) $aArray = StringSplit($sOutput, $AUF_DELIM, BitOR($STR_ENTIRESPLIT, $STR_NOCOUNT)) If @error Then Local $aTemp[0] $aArray = $aTemp EndIf Return UBound($aArray) > 0 EndFunc ;==>_ArrayUniqueFast1 point -
A few simple BitBlt effects (melt your screen etc.)
argumentum reacted to minxomat for a topic
As it says on the box (in the title). Choose the effect by changing the effect number. Disable Blt acceleration if needed. 3d.au31 point -
Schedule system
argumentum reacted to nitekram for a topic
Yes, I know it is an old thread, but thought I would update this post, in case anyone else gets here and wants to try it out. You have to add the following two includes... #include <StaticConstants.au3> #include <WindowsConstants.au3> You also have to download this UDF (GUICtrlOnHover.au3), and put it in the same location as the includes, or the location of your script, as it is not included otherwise... '?do=embed' frameborder='0' data-embedContent>>1 point