Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[pytanie] Pasek Postępu


Rekomendowane odpowiedzi

Opublikowano

Wytłumaczy mi ktoś dlaczego w inetget z progressem się nic nie dzieje? I naprowadzi na poprawe.



#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("progress download", 243, 170, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 48, 128, 113, 25)
$Progress1 = GUICtrlCreateProgress(32, 56, 177, 25)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $Button1


do
Local $hDownload = InetGet("http://download.mozilla.org/?product=firefox-11.0&os=win?=pl", @TempDir & "\file.exe", 1, 1)
$progress = InetGetInfo($hDownload,0)
GUICtrlSetData($Progress1,$progress)
until InetGetInfo($hDownload, 2)
InetClose($hDownload)

EndSwitch
WEnd

Opublikowano

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("progress download", 243, 170, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 48, 128, 113, 25)
$Progress1 = GUICtrlCreateProgress(32, 56, 177, 25)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $Button1


$hDownload = InetGet("http://download.mozilla.org/?product=firefox-11.0&os=win?=pl", @TempDir & "\file.exe", 1, 1)
$size = InetGetInfo($hDownload, 1); lub spróbuj w razie czego InetGetSize ("http://download.mozilla.org/?product=firefox-11.0&os=win?=pl")
do
$progress = InetGetInfo($hDownload,0)
GUICtrlSetData($Progress1,$progress/$size*100)
sleep(100)
until InetGetInfo($hDownload, 2)
InetClose($hDownload)

EndSwitch
WEnd

spróbuj tak

Opublikowano

No niestety podobnie. Pasek rusza gdzieś do 1 % i się zatrzymuje ,a plik się pobiera dalej. O ile da się takie coś wykonać.

Opublikowano
Weteran
Opublikowano
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("progress download", 243, 170, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 48, 128, 113, 25)
$Progress1 = GUICtrlCreateProgress(32, 56, 177, 25)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $Button1
Local $Download = InetGet("http://download.mozilla.org/?product=firefox-11.0&os=win?=pl",@TempDir & "file.exe",1,1)
Local $size = InetGetSize("http://download.mozilla.org/?product=firefox-11.0&os=win?=pl")
Do
$progress = InetGetInfo($Download,0)
GUICtrlSetData($Progress1,$progress/$size*100)
ToolTip($size/$progress*100,0,0)
Sleep(100)
Until InetGetInfo($Download, 2)
InetClose($Download)
MsgBox(0,"Informacja","Zakończono pobieranie")
EndSwitch
WEnd

1329036830-U154499.png
Opublikowano

Zwyczajnie obrazki można pobrać.

 

InetGet("http://www.mpcforum.pl/public/style_images/18_18_logompc.png", @ScriptDir & "\mpcLOGO.jpeg", 1, 1)

 

Wszystko w porządku

Opublikowano

Zwyczajnie obrazki można pobrać.

 

InetGet("http://www.mpcforum.pl/public/style_images/18_18_logompc.png", @ScriptDir & "\mpcLOGO.jpeg", 1, 1)

 

Wszystko w porządku

 

Sprawdzałeś to u siebie? Bo u mnie to nie działa.

obraz24.png


Opublikowano

Tak pobiera do: (tam skąd skrypt odpalasz). Chciałem sobie progressbara czerwonego zrobić ale tylko zielony działa? Jakiś bug?

Weteran
Opublikowano

Musi działać, mi działa.

InetGet("http://img864.imageshack.us/img864/1026/sygnaturaqy.png","sygnaturaqy.png",1,1)

 

W tak btw. nie daje się kreski \, tylko /

1329036830-U154499.png
Weteran
Opublikowano

W każdym.. chyba, że się znowu mylę ;d

 

A co do progressbar'a nie da się zmienić koloru.. próbowałem dużo razy i mi nie wychodziło.

1329036830-U154499.png
Opublikowano

da rade zmienić :D

 

Func XPStyleToggle($OnOff = 1)
If Not StringInStr(@OSTYPE, "WIN32_NT") Then Return 0
If $OnOff Then
	$XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties")
	DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
	Return 1
ElseIf IsArray($XS_n) Then
	DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0])
	$XS_n = ""
	Return 1
EndIf
Return 0
EndFunc
XPStyleToggle(1)
GUICtrlSetColor($auprogress,0xff0000)

 

kolor czerwony :>

 

albo też znalazłem pseudo progressbar(o którym napisał sopelek)

 

; Example by RomanK: How to make a coloured progress bar without the Progressbar control.

#include <GUIConstantsEx.au3>

GUICreate("Progress bar fake", 400, 100)

$progress_frame = GUICtrlCreateLabel("", 10, 10, 380, 35, 0x12)

$progress = GUICtrlCreateLabel("", 11, 11, 0, 32); x = 11 and y = 11 because I thought it looks better with a visible frame.
GUICtrlSetBkColor(-1, 0xFF0000)

$progress_percentage = GUICtrlCreateLabel("", 10, 21, 380, 20, 0x01); y = 21 to make the percentage vertically centered.
GUICtrlSetBkColor(-1, -2); $GUI_BKCOLOR_TRANSPARENT

$width = 0

GUISetState()

While 1
If $width < 380 Then
	Sleep(50); Speed rate the Progress bar changes with. Of course you wouldn't use Sleep in a real program, as the GUI is no more responding.
	$width += 1
	GUICtrlSetPos($progress, 11, 11, $width)
	GUICtrlSetData($progress_percentage, "  " & Round($width / 380 * 100, 1) & "%" )
; Spaces added because it wasn't centered. Round() makes it as many decimal places as you want. Abs() for absolute numbers without decimals.
Else
	ExitLoop
EndIf
WEnd

Exit

; Code Ending

 

deska, zanim jebniesz jakiegoś faila użyj google bo już któryś raz wprowadzasz userów w błąd, robiąc rzeczy możliwe w niemożliwe albo łatwe w trudne

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...