Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/19/2014 in all areas

  1. guinness

    GUIEvents

    How I use WM_MESSAGES efficiently. If someone wants a better example then let me know. Thanks. #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global Enum $GUI_ACTION_LCLIENT, $GUI_ACTION_RCLIENT, $GUI_ACTION_LTITLE ; An enumeration of possible actions. Global $g_iActionCommand = -1 ; Create a single global variable to store a dummy control. Example() Func Example() ; When using WM_MESSAGES users tend to either create a ton of dummy controls and/or global variables that change a state from true to false. ; This example demonstrates that everything can be contained in the main function, so it's then easy to keep control of data being passed around. ; There is no need for tons of global variables and functions. ; It's also a good way of not staying too long in the WM_MESSAGE, which can turn into a huge mess. Local $hGUI = GUICreate('GUIEvents', 500, 500) GUIRegisterMsg($WM_LBUTTONDOWN, 'WM_LBUTTONDOWN') GUIRegisterMsg($WM_NCLBUTTONDOWN, 'WM_NCLBUTTONDOWN') GUIRegisterMsg($WM_RBUTTONDOWN, 'WM_RBUTTONDOWN') $g_iActionCommand = GUICtrlCreateDummy() ; Assign the global dummy control variable with a dummy control id. GUISetState(@SW_SHOW, $hGUI) ; Display the AutoIt GUI. While 1 Switch GUIGetMsg() ; Monitor the gui messages/ids. Case $GUI_EVENT_CLOSE ExitLoop Case $g_iActionCommand ; When a message is sent to the dummy control we have to find out what message was actually sent. $iActionCommand = GUICtrlRead($g_iActionCommand) ; Read the message assigned to the control's "state" parameter e.g. 1001. ; As MakeLong() was used in the event function, find the LoWord of the message that was sent. HiWord could be used for an array index or listview item. $iAction = _WinAPI_LoWord($iActionCommand) Switch $iAction Case $GUI_ACTION_LCLIENT ConsoleWrite('The left button was clicked in the client.' & @CRLF) Case $GUI_ACTION_RCLIENT ConsoleWrite('The right button was clicked in the client.' & @CRLF) Case $GUI_ACTION_LTITLE ConsoleWrite('The left button was clicked in the titlebar.' & @CRLF) EndSwitch EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example Func WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam GUICtrlSendToDummy($g_iActionCommand, _WinAPI_MakeLong($GUI_ACTION_LCLIENT, 0)) ; $GUI_ACTION_LCLIENT can be swapped for an integer value, but I use an enum value for ease. Return $GUI_RUNDEFMSG EndFunc ;==>WM_LBUTTONDOWN Func WM_NCLBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam GUICtrlSendToDummy($g_iActionCommand, _WinAPI_MakeLong($GUI_ACTION_LTITLE, 0)) ; You don't even need to use MakeLong(). You can just use GUICtrlSendToDummy($g_iActionCommand, $GUI_ACTION_LTITLE), but then the MakeLong() offers the choice to pass ; another integer value such as listview item/subitem in a message such as WM_NOTIFY. Return $GUI_RUNDEFMSG EndFunc ;==>WM_NCLBUTTONDOWN Func WM_RBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam GUICtrlSendToDummy($g_iActionCommand, _WinAPI_MakeLong($GUI_ACTION_RCLIENT, 0)) Return $GUI_RUNDEFMSG EndFunc ;==>WM_RBUTTONDOWN
    2 points
  2. LAST VERSION - 1.1 18-May-12 Control Viewer (CV) is a replacement of AutoIt Window Info with a number of advantages. I tried to stick to the interface of the last, so you almost do not have to be retrained. During testing, I never managed to find any controls that could not be identified by CV (on the contrary, shows a lot of hidden controls, especially for the system windows). The all program settings are stored in the following registry key: HKEY_CURRENT_USERSoftwareY'sControl Viewer The main differences CV from AWI Shows the complete list of all existing controls for the window that are interested (visible, hidden and deleted controls are displayed with different colors that can be changed to any other).Dynamically changing information during search for the windows and their controls.Ability to quickly switch between controls in the list.Ability to show/hide any controls from the list (useful for the overlaping controls).Information for the Style and ExStyle parameters shown in the form of hexadecimal values​​, and as its flags.Added the PID and Path parameters in the Window tab and ability to quickly open a folder that containing the process file.Added the coordinate system relative to the selected control.Shows a color of the selected pixel in RGB and BGR formats.Shows an example fill of the selected color.Ability to select the text encoding (affects the Text parameter in the Control tab).The complete change the appearance of pop-up frame for the selected controls.Simple and convenient tool to get a screenshot of the part screen of interest for publication on the forum (Capture tab).Create a report in the clipboard or a text file for subsequent publication on the forum.Search all running AutoIt scripts and their windows in the system (AutoIt tab).User-friendly interface. Used shortcuts Ctrl+Alt+T - Enable/Disable "Always On Top" mode (also available from the menu). Ctrl+Alt+H - Enable/Disable highlight selected controls (also available from the menu). Ctrl+A - Select all text (works in any input field). Ctrl - Hold down when moving the mouse to scroll the screenshot (Capture tab). Shift - Hold down when stretching/compression of the contour frame for an equilateral resizing screenshots (Capture tab). DoubleClick (on the screenshot) - Save the image to a file (Capture tab). DoubleClick (on any list item) - Open a folder with the file of the process or AutoIt script (AutoIt tab). Del (on any list item) - Close process (AutoIt tab). F5 - Updating the list (AutoIt tab). If anyone have any questions or comments about CV, please post it in this thread. I will be glad to any feedback and suggestions. Files to download Binary (x86 and x64) Redirection to CV_bin.zip, 1.14 MB CV_bin.html Source Redirection to CV_source.zip, 691 KB CV_source.html
    1 point
  3. Yashied

    UDF Keyword Manager

    LAST VERSION - 1.0 23-May-09 Do you use the SciTE (full version)? Do you have any UDFs which you would like to add to the list of the SciTE editor to highlight color, as for most of the UDFs from AutoIt package? Then this utility for you. UDF Keyword Manager automates the process of adding your functions to the SciTE keywords list. The utility can extract the names of the functions directly from your scripts, you need only to select the file(s). You can also remove unnecessary functions from the list. I have a large collection of my UDFs, and to generate a list of functions took only a few seconds! I recommend trying it. Special thanks to Jos for providing information about the au3.userudfs.properties file. Files to download Binary Redirection to UDFKeywordManager_bin.zip, 410 KB UDFKeywordManager_bin.html Source Redirection to UDFKeywordManager_source.zip, 6 KB UDFKeywordManager_source.html
    1 point
  4. As many are aware, the standard AutoIt Send() function can leave modifier keys (usually Shift, Alt, Ctrl) in a pressed-like state. While there are at least a few alternatives that can be found on this forum, as well as one in the Wiki (which i can't find at the moment), they have all failed me at some point, leaving a modifier key "stuck". So far i have had no issues with this function however. LAST UPDATED: 21-SEP-2014 #include-once ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendEx ; Description ...: alternative to built-in Send() function which prevents modifier keys from being left in a pressed state ; Syntax ........: _SendEx($sSendKeys[, $iTimeout[, $sReleaseKeys[, $hUser32Dll]]]) ; Parameters ....: $sSendKeys - string of keys to send in Send() format ; $hUser32Dll - [optional] handle to user32.dll ; $iTimeout - [optional] maximum time in ms to attempt to release pressed keys (minimum = 250) ; $sReleaseKeys - [optional] comma seperated string of keys to release before issuing Send() (no spaces). ; defaults to: Shift, Ctrl, Alt, L Win, R Win ; Return values .: Success returns 1, else sets @error to 1 and returns an error message string ; Release date ..: 25-May-2014 ; Modify date ...: 21-Sep-2014 ; Author ........: iCode ; Modified by ...: ; Remarks .......: ; Related .......: Send() ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SendEx($sSendKeys, $hUser32Dll = "", $iTimeout = 2000, $sReleaseKeys = "0x10,0x11,0x12,0x5B,0x5C") Local $bCloseDll, $sRet Local $iDelay = Opt("SendKeyDelay") + Opt("SendKeyDownDelay") If $iDelay < 50 Then $iDelay = 50 Local $aReleaseKeys = StringSplit($sReleaseKeys, ",") If @error Then Return SetError(1, 0, "Failed to create release key array") If $hUser32Dll <> "user32.dll" Then $hUser32Dll = DllOpen("user32.dll") If @error Then Return SetError(1, 0, "Failed to open handle to user32.dll") $bCloseDll = True EndIf $sRet = __ReleaseKeys($aReleaseKeys, $iTimeout, $hUser32Dll) If Not @error Then Send($sSendKeys) Sleep($iDelay) $sRet = __ReleaseKeys($aReleaseKeys, $iTimeout, $hUser32Dll) EndIf If $bCloseDll Then DllClose("user32.dll") If $sRet Then Return SetError(1, 0, $sRet) Return 1 EndFunc ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __ReleaseKeys ; Description ...: release pressed keys ; Syntax ........: __ReleaseKeys(Byref $aReleaseKeys, $iTimeout, $hUser32Dll) ; Parameters ....: $aReleaseKeys - [in/out] An array of unknowns. ; $iTimeout - An integer value. ; $hUser32Dll - A handle value. ; Return values .: None ; Author ........: iCode ; Modified ......: 25-May-2014 ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __ReleaseKeys(ByRef $aReleaseKeys, $iTimeout, $hUser32Dll) If $iTimeout < 50 Then $iTimeout = 250 Local $aRet, $hTimer = TimerInit() For $i = 0 To UBound($aReleaseKeys) - 1 $aRet = DllCall($hUser32Dll, "short", "GetAsyncKeyState", "int", $aReleaseKeys[$i]) If @error Then Return SetError(1, 0, "Dll call GetAsyncKeyState failed with key: " & $aReleaseKeys[$i]) If BitAND($aRet[0], 0x8000) <> 0 Then Do Sleep(100) DllCall($hUser32Dll, "int", "keybd_event", "int", $aReleaseKeys[$i], "int", 0, "long", 2, "long", 0) If @error Then Return SetError(1, 0, "Dll call keybd_event failed with key: " & $aReleaseKeys[$i]) $aRet = DllCall($hUser32Dll, "short", "GetAsyncKeyState", "int", $aReleaseKeys[$i]) If TimerDiff($hTimer) >= $iTimeout Then Return SetError(1, 0, "Time out limit reached") Until BitAND($aRet[0], 0x8000) = 0 EndIf Next EndFunc Change log... 29-JUN-2014 - changed the order of the parameters for _SendEx, moving $sReleaseKeys to the last position 21-SEP-2014 - in the interest of efficiency, i removed the StringStripWS() function - $sReleaseKeys can no longer have spaces in the string
    1 point
  5. guinness

    GUIEvents

    A better approach would be to hide the global variable around function calls. So now the user only has to interact with the functions and not the global variable. #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global Enum $GUI_ACTION_LCLIENT, $GUI_ACTION_RCLIENT, $GUI_ACTION_LTITLE ; An enumeration of possible actions. Global $g_iActionCommand ; Create a single global variable to store a dummy control. _SetDummyControl(-9999) Example() Func Example() ; When using WM_MESSAGES users tend to either create a ton of dummy controls and/or global variables that change a state from true to false. ; This example demonstrates that everything can be contained in the main function, so it's then easy to keep control of data being passed around. ; There is no need for tons of global variables and functions. ; It's also a good way of not staying too long in the WM_MESSAGE, which can turn into a huge mess. Local $hGUI = GUICreate('GUIEvents', 500, 500) GUIRegisterMsg($WM_LBUTTONDOWN, 'WM_LBUTTONDOWN') GUIRegisterMsg($WM_NCLBUTTONDOWN, 'WM_NCLBUTTONDOWN') GUIRegisterMsg($WM_RBUTTONDOWN, 'WM_RBUTTONDOWN') $g_iActionCommand = GUICtrlCreateDummy() ; Assign the global dummy control variable with a dummy control id. GUISetState(@SW_SHOW, $hGUI) ; Display the AutoIt GUI. While 1 Switch GUIGetMsg() ; Monitor the gui messages/ids. Case $GUI_EVENT_CLOSE ExitLoop Case _GetDummyControl() ; When a message is sent to the dummy control we have to find out what message was actually sent. $iActionCommand = GUICtrlRead(_GetDummyControl()) ; Read the message assigned to the control's "state" parameter e.g. 1001. ; As MakeLong() was used in the event function, find the LoWord of the message that was sent. HiWord could be used for an array index or listview item. $iAction = _WinAPI_LoWord($iActionCommand) Switch $iAction Case $GUI_ACTION_LCLIENT ConsoleWrite('The left button was clicked in the client.' & @CRLF) Case $GUI_ACTION_RCLIENT ConsoleWrite('The right button was clicked in the client.' & @CRLF) Case $GUI_ACTION_LTITLE ConsoleWrite('The left button was clicked in the titlebar.' & @CRLF) EndSwitch EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example Func _GetDummyControl() ; Getter for the dummy control. Return $g_iActionCommand EndFunc ;==>_GetDummyControl Func _SetDummyControl($iDummy) ; Setter for the dummy control. $g_iActionCommand = $iDummy EndFunc ;==>_SetDummyControl Func WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam GUICtrlSendToDummy($g_iActionCommand, _WinAPI_MakeLong($GUI_ACTION_LCLIENT, 0)) ; $GUI_ACTION_LCLIENT can be swapped for an integer value, but I use an enum value for ease. Return $GUI_RUNDEFMSG EndFunc ;==>WM_LBUTTONDOWN Func WM_NCLBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam GUICtrlSendToDummy($g_iActionCommand, _WinAPI_MakeLong($GUI_ACTION_LTITLE, 0)) ; You don't even need to use MakeLong(). You can just use GUICtrlSendToDummy($g_iActionCommand, $GUI_ACTION_LTITLE), but then the MakeLong() offers the choice to pass ; another integer value such as listview item/subitem in a message such as WM_NOTIFY. Return $GUI_RUNDEFMSG EndFunc ;==>WM_NCLBUTTONDOWN Func WM_RBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam GUICtrlSendToDummy($g_iActionCommand, _WinAPI_MakeLong($GUI_ACTION_RCLIENT, 0)) Return $GUI_RUNDEFMSG EndFunc ;==>WM_RBUTTONDOWN
    1 point
  6. guinness

    MsgBox Retry and Cancel

    Or... #include <MsgBoxConstants.au3> Do $cnum = InputBox("ECJ_&_ECLI", "ECJ Case number? ", "T-457/09 or ECLI:EU:T:2014:683", "", -1, -1, 0, 0) If StringInStr($cnum, "ECLI:") Then $cnum = StringReplace($cnum, ':', '%253A') $url = 'http://1xxx' & $cnum & 'xxx' ExitLoop ElseIf StringInStr($cnum, "/") Then $cnum = StringReplace($cnum, '/', '%252F') $url = 'http://2xxx' & $cnum & 'xxx' ExitLoop EndIf Until MsgBox($MB_RETRYCANCEL, "Problem with your choice", "You haven't given me an ECJ Case_number or an ECJ ECLI", 10) = $IDCANCEL
    1 point
  7. Looks like the easiest thing would be to pull the raw data from here and the extract the desired information from the XML data.
    1 point
  8. Danp2

    Need help for _FFclick

    is one example. Read down a few posts from there for another. Firebug isn't that hard. There are probably lots of tutorials online. Find one and follow it to get the basics of how it works. FWIW, the images are located at the very bottom of the test page.
    1 point
  9. #Include <Array.au3> $sTxt = BinaryToString(InetRead("https://www.harryhomers.org/et/forum/viewtopic.php?f=89&t=4309")) $aItems = StringRegExp($sTxt, '>\d+\.\h+([^<]+)', 3) _ArrayDisplay($aItems)
    1 point
  10. Well, there are a lot of ways to do this but here is two ways: #include <IE.au3> #include <Array.au3> #include <String.au3> $oIE = _IECreate("https://www.harryhomers.org/et/forum/viewtopic.php?f=89&t=4309") $sHTML = _IEBodyReadHTML($oIE) Dim $ListArray[1] For $i = 1 To 20 $aNames = _StringBetween($sHTML, ">" & $i & ". ", "<") If IsArray($aNames) Then _ArrayAdd($ListArray, $aNames[0]) Next _ArrayDisplay($ListArray) _IEQuit($oIE) ;or you can do this $dHTML = InetRead(("https://www.harryhomers.org/et/forum/viewtopic.php?f=89&t=4309")) $sHTML = BinaryToString($dHTML) Dim $ListArray[1] For $i = 1 To 20 $aNames = _StringBetween($sHTML, ">" & $i & ". ", "<") If IsArray($aNames) Then _ArrayAdd($ListArray, $aNames[0]) Next _ArrayDisplay($ListArray)
    1 point
  11. Dlund, From that reply I can only assume that you are not prepared to tell us as you are well aware that the subject would fall foul of the Forum rules. So, as I suspected would be the final result, the thread is locked. M23
    1 point
  12. #include <Array.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> ; Proof of concept for using the control id as an index item for an array. I created back on 8th April 2013. Example() Func Example() ; Create the GUI. Local $iHeight = 400, $iWidth = 400 Local $hGUI = GUICreate('', $iWidth, $iHeight) GUISetState(@SW_SHOW, $hGUI) ; Declare variables to be used throughout the example. Local Const $BUTTON_ROWS_COLUMNS = 8 Local Enum $eCTRL_HWND, $eCTRL_VALUE, $eCTRL_MAX Local $aMsg[1][$eCTRL_MAX], _ $iButtonHeight = $iHeight / $BUTTON_ROWS_COLUMNS, _ $iButtonWidth = $iWidth / $BUTTON_ROWS_COLUMNS, _ $iControlID = 0 For $i = 0 To $BUTTON_ROWS_COLUMNS - 1 For $j = 0 To $BUTTON_ROWS_COLUMNS - 1 $iControlID = GUICtrlCreateButton($i & ',' & $j, $i * $iButtonWidth, $j * $iButtonHeight, $iButtonWidth, $iButtonHeight, $BS_CENTER) ; Increase the size of the array if the control id is greater than or equal to the total size of the array. If $iControlID >= UBound($aMsg) Then ReDim $aMsg[Ceiling($iControlID * 1.3)][$eCTRL_MAX] EndIf ; Add to the array. $aMsg[$iControlID][$eCTRL_HWND] = GUICtrlGetHandle($iControlID) $aMsg[$iControlID][$eCTRL_VALUE] = 'Sample string for the control id: ' & $iControlID Next Next ; Clear empty items after the last created control id. ReDim $aMsg[$iControlID + 1][$eCTRL_MAX] ; Display the array created. _ArrayDisplay($aMsg) Local $iMsg = 0 While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $aMsg[$eCTRL_HWND][$eCTRL_HWND] To UBound($aMsg) ; If $iMsg is greater than 0 and between the 0th index of $aMsg and the last item then display in the console. If $iMsg > 0 Then ConsoleWrite('Control Hwnd: ' & $aMsg[$iMsg][$eCTRL_HWND] & ', ' & $aMsg[$iMsg][$eCTRL_VALUE] & @CRLF) EndIf EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example
    1 point
  13. LAST VERSION - 2.2 14-Mar-10 3D Axis is designed to draw graphs of almost any trigonometric functions that can be specified as a single function - f(a,b). The functions can be specified in one of the three coordinate systems: cartesian, cylindrical or spherical. By default, you can use any functions that are defined in AutoIt (Cos(), Sin(), Sqrt() etc.), but you can also import your own functions, for example write a function for Fourier series. At the beginning, try to play with the examples that appear below (Examples.3da). Just drag this file to the main program window, select any graphs, and click "Draw" button. But do not draw all graphs at once, as this may take a long time. Try to come up with their own functions, it all depends on your imagination. If anyone got beautiful graphs, please post it in this thread (better in .3da file). 3D Axis has one drawback - size of the main program window is more than 1250x860 and can not be resized that will fit not for all monitors! Therefore, recommended minimum size of your monitor should be 17". The any questions or comments about 3D Axis please post it in this thread. I will be glad to any feedback and suggestions. Files to download Binary Redirection to 3DAxis_bin.zip, 1.11 MB 3DAxis_bin.html Binary (GUI smaller version, size of the client area - 1101x733) Redirection to 3DAxis_small_bin.zip, 1.11 MB 3DAxis_small_bin.html Source Redirection to 3DAxis_source.zip, 668 KB 3DAxis_source.html Examples To draw graphs of the functions from the Examples.3da, just import or drag and drop this file into the program. Examples.zip
    1 point
  14. ripdad

    Podcast Downloader

    Recently, I downloaded over 2000 mp3's (podcast). There was no way to do this with an aggregator because of the way the podcasts were posted on the website. To make a long story short .. I wrote a script to deal with it. Anyways, I am releasing 2 of the functions I used in that script as an example to download podcast ... or possibly something else with a few modifications made to it. ; Podcast Downloader ; Released: April 08, 2011 by ripdad ; Example: Yes ; #include <array.au3> ; Local $rtn, $LinksArray, $sFolder = @ScriptDir & '\MyPodcast' If Not FileExists($sFolder) Then DirCreate($sFolder) $LinksArray = GetPodcastLinks('http://rss.cnn.com/services/podcasting/newscast/rss.xml', '<link>', '</link>', 0) If @error Then MsgBox(16, '', $LinksArray); <-- NOTE: var $LinksArray is a string if an error was returned Exit EndIf _ArrayDisplay($LinksArray); Visually check if GetPodcastLinks() returned full links properly If MsgBox(8228, 'Podcast Downloader', 'Start Download?') = 7 Then Exit; ability to escape $rtn = DownloadPodcast($LinksArray, $sFolder) If @error Then MsgBox(16, '', $rtn) Exit EndIf MsgBox(64, '', $rtn) Exit Func GetPodcastLinks($podURL, $tag1 = 'url="', $tag2 = '"', $addURL = 0) If $addURL Then If StringRight($podURL, 1) <> '/' Then $podURL &= $podURL & '/' EndIf Local $string = '', $DL_Page = InetRead($podURL, 1) If @error < 0 Then Return SetError(-1, 0, 'Connection Error') Local $PodLinks = StringRegExp(BinaryToString($DL_Page), '(?i)(?s)' & $tag1 & '(.*?)' & $tag2, 3) If Not IsArray($PodLinks) Then Return SetError(-2, 0, 'Nothing To View') For $i = 0 To UBound($PodLinks) - 1 If StringRight($PodLinks[$i], 4) <> '.mp3' Then ContinueLoop If $addUrl Then $string &= $podURL & $PodLinks[$i] & '|' Else $string &= $PodLinks[$i] & '|' EndIf Next $PodLinks = StringSplit(StringTrimRight($string, 1), '|') _ArraySort($PodLinks, 0, 1) Return SetError(0, 0, $PodLinks) EndFunc Func DownloadPodcast($aLinks, $sPath) If Not IsArray($aLinks) Then Return SetError(-1, 0, 'Invalid Array') If StringRight($sPath, 1) <> '\' Then $sPath &= '\' If Not FileExists($sPath) Then If Not DirCreate($sPath) Then Return SetError(-2, 0, 'Error Creating Path') Sleep(2000) EndIf Local $dLoad, $sFile, $nSize, $BytesRead, $bdv Local $mps, $d1, $d2, $nCount, $cnt = $aLinks[0] For $i = 1 To $aLinks[0] $cnt -= 1 If StringRight($aLinks[$i], 4) <> '.mp3' Then ContinueLoop $sFile = StringTrimLeft($aLinks[$i], StringInStr($aLinks[$i], '/', 0, -1)) $nSize = InetGetSize($aLinks[$i]) If FileExists($sPath & $sFile) Then If FileGetSize($sPath & $sFile) = $nSize Then ContinueLoop FileDelete($sPath & $sFile) EndIf $nCount = 0 $dLoad = InetGet($aLinks[$i], $sPath & $sFile, 1, 1) Do Sleep(1000) $nCount += 1 $BytesRead = InetGetInfo($dLoad, 0) $bdv = $BytesRead / 1024 / 1024 $mps = StringLeft($bdv / ($nCount / 1000), 5) $d1 = 'Current File Progress: ' & Int($BytesRead / $nSize * 100) & '%' & @CRLF $d2 = "Speed (kb's/sec): " & $mps ToolTip($sPath & $sFile & @CRLF & $d1 & $d2, 0, 0, 'Remaining Files to Download: ' & $cnt, 1) Until InetGetInfo($dLoad, 2) If InetGetInfo($dLoad, 4) Then InetClose($dLoad) Return SetError(-3, 0, 'Connection Error') EndIf InetClose($dLoad) Next ToolTip('') Return SetError(0, 0, 'Finished') EndFunc
    1 point
×
×
  • Create New...