Jump to content

is this format right?


Recommended Posts

instead of asking how to do something at least i can ask some if something im doing is right.

$number = 1 to 25
$server = GUICtrlRead($ftpsite[$number])
$username = GUICtrlRead($ftplogin[$number])
$pass = GUICtrlRead($ftppass[$number])
$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass)
$Ftpp = _FtpPutFile($Conn, 'upload.tar', $Remote[$number])
$Ftpc = _FTPClose($Open)
$number = 1 + 1
Link to comment
Share on other sites

instead of asking how to do something at least i can ask some if something im doing is right.

For $number = 1 to 25 Step 1
$server = GUICtrlRead($ftpsite[$number])
$username = GUICtrlRead($ftplogin[$number])
$pass = GUICtrlRead($ftppass[$number])
$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass)
$Ftpp = _FtpPutFile($Conn, 'test.tar', $Remote[$number])
$Ftpc = _FTPClose($Open)
Next
Edited by supadodger
Link to comment
Share on other sites

instead of asking how to do something at least i can ask some if something im doing is right.

$number = 1 to 25
$server = GUICtrlRead($ftpsite[$number])
$username = GUICtrlRead($ftplogin[$number])
$pass = GUICtrlRead($ftppass[$number])
$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass)
$Ftpp = _FtpPutFile($Conn, 'upload.tar', $Remote[$number])
$Ftpc = _FTPClose($Open)
$number = 1 + 1oÝ÷ Ûú®¢×­)ä
-Ö®¶­sdf÷"b33c¶çVÖ&W"ÒFò#R7FW¢b33c·6W'fW"ÒuT7G&Å&VBb33c¶gG6FU²b33c¶çVÖ&W%Ò¢b33c·W6W&æÖRÒuT7G&Å&VBb33c¶gGÆövå²b33c¶çVÖ&W%Ò¢b33c·72ÒuT7G&Å&VBb33c¶gG75²b33c¶çVÖ&W%Ò¢b33c´÷VâÒôeE÷Vâb33´×eE6öçG&öÂb33²¢b33c´6öæâÒôeE6öææV7Bb33c´÷VâÂb33c·6W'fW"Âb33c·W6W&æÖRÂb33c·72¢b33c´gGÒôgGWDfÆRb33c´6öæâÂb33·FW7BçF"b33²Âb33cµ&VÖ÷FU²b33c¶çVÖ&W%Ò¢b33c´gG2ÒôeE6Æ÷6Rb33c´÷Vâ¥VçFÂb33c¶çVÖ&W"Ò#P
You're Getting close but since you went and used those useless AutoIt tags I can't read the code while I'm typing so this will just be from memory.

For To loops end in Next not Until. You can remove the Step 1 since that is the default. Your code will be along these lines

For $i = 1 to 25

;;; Put the code that is run in the loop here

Next

Then test what you have left. Thanks for making an attempt before posting which is something that far too many people do as it is.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

this is what i have

For $number = 25 to 1 Step -1
$server = GUICtrlRead($ftpsite[$number])
$username = GUICtrlRead($ftplogin[$number])
$pass = GUICtrlRead($ftppass[$number])
$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass)
$Ftpp = _FtpPutFile($Conn, 'test.tar', $Remote[$number])
$Ftpc = _FTPClose($Open)
Next

ive also tried

For $number = 1 to 25 Step 1
$server = GUICtrlRead($ftpsite[$number])
$username = GUICtrlRead($ftplogin[$number])
$pass = GUICtrlRead($ftppass[$number])
$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass)
$Ftpp = _FtpPutFile($Conn, 'test.tar', $Remote[$number])
$Ftpc = _FTPClose($Open)
Next

this is my error

Subscript used with non-Array variable.:

Edited by supadodger
Link to comment
Share on other sites

this is what i have

For $number = 25 to 1 Step -1
$server = GUICtrlRead($ftpsite[$number])
$username = GUICtrlRead($ftplogin[$number])
$pass = GUICtrlRead($ftppass[$number])
$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass)
$Ftpp = _FtpPutFile($Conn, 'test.tar', $Remote[$number])
$Ftpc = _FTPClose($Open)
Next

ive also tried

For $number = 1 to 25 Step 1
$server = GUICtrlRead($ftpsite[$number])
$username = GUICtrlRead($ftplogin[$number])
$pass = GUICtrlRead($ftppass[$number])
$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass)
$Ftpp = _FtpPutFile($Conn, 'test.tar', $Remote[$number])
$Ftpc = _FTPClose($Open)
Next

this is my error

Subscript used with non-Array variable.:

That means that some (or all) of your arrays, $ftplogin and/or $ftppass and/or $Remote have not been created. They certainly have not been created in the code you posted so I assumed you have created them elsewhere.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

That means that some (or all) of your arrays, $ftplogin and/or $ftppass and/or $Remote have not been created. They certainly have not been created in the code you posted so I assumed you have created them elsewhere.

okay so as i understand autoit code i have got to go learn arrays now

even without creating an array it would make sense for it to work.

i mean whats on the screen without an array makes perfect sense.

add 1 to the $variable every step.

i have like 300 things to create an array for if i cant call them like that lol.

Link to comment
Share on other sites

Thats the idea.

Now here is an example of what's happening to you using your code

$ftppass[$number]

If the loop is at 15 ($number) for example then You are asking it to return the value from element number 15 in the Array $ftppass. If that element does not exist then it will error out. On top of that you are using $ftppass[$number] inside a GUICtrlRead() function call which then means read the value of the control that has the id of whatever the value is in element 15 (following the example above) and although that can be done, it doesn't read as a logical concept to me. There would be easier ways to do that.

If you still have problems then I suggest that you post your entire code (if possible) and a brief outline of what you are attempting to do. That will enable use to see what you are doing and suggest where it can be fixed and/or improved.

I'm calling it a night but others will probably be around to assist you.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I was going to do part of it, and let you do the rest for practice, but to get rid of the runtime errors I pretty much had to clean it all up. I tend to learn faster by doing, rather than reading, so maybe if you work with this it will start to make sense.

CODE
#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

Global $ftplogin[26], $ftppass[26], $ftpsite[26], $siteurl[26], $sitelogin[26], $sitepass[26]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$Form1 = GUICreate("Dialog", 1025, 739, 0, 0)

$Button1 = GUICtrlCreateButton("more options", 912, 688, 99, 41, 0)

$SaveButton = GUICtrlCreateButton("Save and Go", 912, 640, 99, 41, 0)

GUISetIcon("D:\009.ico")

GUICtrlCreateGroup("FTP LOGINS", 8, 0, 137, 633)

$y = 0

For $x = 1 to 25

$y += 24

$ftplogin[$x] = GUICtrlCreateInput("", 16, $y, 121, 21)

Next

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUICtrlCreateGroup("FTP PASSWORDS", 144, 0, 137, 633)

$y = 0

For $x = 1 to 25

$y += 24

$ftppass[$x] = GUICtrlCreateInput("", 152, $y, 121, 21)

Next

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUICtrlCreateGroup("FTP SITE", 280, 0, 137, 633)

$y = 0

For $x = 1 to 25

$y += 24

$ftpsite[$x] = GUICtrlCreateInput("", 288, $y, 121, 21)

Next

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUICtrlCreateGroup("MAIN site URL ending in /", 416, 0, 337, 633)

$y = 0

For $x = 1 to 25

$y += 24

$siteurl[$x] = GUICtrlCreateInput("", 424, $y, 321, 21)

Next

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUICtrlCreateGroup("site LOGIN", 752, 0, 137, 633)

$y = 0

For $x = 1 to 25

$y += 24

$sitelogin[$x] = GUICtrlCreateInput("", 760, $y, 121, 21)

Next

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUICtrlCreateGroup("site PASSWORD", 888, 0, 137, 633)

$y = 0

For $x = 1 to 25

$y += 24

$sitepass[$x] = GUICtrlCreateInput("", 896, $y, 121, 21)

Next

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUISetState(@SW_SHOW)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $ftplogin[1]

msgbox (0,"",GUICtrlRead($ftplogin[1]))

Case $savebutton

Write_INI_File()

EndSwitch

WEnd

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Func Write_INI_File()

For $x = 1 to 25

IniWrite ( "test.ini", "ftplogins", "key" & $x, $ftplogin[$x])

IniWrite ( "test.ini", "ftppasswords", "key" & $x, $ftppass[$x])

IniWrite ( "test.ini", "sitepasswords", "key" & $x, $sitepass[$x])

IniWrite ( "test.ini", "sitelogins", "key" & $x, $sitelogin[$x])

IniWrite ( "test.ini", "ftpsites", "key" & $x, $ftpsite[$x])

IniWrite ( "test.ini", "siteurls", "key" & $x, $siteurl[$x])

Next

EndFunc

Edit: left out a reset of $y variable

Edit2: put $siteurl input back to your original width

Edited by Spiff59
Link to comment
Share on other sites

Edit 3: Need to add GUICtrlRead() in your INIWrite lines :D

IniWrite ( "test.ini", "ftplogins", "key" & $x, GUICtrlRead($ftplogin[$x]))
Oops! I'd fixed his Msgbox() with the same problem, but didn't notice those. Writing the control ID's to his file wouldn't be of much use. Good catch, MrMitchell.

Comment/question: I had had his code indented all pretty. So, after 250 posts, am I missing something? When posting code, the 'Autoit' tags don't work at times (half the devs, mods, mvps don't use them), and the 'codebox' tags trash formatting, so we're left with having to paste long code examples using the 'code' tags and everyone has to scroll forever to get to the next post in a thread?

Edited by Spiff59
Link to comment
Share on other sites

The primary problem of the tags turning the code into garbage seems to appear only when more than one code block is used in a post. Most of us avoid using them because of that because it's not uncommon to use two or more code blocks. Code tages do not affect indenting, just the opposite, they will preserve indenting. Quote blocks will not preserve indenting. To shorten the pages you can use the codebox tags. The only thing the autoit tags give you is syntax coloring and I never use that in editors either so I don't miss it at all.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

The primary problem of the tags turning the code into garbage seems to appear only when more than one code block is used in a post. Most of us avoid using them because of that because it's not uncommon to use two or more code blocks. Code tages do not affect indenting, just the opposite, they will preserve indenting. Quote blocks will not preserve indenting. To shorten the pages you can use the codebox tags. The only thing the autoit tags give you is syntax coloring and I never use that in editors either so I don't miss it at all.

This appears to be the failed sequence of events for me at times (and it is repeatable):

1. Paste code into a reply.

2. Highlight it.

3. Hit the "code" icon to wrap it in tags

4. Decide it's a bit too long to insert as "code", so manually insert "box" after the starting and ending tags to make them "codebox".

All leading tabs will be stripped from the pasted script.

What's the right procedure?

Edit: PS - supadodger: I do apologize for hijacking your thread. I hope your frustration is over and that you're now making progress?

Edited by Spiff59
Link to comment
Share on other sites

Nothing. I had forgotten that Codebox strips the indentation. The reason for not using AutoIt tags is evident above in one of my replies.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...