Sign in to follow this  
Followers 0
Mbee

Need help with ProgressOn() size calculations, etc

7 posts in this topic

#1 ·  Posted (edited)

SUMMARY: I do NOT want to create a GUI for my app, but instead I want to use the built-in ProgressOn() function.   However, I need help calculating and adjusting the size of the built-in ProgressOn window.   Please do NOT ask me to use AutoIt's GUI functions!

DETAILS:

I have developed a working, non-GUI AutoIt utility that includes the standard progress bar using ProgessOn().  However, the width of the "subtext" parameter in that function call I'm using is variable and can theoretically reach 259 characters. Therefore, if and when I need to increase the width of the progress bar window to try to accommodate as much of that string as possible (without exceeding the width of the screen), I need to be able to calculate the actual number of pixels that the subtext string will consume.

I found Melba23's great >StringSize function, but while I'd like to use it for this purpose, it requires parameters that I have no idea how to determine and specify!  StringSize() wants the following values that I don't know: Font size in points, font weight, font attribute, and font name.  You see, I can't find any AutoIt functions that return these values from the ProgressOn() window or controls (or any other window or control, for that matter).  If the ProgessOn() function were much more fully documented, I could read up and simply enter those values manually in the code, but it's definitely not fully documented (nor is the source code available, since AutoIt isn't open source, not even for that one function - but how I dearly wish I could see it! o:) )

Now, I've found the following thread extremely useful: >[sOLVED] ProgressOn(): Can I set the SIZE of the window? It shows a work-around for adjusting the size and getting basic access to the controls, which is completely mandatory for my needs.  But that is definitely not enough, because I cannot calculate what size it should be for the variable-length "subtext" string without something like Melba23's StringSize(), but I cannot use StringSize() because I don't know the values of the arguments I listed above are. So I'm stuck!

To answer the possible question about why I don't use the GUICtrlCreateProgress() function described in the link above, the answer is twofold: (1) The utility I developed not only doesn't need a GUI, it would be extremely clumsy to have one; and (2): I spent some time trying to use GUICtrlCreateProgress(), but I failed because that function isn't capable of being used alone outside of a complete GUI interface (which is not only counter-productive, but I'm also not yet up to speed creating GUIs with AutoIt so far).

Kindly help me out with this dilemma, please.

I apologize for the long post, but I've always found that being forced to put my questions very clearly in writing helps myself as well as the reader (at least those with good attention spans  :bye:)...

Edited by Mbee

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

uggg...

word wall. :ermm:

Please shorten your post to just what you need to know and cut the other stuff out. When you do long post like this you will most likely get ignored for it annoys the person reading it. Remember - when you want help in the forum: it isn't about you. It is about the person you want to help you.  If anything post a SIMPLE example of your code that shows your problem. That works well when explaining a code problem.

possible solutions:

1. limit the amount of text shown. If the string is longer that the limit then simply trim the string first.

2. Use a carriage return in your string to allow for long strings.

3. Have the text be displayed in a text box with a scroll bar.

4. Hard code the font used in the progress bar.

Edited by MBALZESHARI

Share this post


Link to post
Share on other sites

You can find all of that information in the help file under GUICtrlSetFont.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

uggg...

word wall. :ermm:

Please shorten your post to just what you need to know and cut the other stuff out. When you do long post like this you will most likely get ignored for it annoys the person reading it. Remember - when you want help in the forum: it isn't about you. It is about the person you want to help you.  If anything post a SIMPLE example of your code that shows your problem. That works well when explaining a code problem.

possible solutions:

1. limit the amount of text shown. If the string is longer that the limit then simply trim the string first.

2. Use a carriage return in your string to allow for long strings.

3. Have the text be displayed in a text box with a scroll bar.

4. Hard code the font used in the progress bar.

 

That's very harsh. I've been instructed for decades now that bar far, the best practice is to explain what is needed in full detail.  I'm sorry you don't like details, but is it possible that is your personal preference?  I will change it to put a quick summary at the top, but two responses here already have misunderstood almost entirely what I'm asking for.  I do not believe that is because of it's length, but because few programmers are willing to read more than a few words, which is certainly not my fault.

In reply to your possible solutions:

(1) The text in question will be the name of one of perhaps hundreds of folder names, which will usually be of reasonable length, but can be up to 255 chars long.  Chopping the folder name at some arbitrary point would be nearly useless.

(2) The carriage return idea is marginal, but I agree that there's some value there.  Thank you.

As for 3 & 4, you have clearly failed to read my OP with any care, since I'm trying to use the ProgressOn() function, which does NOT allow you to use a scroll bar -or- let you specify a font.

Share this post


Link to post
Share on other sites

You can find all of that information in the help file under GUICtrlSetFont.

 

It seems that I can't actually do that, since I am using the built-in ProgressOn() function. Therefore, I cannot use GUICtrlSetFont() because the control was not created by myself with a GUICtrlCreate() call, so I can't pass it the "control identifier (controlID) as returned by a GUICtrlCreate...() function".

If I'm mistaken about that, please explain.  Thank you.

Share this post


Link to post
Share on other sites

So make your own GUI with a progress bar and label, or use the one in my signature if you need to know how. It's not hard to create something like that, and the built-in function is fairly limited as to customization.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

That's very harsh. I've been instructed for decades now that bar far, the best practice is to explain what is needed in full detail.

 

No it isn't meant to be. I'm telling you to remember your audience. Many people want simply and clear, not long winded and going off on tangents (like you expressing wanting to read the AutoIt source code for example)

Can you explain why (your business need) you want the window to change size for each file copied? Is there any reason why the window can't be one size that isn't just a preference on your part? I'm asking for it seems to me you are making it much more difficult that it needs to be.  I re-read your post again - You say you don't need a GUI:

 

The utility I developed not only doesn't need a GUI, it would be extremely clumsy to have one;

 

So why are doing exactly what you say you do not need? Again, you write out a long winded post and you are VERY confusing with lots of un-needed information.

:blink:

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  
Followers 0