Jump to content
Sign in to follow this  
rcmaehl

How can I compress this

Recommended Posts

rcmaehl

Any ways I can reduce the lines of code on this? 1500+ is a lot of code and I'm sure there's some redundant code.

I had to pastebin it because the code was too big.

http://pastebin.com/eUViaNNQ


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites
Rogue5099

Something simple instead of all the GUICtrlSetBKColor:

GUICtrlSetDefBkColor(0xFFFFFF)

Use a Loop for your Labels:

$ypos = 10
For $i = 65 to 90
    $ypos = $ypos + 15
    GUICtrlCreateLabel(Chr($i) & ":\", 10, $ypos)
Next

Just use more loops like this also could create Arrays for drives

Share this post


Link to post
Share on other sites
rcmaehl

Something simple instead of all the GUICtrlSetBKColor:

GUICtrlSetDefBkColor(0xFFFFFF)

Use a Loop for your Labels:

$ypos = 10
For $i = 65 to 90
    $ypos = $ypos + 15
    GUICtrlCreateLabel(Chr($i) & ":\", 10, $ypos)
Next

Just use more loops like this also could create Arrays for drives

Thanks a lot. Any other recommendations?

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites
rcmaehl

Quick question, how to I set the BkColor back to default using GUICtrlSetDefBkColor()?


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
Share on other sites
martin

Thanks a lot. Any other recommendations?

I think the main thing is to learn to use arrays. They can save you a lot of time writing a script and maintaining it as well as making it easier to read.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Rogue5099

Quick question, how to I set the BkColor back to default using GUICtrlSetDefBkColor()?

Yes in script everything after GUICtrlSetDefBkColor() will be that default so

GUICtrlSetDefBkColor(0xFFFF00) ;Yellow

label 1 ;yellow

label 2 ;yellow

GUICtrlSetDefBkColor0xFF0000) ;Red

label 3 ;Red

label 4 ;Red

GUICtrlSetDefBkColor(0xFFFF00) ;Yellow

label 5 ;yellow

label 6 ;yellow

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.