Sithlord95: Starte das Script 2x oder klick einfach auf OK. Dann müsste da ein Flash-Objekt auftauchen. Man kan damit max 10 sec. etwas machen und dann reagiert das nicht mehr ![]()
Beiträge von DeepRed92
-
-
So da wäre schon die erste Frage
[autoit]
also ich möchte jetzt gerne UserInfos herausbekommen. Das geht mit diesem Befehl hier:MsgBox(0, "", _LastFMGetSource("http://ws.audioscrobbler.com/2.0/?method=user.getInfo&api_sig=" & _api_signature() & "&sk=" & _auth_getSession() & "&api_key=" & $API_KEY))
[/autoit]Doch bekomme eine Fehlermeldung:
XML<?xml version="1.0" encoding="utf-8"?> <lfm status="failed"> <error code="13">Invalid method signature supplied</error></lfm>Hier stehen die Infos dazu: http://www.lastfm.de/api/show?service=344
Unter Params steht folgendes:1. api_key (Required) : A Last.fm API key.
2. api_sig (Required) : A Last.fm method signature. See authentication for more information.
3. sk (Required) : A session key generated by authenticating a user via the authentication protocol.Doch was genau bedeutet der 3. Punkt? Hab ich es falsch angewandt?
Danke schonmal für die Hilfe

-
Hallo,
ich habe mir vorgenommen, eine UDF für die Last.FM -Nutzer zu schreiben, denn leider gibt es noch keine UDF dazu und leider ist die Beschreibung komplett in Englisch und es könnte ja vorkommen bzw wird, das ich viele Sachen nicht ganz verstehen werde. Deswegen dachte ich, dass man sollch eine UDF zusammen schreiben könnte
. Wer Lust hat, kann ja hier ab und zu mal mithelfen.Also hier erstmal die wichtigsten Links:
- http://www.lastfm.de/api/desktopauth ;Das sind die Erklärungen für Desktopanwendungen
- http://www.lastfm.de/api ;Hier sind alle Funktionen aufgelistetIch hab schonmal etwas angefangen:
Edit: Etwas erweitert:
Spoiler anzeigen
[autoit]#cs ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]AutoIt Version: 3.3.0.0
[/autoit] [autoit][/autoit] [autoit]
Author: myNameScript Function:
[/autoit] [autoit][/autoit] [autoit]
Template AutoIt script.#ce ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]; Script Start - Add your code below here
[/autoit] [autoit][/autoit] [autoit]#include <md5.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <Inet.au3>
#include <String.au3>
#include <Array.au3>Global Const $API_KEY = "aa72a3b1161d33d0eba36f986fa1fb43"
[/autoit] [autoit][/autoit] [autoit]MsgBox(0, "", _LastFMGetSource("http://ws.audioscrobbler.com/2.0/?method=user.getInfo&api_sig=" & _api_signature() & "&sk=" & _auth_getSession() & "&api_key=" & $API_KEY))
[/autoit] [autoit][/autoit] [autoit]Func _request_authorization()
[/autoit] [autoit][/autoit] [autoit]
Local $GetToken = _auth_getToken()
If @error Then Return SetError(1, 0, 0)
Return ShellExecute("http://www.last.fm/api/auth/?api_key=" & $API_KEY & "&token=" & $GetToken)
EndFunc ;==>_request_authorizationFunc _auth_getToken()
[/autoit] [autoit][/autoit] [autoit]
Local $Source = _LastFMGetSource("http://ws.audioscrobbler.com/2.0/?method=auth.gettoken&api_key=" & $API_KEY)
If StringInStr($Source, "error") Then
$Source = _StringBetween($Source, ">", "<")
Return SetError(1, "", $Source[2])
EndIf
$Source = _StringBetween($Source, "<token>", "</token>")
Return $Source[0]
EndFunc ;==>_auth_getTokenFunc _auth_getSession()
[/autoit] [autoit][/autoit] [autoit]
Return _md5("api_key" & $API_KEY & "methodauth.getSessiontoken" & _auth_getToken() & "mysecret")
EndFunc ;==>_auth_getSessionFunc _auth_Token($Username = "Nutzername", $Passwort = "Passwort")
[/autoit] [autoit][/autoit] [autoit]
Return _md5($Username & _md5($Passwort))
EndFunc ;==>_auth_TokenFunc _api_signature()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Return _md5("api_key" & $API_KEY & "methodauth.getSessiontoken" & _auth_getToken() & "mysecret")
EndFunc ;==>_api_signatureFunc _LastFMGetSource($s_URL, $s_Header = '')
[/autoit]
If StringLeft($s_URL, 7) <> 'http://' And StringLeft($s_URL,
<> 'https://' Then $s_URL = 'http://' & $s_URL
Local $h_DLL = DllOpen("wininet.dll")
Local $ai_IRF, $s_Buf = ''
Local $ai_IO = DllCall($h_DLL, 'int', 'InternetOpen', 'str', "LastFM Plug-In", 'int', 0, 'int', 0, 'int', 0, 'int', 0)
If @error Or $ai_IO[0] = 0 Then
DllClose($h_DLL)
SetError(1)
Return ""
EndIf
Local $ai_IOU = DllCall($h_DLL, 'int', 'InternetOpenUrl', 'int', $ai_IO[0], 'str', $s_URL, 'str', $s_Header, 'int', StringLen($s_Header), 'int', 0x80000000, 'int', 0)
If @error Or $ai_IOU[0] = 0 Then
DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0])
DllClose($h_DLL)
SetError(1)
Return ""
EndIf
Local $v_Struct = DllStructCreate('udword')
DllStructSetData($v_Struct, 1, 1)
While DllStructGetData($v_Struct, 1) <> 0
$ai_IRF = DllCall($h_DLL, 'int', 'InternetReadFile', 'int', $ai_IOU[0], 'str', '', 'int', 256, 'ptr', DllStructGetPtr($v_Struct))
$s_Buf &= StringLeft($ai_IRF[2], DllStructGetData($v_Struct, 1))
WEnd
DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IOU[0])
DllCall($h_DLL, 'int', 'InternetCloseHandle', 'int', $ai_IO[0])
DllClose($h_DLL)
Return $s_Buf
EndFunc ;==>_LastFMGetSourceIst noch nicht so weit. Hab auch gerade erst angefangen.

-
Zitat
Geht es genauer?
Villt

Also ich hab WinXp. Wenn ich das Script starte, lädt es erst. Man hört die Musik und dann stürzt es auf einmal ab. Kein Ton mehr und die GUI wird weiß. Es kommt aber keine Fehlermeldung und die GUI lässt sich ganz normal schließen. Ich hoffe das war ausführlich genug. Mir fällt nähmlich nichts nennenswertes mehr ein

-
Hallo,
kann mir jemand sagen, warum mein Script abstürzt und die CPU-Auslastung dann bei 50% liegt (Wegen dualcore!)?
Spoiler anzeigen
[autoit]#NoTrayIcon
[/autoit] [autoit][/autoit] [autoit]
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=1.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Description=Spielt einzelne Songs ab.
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Burak Keskin
#AutoIt3Wrapper_Res_Language=1031
#AutoIt3Wrapper_res_requestedExecutionLevel=requireAdministrator
#AutoIt3Wrapper_Res_Field=E-Mail|[email='burak.keskin@arcor.de'][/email]
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf 1 /sv 1
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------AutoIt Version: 3.3.1.1 (beta)
[/autoit] [autoit][/autoit] [autoit]
Author: myNameScript Function:
[/autoit] [autoit][/autoit] [autoit]
Template AutoIt script.#ce ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]; Script Start - Add your code below here
[/autoit] [autoit][/autoit] [autoit]#include <ButtonConstants.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#include <Inet.au3>$Form1 = GUICreate("Last.FM Player", 342, 331)
[/autoit] [autoit][/autoit] [autoit]
GUIRegisterMsg($WM_ACTIVATE, "_ReDraw")
$Label1 = GUICtrlCreateLabel("Interpret:", 8, 8, 46, 17)
$Input1 = GUICtrlCreateInput("Deftones", 64, 8, 121, 21)
$Label2 = GUICtrlCreateLabel("Song:", 8, 40, 32, 17)
$Input2 = GUICtrlCreateInput("Digital Bath", 64, 40, 121, 21)
$Button1 = GUICtrlCreateButton("Ok", 208, 40, 75, 25)GUICreate("", 300, 222, 10, 70, $WS_CHILD, -1, $Form1)
[/autoit] [autoit][/autoit] [autoit]
GUISetBkColor(0x000c)$oIE = ObjCreate("Shell.Explorer.2")
[/autoit] [autoit][/autoit] [autoit]
$GUIActiveX = GUICtrlCreateObj($oIE, -10, -15, 310, 237)$oIE.navigate(@TempDir & "\Temp.html")
[/autoit] [autoit][/autoit] [autoit]
$oIE.document.body.style.border = "0px"
$oIE.document.body.scroll = "no"GUISetState()
[/autoit] [autoit][/autoit] [autoit]GUISetState(@SW_SHOW, $Form1)
[/autoit] [autoit][/autoit] [autoit]_user32_RedrawWindow($Form1, BitOR($RDW_ERASE, $RDW_INVALIDATE, $RDW_ALLCHILDREN, $RDW_UPDATENOW))
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_Anfrage()
Case $Input2
_Anfrage()
EndSwitch
WEndFunc _Anfrage()
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetState($Button1, $GUI_Disable)
$Fopen = FileOpen(@TempDir & "\Temp.html", 2)$Interpret = GUICtrlRead($Input1)
[/autoit] [autoit][/autoit] [autoit]
$Song = GUICtrlRead($Input2)$Source = _LastFM_Get_Player_Source(_LastFM_Generate_Url($Interpret, $Song) & "?autostart")
[/autoit] [autoit][/autoit] [autoit]
If $Source <> -1 Then
FileWrite($Fopen, $Source)
FileClose($Fopen)
$oIE.navigate(@TempDir & "\Temp.html")
$oIE.document.body.style.border = "0px"
$oIE.document.body.scroll = "no"
Else
MsgBox(0, "Fehler", "Musik nicht gefunden!")
EndIf
GUICtrlSetState($Button1, $GUI_Enable)
EndFunc ;==>_AnfrageFunc _user32_RedrawWindow($hWnd, $Flag)
[/autoit] [autoit][/autoit] [autoit]
$Ret = DllCall("User32.dll", "int", "RedrawWindow", "hwnd", $hWnd, "int", 0, "int", 0, "uint", $Flag)
Return $Ret[0]
EndFunc ;==>_user32_RedrawWindowFunc _LastFM_Generate_Url($LF_Interpret, $LF_Song)
[/autoit] [autoit][/autoit] [autoit]
Local $LF_URL = "http://www.lastfm.de/music/" & $LF_Interpret & "/_/" & $LF_Song
Return StringReplace($LF_URL, " ", "+")
EndFunc ;==>_LastFM_Generate_UrlFunc _LastFM_Get_Player_Source($LF_URL)
[/autoit] [autoit][/autoit] [autoit]
Local $LF_Source = _INetGetSource($LF_URL), $Loop
Local $LF_S_Bet = _StringBetween($LF_Source, '<object type="application/x-shockwave-flash"', '</object>')
For $Loop = 0 To UBound($LF_S_Bet)
If IsArray($LF_S_Bet) Then
If StringInStr($LF_S_Bet[$Loop], "lfmPlayer.swf") Then
Return '<object type="application/x-shockwave-flash"' & $LF_S_Bet[$Loop] & '</object>'
EndIf
EndIf
Next
Return -1
EndFunc ;==>_LastFM_Get_Player_SourceFunc _ReDraw($hWnd, $Msg, $wParam, $lParam)
[/autoit]
_user32_RedrawWindow($Form1, BitOR($RDW_ERASE, $RDW_INVALIDATE, $RDW_ALLCHILDREN, $RDW_UPDATENOW))
EndFunc ;==>_ReDraw -
Lade die Visual C++ runter. Hier mal ein Beispiel:
#if defined(_MSC_VER)
#include <windows.h>
#define DLL extern "C" __declspec(dllexport)
#else
#define DLL
#endifDLL double AddNumbers (double a, double b)
{
return a + b;
} -
Danke schonmal für die hilfreichen Antworten. Soweit bin ich jetzt gekommen, aber wie mache ich es, das die Traytips nur bei neuen Songs erscheint?
Spoiler anzeigen
[autoit]#include <Includes\Plug-In.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <Inet.au3>Global Const $Url = "http://www.einslive.de/radiotext/RADIOTXT.TXT"
[/autoit] [autoit][/autoit] [autoit]
Global $Old, $NewAdlibEnable("_GetCurrentSong", 5000)
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
Sleep(20)
WEndFunc _GetCurrentSong()
[/autoit] [autoit][/autoit] [autoit]
$Source = _INetGetSource($Url)
$New = _ConvertSongname($Source)
If $New <> $Old Then
TrayTip("", $Source, 5, 1)
$Old = $New
EndIf
EndFunc ;==>_GetCurrentSongFunc _ConvertSongname($String)
[/autoit] [autoit][/autoit] [autoit]
Local $Str = StringReplace($String, " ", "")
$Str = StringReplace($Str, '"', "")
Return StringReplace($Str, ':', "")
EndFunc ;==>_ConvertSongnameFunc _StringSameLetters($String1, $String2)
[/autoit] [autoit][/autoit] [autoit]
Local $count1 = 0
Local $count2 = 0
Local $diff = 0
Local $StrInStr = 0$Len1 = StringLen($String1)
[/autoit] [autoit][/autoit] [autoit]
$Len2 = StringLen($String2)If $Len1 <> $Len2 Then Return -1
[/autoit] [autoit][/autoit] [autoit]Local $Split1 = StringSplit($String1, "")
[/autoit] [autoit][/autoit] [autoit]
Local $Split2 = StringSplit($String2, "")For $i = 1 To $Len1
[/autoit]
$Letter = $Split1[$i]
For $a = 1 To $Split1[0]
If $Split1[$a] = $Letter Then
$count1 += 1
EndIf
Next
For $b = 1 To $Split2[0]
If $Split2[$b] = $Letter Then
$count2 += 1
EndIf
Next
$diff = Abs(($count1 - $count2))
$count1 = 0
$count2 = 0
Next
Return $diff
EndFunc ;==>_StringSameLetters -
nuts: Da diese 2 Strings sehr ähnlich sind, müsste da sowas wie 1 oder 0.99 herauskommen für 100% oder 99%.
-
@ Arkaneus und nuts: Das habe ich auch schon ausprobiert, doch es wird folgendes bei mir angezeigt: 0.15151515.
-
Hallo,
wie kann ich dieses Problem lösen?
[autoit]$Str1 = '"Sweet About Me":Gabriella Cilmi'
[/autoit][autoit][/autoit][autoit][/autoit][autoit]
$Str2 = 'Gabriella Cilmi: "Sweet About Me"'MsgBox(0, "", _CompareString($Str1, $Str2))
[/autoit][autoit][/autoit][autoit][/autoit][autoit]Func _CompareString($Value1, $Value2)
[/autoit][autoit][/autoit][autoit]EndFunc ;==>_CompareString
[/autoit]Ich hab das schon die ganze Zeit versucht es mit Stringsplit usw. zu vergleichen, ob diese Strings gleich sind doch es klappt einfach nicht. Wie ürdet ihr das machen?

-
Hallo,
mach es doch einfach so:
Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
$Ubound = UBound($buttonsArray)While 1
[/autoit]
$msg = GUIGetMsg()
For $i = 1 To $Ubound
Switch $msg
Case $buttonsArray[$i]
MsgBox(0, "", "Button: " & $buttonsArray[$i] & " wurde angeklickt.")
EndSwitch
Next
WEnd -
Danke für den Hinweis. Habs geändert.
-
Ok. Ich habs mal gemacht. Ist die Schrift nun aber nicht zu klein?
-
Guckt mal. Ist das normal?
-
-
Hallo,
ich wollte mal fragen, ob es möglich ist, mit einem AutoIt-Script GUIControls auf einem anderen AutoIt-Script erstellen kann?
Ich starte Script A. Script A erstellt eine leere GUI.
Beim starten von Script B bekommt es den Handle von Script A und erstellt dort z.b. einen Button.Geht sowas denn? Wäre nähmlich ziemlich cool
.Edit: Also bei Script B soll dann GUISwitch(Handle von a) stehen. Doch so funktioniert es irgendwie nicht. Besteht eine andere Möglichkeit oder ist das unmöglich?
-
-
Hallo,
ich habe mal ein Programm hochgeladen, dass dies verdeutlichen soll. Ich habe vor, ein Programm zu erstellen, dessen GUI man ganz leicht am Bildschirmrand bzw Taskleiste andocken lässt. Ich habe das zwar schonmal versucht doch ich habs nicht hinbekommen, wie dieses Programm es macht. Zieht man es am Bildschirmrand, wird es sozusagen "magnetisch" angezogen.
-
Guck mal hier:
Spoiler anzeigen
[autoit]#include <GUIConstantsEx.au3>
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
#include <StaticConstants.au3>
#include <WindowsConstants.au3>$Form1 = GUICreate("Form1", 625, 445, 193, 125)
[/autoit] [autoit][/autoit] [autoit]
$Color = GUICtrlCreateButton("Color", 8, 376, 75, 25, 0)
$ML_Control = GUICtrlCreateLabel("Hi" & @CRLF & "My Name is Hans" & @CRLF & "The L stands for Danger!", 8,
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###While 1
[/autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Color
GUICtrlSetColor($ML_Control, 0xFF89FF)
GUICtrlSetBkColor($ML_Control, 0x000000)
EndSwitch
WEndSowas ist doch schon längst mit den Standardfunktionen möglich!
-
Hey Oscar. Sehr schön Dein Script. Kann ich bestimmt bei der nächsten Neuinstallation gebrauchen. Dann muss ich nicht mehr die ganzen Downloadseiten zusammensuchen.

Ich hab da mal eine kleine Zusatzfunktion eingebaut. Die Datei, die gerade heruntergeladen wird, ist in der ListView Rot markiert.
Habs aber nicht ganz fertig gestellt. Sollte ja nur eine Anregung sein :D.Spoiler anzeigen
[autoit]#NoTrayIcon
[/autoit] [autoit][/autoit] [autoit]
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=prog.ico
#AutoIt3Wrapper_Outfile=MDT.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Description=MultiDownloadTool
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=by Oscar (http://www.autoit.de)
#AutoIt3Wrapper_Res_Language=1031
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/striponly
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <EditConstants.au3>
#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#include <Array.au3>
Opt('GUIOnEventMode', 1)
Opt('GUICloseOnESC', 0)Global $sTitle = 'Multi-Download-Tool v1.0 ' & Chr(169) & ' by Oscar (http://www.autoit.de)'
[/autoit] [autoit][/autoit] [autoit]
Global $sInifile = @ScriptDir & '\MDT.ini'
Global $aDownloads = IniReadSection($sInifile, 'Downloads')
If @error Then Exit MsgBox(0, $sTitle, 'Inidatei nicht gefunden bzw. fehlerhaft!')
Global $iStop = False
$hGui = GUICreate($sTitle, 480, 420)
GUISetIcon(@ScriptDir & '\prog.ico')
GUISetOnEvent($GUI_EVENT_CLOSE, '_End')
GUICtrlCreateGroup('Zielverzeichnis', 5, 5, 470, 60)
GUICtrlCreateIcon(@SystemDir & '\shell32.dll', -5, 15, 25, 32, 32)
$hTarget = GUICtrlCreateInput(@MyDocumentsDir & '\Downloads\', 50, 32, 380, 20, BitOR($ES_READONLY, $ES_AUTOHSCROLL))
GUICtrlCreateButton('...', 430, 31, 32, 22)
GUICtrlSetOnEvent(-1, '_SelectTarget')
GUICtrlCreateGroup('', -99, -99, 1, 1)
$LVStyle = BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS)
$ExStyle = BitOR($LVS_EX_FULLROWSELECT, $WS_EX_CLIENTEDGE, $LVS_EX_CHECKBOXES, $LVS_EX_DOUBLEBUFFER)
$hListView = GUICtrlCreateListView('Programme auswählen...', 5, 75, 470, 175, $LVStyle, $ExStyle)
_GUICtrlListView_SetColumnWidth($hListView, 0, 440)
$contextmenu = GUICtrlCreateContextMenu($hListView)
GUICtrlCreateMenuItem('Alle markieren', $contextmenu)
GUICtrlSetOnEvent(-1, '_CheckAll')
GUICtrlCreateMenuItem('Keins markieren', $contextmenu)
GUICtrlSetOnEvent(-1, '_UnCheckedAll')
$hStart = GUICtrlCreateButton('Download starten', 5, 270, 100, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetOnEvent(-1, '_StartDownload')
$hAVICopy = GUICtrlCreateAvi(@SystemDir & '\shell32.dll', 170, 120, 250)
GUICtrlSetState(-1, $GUI_HIDE)
$hDispAct = GUICtrlCreateLabel('0%', 220, 315, 50, 20, $SS_CENTER)
$hProgrAct = GUICtrlCreateProgress(5, 330, 470, 16)
$hDispAll = GUICtrlCreateLabel('0%', 220, 355, 50, 20, $SS_CENTER)
$hProgrAll = GUICtrlCreateProgress(5, 370, 470, 16)
$hStatus = _GUICtrlStatusBar_Create($hGui)
_GUICtrlStatusBar_SetText($hStatus, '0 Programme ausgewählt')
GUISetState()
HotKeySet('{ESC}', '_StopDownload')Dim $ListViewItem_IDs[$aDownloads[0][0]]
[/autoit] [autoit][/autoit] [autoit]
For $i = 1 To $aDownloads[0][0]
$ListViewItem_IDs[$i - 1] = GUICtrlCreateListViewItem($aDownloads[$i][0], $hListView)
GUICtrlSetOnEvent(-1, '_RefreshCounter')
Next
While 1
Sleep(1000)
WEndFunc _End()
[/autoit] [autoit][/autoit] [autoit]
Exit
EndFunc ;==>_EndFunc _GetIDByName($iArray, $iName)
[/autoit] [autoit][/autoit] [autoit]
For $Loop = 0 To UBound($iArray) - 1
If StringTrimRight(GUICtrlRead($iArray[$Loop]), 1) = $iName Then Return $iArray[$Loop]
Next
EndFunc ;==>_GetIDByNameFunc _StartDownload()
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetState($hStart, $GUI_DISABLE)
;~ GUICtrlSetState($hListView, $GUI_DISABLE)
GUICtrlSetData($hDispAll, '0%')
GUICtrlSetData($hProgrAll, 0)
Local $aCheckedIndices, $iSize, $sTargetFile, $sPath, $iPercent, $iOld, $iPercentAll, $iBytesRead, $iBreak
$sPath = GUICtrlRead($hTarget)
If Not FileExists($sPath) Then DirCreate($sPath)
$aCheckedIndices = _GUICtrlListView_GetCheckedIndices($hListView)
GUICtrlSetState($hAVICopy, $GUI_SHOW)
GUICtrlSetState($hAVICopy, 1)
For $i = 0 To UBound($aCheckedIndices) - 1
$sDownload = $aDownloads[$aCheckedIndices[$i] + 1][1]
GUICtrlSetData($hDispAct, '0%')
GUICtrlSetData($hProgrAct, 0)
_GUICtrlStatusBar_SetText($hStatus, 'Download von "' & $aDownloads[$aCheckedIndices[$i] + 1][0] & '"')
GUICtrlSetBkColor(_GetIDByName($ListViewItem_IDs, $aDownloads[$aCheckedIndices[$i] + 1][0]), 0xFF0000)
$iSize = InetGetSize($sDownload)
If Not @error Then
$sTargetFile = $sPath & StringRegExpReplace($sDownload, '.+\/(.+\..{3}).*', '$1')
$iStop = False
InetGet($sDownload, $sTargetFile, 1, 1)
While @InetGetActive
$iBytesRead = @InetGetBytesRead
$iPercent = Int(100 / $iSize * $iBytesRead)
If $iBytesRead <> $iOld Then
$iOld = $iBytesRead
_GUICtrlStatusBar_SetText($hStatus, 'Download von "' & $aDownloads[$aCheckedIndices[$i] + 1][0] & '" (' & _ByteAutoSize($iOld) & ' / ' & _ByteAutoSize($iSize) & ')')
GUICtrlSetData($hDispAct, $iPercent & '%')
GUICtrlSetData($hProgrAct, $iPercent)
EndIf
If $iStop Then
InetGet('abort')
$iBreak += 1
ExitLoop
EndIf
Sleep(50)
WEnd
Else
$iBreak += 1
EndIf
GUICtrlSetData($hDispAct, '100%')
GUICtrlSetData($hProgrAct, 100)
$iPercentAll = Int(100 / UBound($aCheckedIndices) * ($i + 1 - $iBreak))
GUICtrlSetData($hDispAll, $iPercentAll & '%')
GUICtrlSetData($hProgrAll, $iPercentAll)
Next
GUICtrlSetState($hAVICopy, 0)
GUICtrlSetState($hAVICopy, $GUI_HIDE)
_GUICtrlStatusBar_SetText($hStatus, 'Downloads abgeschlossen!')
GUICtrlSetState($hListView, $GUI_ENABLE)
GUICtrlSetState($hStart, $GUI_ENABLE)
EndFunc ;==>_StartDownloadFunc _StopDownload()
[/autoit] [autoit][/autoit] [autoit]
$iStop = True
EndFunc ;==>_StopDownloadFunc _SelectTarget()
[/autoit] [autoit][/autoit] [autoit]
Local $sPath
$sPath = FileSelectFolder('Bitte Zielverzeichnis auswählen', @DesktopDir, 3, '', $hGui)
If @error Then Return
If StringRight($sPath, 1) <> '\' Then $sPath &= '\'
If FileExists($sPath) Then
GUICtrlSetData($hTarget, $sPath)
EndIf
EndFunc ;==>_SelectTargetFunc _RefreshCounter()
[/autoit] [autoit][/autoit] [autoit]
Local $iCount = _GUICtrlListView_GetCheckedCount($hListView)
If $iCount > 0 Then
GUICtrlSetState($hStart, $GUI_ENABLE)
Else
GUICtrlSetState($hStart, $GUI_DISABLE)
EndIf
GUICtrlSetData($hDispAll, '0%')
GUICtrlSetData($hProgrAll, 0)
GUICtrlSetData($hDispAct, '0%')
GUICtrlSetData($hProgrAct, 0)
_GUICtrlStatusBar_SetText($hStatus, $iCount & ' Programm' & _Iif($iCount = 1, '', 'e') & ' ausgewählt')
EndFunc ;==>_RefreshCounterFunc _CheckAll()
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlListView_SetItemChecked($hListView, -1, True)
_RefreshCounter()
EndFunc ;==>_CheckAllFunc _UnCheckedAll()
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlListView_SetItemChecked($hListView, -1, False)
_RefreshCounter()
EndFunc ;==>_UnCheckedAllFunc _GUICtrlListView_GetCheckedCount($hListView)
[/autoit] [autoit][/autoit] [autoit]
Local $iCount = _GUICtrlListView_GetItemCount($hListView), $iCheckedCount = 0
If $iCount = 0 Then Return SetError(1, 0, 0)
For $i = 0 To $iCount - 1
$iCheckedCount += _GUICtrlListView_GetItemChecked($hListView, $i)
Next
Return $iCheckedCount
EndFunc ;==>_GUICtrlListView_GetCheckedCountFunc _GUICtrlListView_GetCheckedIndices($hListView)
[/autoit] [autoit][/autoit] [autoit]
Local $iCount = _GUICtrlListView_GetItemCount($hListView)
Local $iCheckedCount = _GUICtrlListView_GetCheckedCount($hListView)
If $iCheckedCount = 0 Then Return SetError(1, 0, 0)
Local $aCheckedItems[$iCheckedCount]
$iCheckedCount = 0
For $i = 0 To $iCount - 1
If _GUICtrlListView_GetItemChecked($hListView, $i) Then
$aCheckedItems[$iCheckedCount] = $i
$iCheckedCount += 1
EndIf
Next
Return $aCheckedItems
EndFunc ;==>_GUICtrlListView_GetCheckedIndices;===============================================================================
[/autoit]
; Function Name: _ByteAutoSize($iSize, $iRound = 2, $iFormat = 0, $bThousands = True)
; Description:: Gibt einen Bytewert in einer bestimmten Einheit zurück
; Parameter(s): $iSize = Größe in Byte übergeben
; $iRound = Anzahl der Nachkommastellen (0...8)
; $iFormat = bestimmt den Rückgabewert
; 0 = Automatisch (je nach übergebenen Wert)
; 1 = in Byte
; 2 = in KByte
; 3 = in MByte
; 4 = in GByte
; $bThousands = Rückgabe mit Tausendertrennzeichen (True/False)
; Requirement(s): #include <String.au3>
; Author(s): Oscar (http://www.autoit.de)
;===============================================================================
Func _ByteAutoSize($iSize, $iRound = 2, $iFormat = 0, $bThousands = True)
Local $aSize[4] = [' Byte', ' KByte', ' MByte', ' GByte'], $sReturn
If $iFormat < 0 Or $iFormat > 4 Then $iFormat = 0
If $iRound < 0 Or $iRound > 8 Then $iRound = 2
If Not IsBool($bThousands) Then $bThousands = False
$iSize = Abs($iSize)
If $iFormat = 0 Then
For $i = 30 To 0 Step -10
If $iSize > (2 ^ $i) Then
$iFormat = $i / 10 + 1
ExitLoop
EndIf
Next
EndIf
If $iFormat = 0 Then $iFormat = 1
$sReturn = Round($iSize / (2 ^ (($iFormat - 1) * 10)), $iRound)
If $bThousands Then $sReturn = _StringAddThousandsSep($sReturn, '.', ',')
Return $sReturn & $aSize[$iFormat - 1]
EndFunc ;==>_ByteAutoSize