Jump to content
Sign in to follow this  
mike1305

is there any way to compact this piece of code?

Recommended Posts

mike1305

$variables = $program[1][0] & "|" & $program[2][0] & "|" & $program[3][0] & "|" & $program[4][0] & "|" & $program[5][0] & "|" & $program[6][0] & "|" & $program[7][0] & "|" & $program[8][0] & "|" & $program[9][0] & "|" & $program[10][0] & "|" & $program[11][0] & "|" & $program[12][0] & "|" & $program[13][0] & "|" & $program[14][0] & "|" & $program[15][0] & "|" & $program[16][0] & "|" & $program[17][0] & "|" & $program[18][0] & "|" & $program[19][0] & "|" & $program[20][0] & "|" & $program[21][0] & "|" & $program[22][0] & "|" & $program[23][0] & "|" & $program[24][0] & "|" & $program[25][0] & "|" & $program[26][0] & "|" & $program[27][0] & "|" & $program[28][0] & "|" & $program[29][0] & "|" & $program[30][0] & "|" & $program[31][0] & "|" & $program[32][0]

    GUICtrlSetData($combo, $variables, "Main Programs")

the only way I can think of would be to make an input field, use a for..next loop to send the array to the input, then read from the input...that is just dumb though. I cant think of any other ways.. :P


Amp Energy Drink: the official sponsor of me scripting at 2AM.

Share this post


Link to post
Share on other sites
Jos

$variables = $program[1][0]
For $x = 2 to 32
    $variables &=  "|" & $program[$x][0]
Next
GUICtrlSetData($combo, $variables, "Main Programs")

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
mike1305

Sweet, thanks! How do you guys figure out this stuff? I never saw anything about it in the help file, but then again, I really didnt know what to search for as far as key words go...

thanks!


Amp Energy Drink: the official sponsor of me scripting at 2AM.

Share this post


Link to post
Share on other sites
GaryFrost

Sweet, thanks! How do you guys figure out this stuff? I never saw anything about it in the help file, but then again, I really didnt know what to search for as far as key words go...

thanks!

simple, your repeating the same thing over and over, therefor a loop, either for next loop or while depending on the situation.

in this situation you need to keep adding to the string or concatinate, look for Language Reference then Operators in the help.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
mwpeck

They probably have A) Done other programming before or B) Just made sense of the help file. I personally havnt had to use the help file much(except for syntax on some things) because i've done coding in a ton of other languages.

Edited by mwpeck

Share this post


Link to post
Share on other sites
mike1305

simple, your repeating the same thing over and over, therefor a loop, either for next loop or while depending on the situation.

in this situation you need to keep adding to the string or concatinate, look for Language Reference then Operators in the help.

I am referring to the whole "&=" syntax.


Amp Energy Drink: the official sponsor of me scripting at 2AM.

Share this post


Link to post
Share on other sites
GaryFrost

They probably have A) Done other programming before or :P Just made sense of the help file. I personally havnt had to use the help file much(except for syntax on some things) because i've done coding in a ton of other languages.

C) Both


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
Jos

Sweet, thanks! How do you guys figure out this stuff? I never saw anything about it in the help file, but then again, I really didnt know what to search for as far as key words go...

thanks!

A Helpfile is not intended to teach you how to program, its a refference for how to code the different functions.

To learn a programming language is all about what syntax ('Words") to use, but learning to create a program is all about learning to think in steps and how to code these steps.....

:P


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
mike1305

The script is at about 80% right now. So far it is two seperate scripts (I'm nervous of any complications with varaibles or the likes) and a seperate ini file. About 1,000 lines of code, nicely formatted and labeled. :P

I will make sure to note every line of the code before I post in the scripts section. I think it will be useful to any other people who are in the same situation I am in (repeated installs of programs on multiple systems) which seems like more than a few.


Amp Energy Drink: the official sponsor of me scripting at 2AM.

Share this post


Link to post
Share on other sites
mike1305

Help file Operators

allright, thanks. I was searching for "adding to a variable" but I couldn't get it. :P


Amp Energy Drink: the official sponsor of me scripting at 2AM.

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  

×