Jump to content
Sign in to follow this  
gertsolo

Changing the number of a variable

Recommended Posts

gertsolo

Hey,

I have a function that I want to do a few times with other values for the variables.

I'm working with for example:

$file1 = "C:\Documents and Settings\Desktop\AutoIt\Webbuilding\msg1.txt"

$file2 = "C:\Documents and Settings\Desktop\AutoIt\Webbuilding\msg2.txt"

$file3 = "C:\Documents and Settings\Desktop\AutoIt\Webbuilding\msg3.txt"

I have 3 editboxes: $Edit1, $Edit2 and $Edit3

Some stuff in $file1 will be used in $Edit1, $file2 in $edit2, etc...

Is there a way where I can have an array or something that can be used to change the number 1, 2 and 3 of that $file1 and $Edit1 so that I don't have to do the stuff 3 times in a row, but in an for next loop.

thx


The more you learn, the less you know.

Share this post


Link to post
Share on other sites
martin

Hey,

I have a function that I want to do a few times with other values for the variables.

I'm working with for example:

$file1 = "C:\Documents and Settings\Desktop\AutoIt\Webbuilding\msg1.txt"

$file2 = "C:\Documents and Settings\Desktop\AutoIt\Webbuilding\msg2.txt"

$file3 = "C:\Documents and Settings\Desktop\AutoIt\Webbuilding\msg3.txt"

I have 3 editboxes: $Edit1, $Edit2 and $Edit3

Some stuff in $file1 will be used in $Edit1, $file2 in $edit2, etc...

Is there a way where I can have an array or something that can be used to change the number 1, 2 and 3 of that $file1 and $Edit1 so that I don't have to do the stuff 3 times in a row, but in an for next loop.

thx

DIm $edits[4],$Files[4]
for $n = 1 to 3
  $edits[$n] = GuiCtrlCreate("",x,y + ($n - 1)* verticalspacing,........)
next

for $n = 1 to 3
 $files[$n] = $file1 = "C:\Documents and Settings\Desktop\AutoIt\Webbuilding\msg" & $n & "1.txt"
next
.
.
.

 for $n = 1 to 3

    fn_to_do_whatever($edits[$n],$files[$n])
next

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
gertsolo

@ martin : thx ;)

@ TzarAlkex : no reply would have been better :P


The more you learn, the less you know.

Share this post


Link to post
Share on other sites
gertsolo

Did you even read that?? the example in the manual is using the same principle as martins code, they are the same.

ssst, silence is golden.


The more you learn, the less you know.

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  

×