Jump to content
Sign in to follow this  
JohnBailey

Progressbar According to TotalLineNumbers

Recommended Posts

JohnBailey

Is there a way to open a dialog box (either a GUI Creation or MsgBox) and post the script line accessed currently and showing the total script line amount.

I'm guessing something will use _FileCountLines () and @ScriptLineNumber

I don't even know if the first part is possible. Thanks


A decision is a powerful thing

Share this post


Link to post
Share on other sites
_Kurt

You basically have the answer, there are two ways of doing this:

;This is the first way
Msgbox(0,"",@ScriptLineNumber)oÝ÷ Øêí+0k&®¶­sb6æ6ÇVFRfÇC´fÆRæS2fwC° ¢b33c¶ÆæW2ÒôfÆT6÷VçDÆæW267&DgVÆÅF¤×6t&÷ÂgV÷C²gV÷C²Âb33c¶ÆæW2

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites
JohnBailey

Kurt,

I'm actually wanting to show the progress of the script being accessed. So, as the script goes line-by-line, a read out displays this progress. Ultimately I'm working toward the progressBar effect.


A decision is a powerful thing

Share this post


Link to post
Share on other sites
_Kurt

For the progressBar effect, simply use ProgressOn() and ProgressOff(). But I don't think this would work, the function doesn't "take enough time" to display in a progress bar. It would display and disappear since the function really takes 2.551 seconds (calculated from Scite).

Kurt

Edited by _Kurt

Awaiting Diablo III..

Share this post


Link to post
Share on other sites
JohnBailey

Kurt,

That's kind of cool though. I hadn't seen that function before (reading about it now). Thank you for letting me know how scite calculates.

Is there a way then to do it with just a dialog (MsgBox) and continually post where the script is at in comparison to the entire amount of lines?

At 10 of 98

that sort of thing

Thanks!


A decision is a powerful thing

Share this post


Link to post
Share on other sites
JohnBailey

Zenda, good point... any other ideas that would achieve this effect? I might just do percentage breaks or something.

However, do know any ways of accomplishing the method I first mentioned? Although it would still be buggy, I'd like to experiment with it.

Edited by JohnBailey

A decision is a powerful thing

Share this post


Link to post
Share on other sites
Helge

ProgressBar for this is bad idea.

When you have Loops or functions in your code then @ScriptLineNumber fall down at runtime.

When I was playing with TCP and UDP some months ago, I made a function for showing error-

messages, where I showed @error, @extended, @ScriptLineNumber plus some other stuff for

debugging. The way I did this was to add these macros as values for optional parameters in

my function, which wasn't meant to be used at all. Something like this if I recall it correctly :

ErrorDisplay("TCPListen failed !")

Func ErrorDisplay($sMsg, $iError = @error, $iExt = @extended, $iLine = @ScriptLineNumber)
    MsgBox(16, "Error", ...)
EndFunc

Share this post


Link to post
Share on other sites
Zedna

Zenda, good point... any other ideas that would achieve this effect? I might just do percentage breaks or something.

However, do know any ways of accomplishing the method I first mentioned? Although it would still be buggy, I'd like to experiment with it.

Make progressbar but not based on @ScriptLineNumber rather based on your own variable which will correspond to real progress of your script.

And my nick is Zedna :)

Share this post


Link to post
Share on other sites
JohnBailey

Zedna! haha Sorry about that! Thanks for pointing that out... I'm a goob :D:)

Great idea!! I really like it! It will take a bit more time, but will be WAY less buggy as you said. Do you know a good method for updating the progress bar with out closing it. I've been experimenting with the GUI progress bar but not sure how to use it and not close it.


A decision is a powerful thing

Share this post


Link to post
Share on other sites
Zedna

#include <GUIConstants.au3>

GUICreate(StringTrimRight(@ScriptName,4),220,100, -1,-1, $WS_CAPTION, $WS_EX_TOPMOST)
;GUISetBkColor (0xE0FFFF)

$progressbar = GUICtrlCreateProgress (10,15,200,20,$PBS_SMOOTH)
$procent = GUICtrlCreateLabel ('0 %', 10,40,200,20,$SS_CENTER)
$stop = GUICtrlCreateButton ("Stop",75,68,70,22,$BS_DEFPUSHBUTTON)

GUISetState()

$i = 0
While 1
  $msg = GUIGetMsg()

  If $msg = $stop OR $msg = $GUI_EVENT_CLOSE Then ExitLoop

  $i = $i + 1
  If $i > 100 Then $i = 0

  GUICtrlSetData ($progressbar,$i)
  GUICtrlSetData ($procent,$i & ' %')

  Sleep(100)
Wend

Edited by Zedna

Share this post


Link to post
Share on other sites
JohnBailey

Zedna, Your version works WAY better than mine!! Thanks! Your logic is... more logical :) Thanks again!


A decision is a powerful thing

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.