What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Progresbar

Pages: (2): « First [ 1 ] 2 » Last »
Progresbar
Author: Message:
Drakal
Junior Member
**

Avatar
Ohh no! im in the warp hole!!

Posts: 32
– / Male / Flag
Joined: Jun 2007
O.P. Progresbar
How do i do a progress bar? i have added a download feature on my skript but i cant see how much that is downloaded or how long time it is to its finished.
Scripts in progres:
AIOS??% 3050 lines (1800 lines more in the xml files) and 6 Mb (total)
(renamed from bad word filter.. it can do more than filter words now:P):
Programs in progres:
a calculator (name: Mini): ??% 3600 lines :O and 280 Kb (it was 100 lines first but my friend wanted it a little bit more advanced)
--------------
Sorry for my english.. im not so good
09-15-2007 05:10 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: Progresbar
Here are some progress bar functions:
code:
function Progress_GetPos(PlusWnd, CtrlId) {
    return PlusWnd.SendControlMessage(CtrlId, /*PBM_GETPOS*/ 0x408, 0, 0);
}

function Progress_SetPos(PlusWnd, CtrlId, nNewPos) {
    return PlusWnd.SendControlMessage(CtrlId, /*PBM_SETPOS*/ 0x402, nNewPos, 0);
}

function Progress_SetStep(PlusWnd, CtrlId, nStepInc) {
    return PlusWnd.SendControlMessage(CtrlId, /*PBM_SETSTEP*/ 0x404, nStepInc, 0);
}

function Progress_StepIt(PlusWnd, CtrlId) {
    return PlusWnd.SendControlMessage(CtrlId, /*PBM_STEPIT*/ 0x405, 0, 0);
}

//Usage example
var nPos = Progress_GetPos(oPlusWnd, "PrgDownload");
Progress_SetPos(oPlusWnd, "PrgDownload", nPos+10);

However, the actual position is hard to find. In fact, you should use a timer which gets the current file size of the downloaded file, divides that by the total file size to be downloaded and multiplies that by 100 to get the percentage. The catch is that you can't easily get the total file size, you'd need a text file on the server containing the file size to actually know how big the file to be downloaded is.

Actually, I don't really know if this is true, so if anyone can proof me wrong and provide me a way to get the file size of the server file, please tell me! :)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
09-15-2007 05:41 PM
Profile E-Mail PM Web Find Quote Report
Drakal
Junior Member
**

Avatar
Ohh no! im in the warp hole!!

Posts: 32
– / Male / Flag
Joined: Jun 2007
O.P. RE: Progresbar
didnt undersand anyting of the first :P do i need a xml file or anything?
Scripts in progres:
AIOS??% 3050 lines (1800 lines more in the xml files) and 6 Mb (total)
(renamed from bad word filter.. it can do more than filter words now:P):
Programs in progres:
a calculator (name: Mini): ??% 3600 lines :O and 280 Kb (it was 100 lines first but my friend wanted it a little bit more advanced)
--------------
Sorry for my english.. im not so good
09-15-2007 06:00 PM
Profile PM Find Quote Report
Flash
Junior Member
**

Avatar
All time Ready

Posts: 86
Reputation: 2
44 / Male / Flag
Joined: Aug 2006
RE: Progresbar
Interface Windows Schema Documentation

complexType ProgressControl diagram 
My script: Psdp
09-15-2007 11:28 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: Progresbar
Sorry, I understood your question as how to interact with an existing ProgressControl.

You'll first need to add this in your window:
code:
<Control xsi:type="ProgressControl" Id="PrgDownload">
   <Postion Left="10" Top="10" Width="150" Height="25"/>
</Control>
Then, whenever you need to get or change the position, use Progress_GetPos or Progress_SetPos. Alternatively, you could first set the step increment with Progress_SetStep and then use Progress_StepIt to step further.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
09-16-2007 06:37 AM
Profile E-Mail PM Web Find Quote Report
Drakal
Junior Member
**

Avatar
Ohh no! im in the warp hole!!

Posts: 32
– / Male / Flag
Joined: Jun 2007
O.P. RE: Progresbar
Thank you Mattike but your control didnt work(fixed it on my self) and i got it to move from 0 to 100% when i download a file but without a timer(used my crazy other ways:P)... but to fix i timer... :P the timer i already has dont work any more so can you give me a basic lesson in timers?(feel like a nood :( )
Scripts in progres:
AIOS??% 3050 lines (1800 lines more in the xml files) and 6 Mb (total)
(renamed from bad word filter.. it can do more than filter words now:P):
Programs in progres:
a calculator (name: Mini): ??% 3600 lines :O and 280 Kb (it was 100 lines first but my friend wanted it a little bit more advanced)
--------------
Sorry for my english.. im not so good
09-16-2007 08:39 AM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: Progresbar
Well, first you need to create one with
code:
MsgPlus.AddTimer("MyTimer", 500);
This will create a timer called MyTimer with an interval of 500 milliseconds.

Then, you need an event:
code:
function OnEvent_Timer(sTimerId) {
if(sTimerId == "MyTimer") {
   //Do progress bar stuff here
   MsgPlus.AddTimer("MyTimer", 500); //Repeat
}
}
This will create a "timed loop", and when you're done with it, you need to stop the timer with MsgPlus.CancelTimer("MyTimer") and make sure that MsgPlus.AddTimer doesn't get called again. :)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
09-16-2007 10:01 AM
Profile E-Mail PM Web Find Quote Report
Drakal
Junior Member
**

Avatar
Ohh no! im in the warp hole!!

Posts: 32
– / Male / Flag
Joined: Jun 2007
O.P. RE: Progresbar
thx.. now i se that my old timer didnt loop :P but what should "oPlusWnd" be? window worked befor and window was  msgplus.createwnd(....) but now in timer it just opens alot of windows until it reaches 100%
Scripts in progres:
AIOS??% 3050 lines (1800 lines more in the xml files) and 6 Mb (total)
(renamed from bad word filter.. it can do more than filter words now:P):
Programs in progres:
a calculator (name: Mini): ??% 3600 lines :O and 280 Kb (it was 100 lines first but my friend wanted it a little bit more advanced)
--------------
Sorry for my english.. im not so good
09-16-2007 12:02 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: Progresbar
quote:
Originally posted by Drakal
thx.. now i se that my old timer didnt loop :P but what should "oPlusWnd" be? window worked befor and window was  msgplus.createwnd(....) but now in timer it just opens alot of windows until it reaches 100%
You'll need to create a global variable and set that to the created window, and when it's destroyed you clear the variable again. When you declare it as global, you can use it wherever you like. I think you'll understand it better with the following style example:
code:
var MainWnd = false;

function OpenThingy() {
   MainWnd = MsgPlus.CreateWnd("XML", "WINDOWID");
   //Other stuff, like the timer
   Progress_SetStep(MainWnd.Handle, "PROGRESS", 10);
   MsgPlus.AddTimer("MyTimer", 500);
}

function OnEvent_Timer(sTimerId) {
   if(sTimerId == "MyTimer" && MainWnd != false) {
      //Do timer stuff
      Progress_StepIt(MainWnd.Handle, "PROGRESS");
      //Re-create timer
      MsgPlus.AddTimer("MyTimer", 500);
   }
}

function OnWINDOWIDEvent_Destroyed(PlusWnd) {
   MsgPlus.CancelTimer("MyTimer"); //Cancel timer
   MainWnd = false; //Clear global variable
}
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
09-16-2007 05:25 PM
Profile E-Mail PM Web Find Quote Report
Drakal
Junior Member
**

Avatar
Ohh no! im in the warp hole!!

Posts: 32
– / Male / Flag
Joined: Jun 2007
O.P. RE: Progresbar
code:
function Progress_SetStep(PlusWnd, CtrlId, nStepInc) {
return PlusWnd.SendControlMessage(CtrlId, /*PBM_SETSTEP*/ 0x404, nStepInc, 0);
}
it is some thing wrong in this code. debug says something about objects on the line "return PlusWnd.SendCont...." :S
Scripts in progres:
AIOS??% 3050 lines (1800 lines more in the xml files) and 6 Mb (total)
(renamed from bad word filter.. it can do more than filter words now:P):
Programs in progres:
a calculator (name: Mini): ??% 3600 lines :O and 280 Kb (it was 100 lines first but my friend wanted it a little bit more advanced)
--------------
Sorry for my english.. im not so good
09-17-2007 01:43 PM
Profile PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On