Jump to content

Recommended Posts

Posted (edited)

I would like to create a loop to call Main procedure a shown below, and would like to know on how loop and call between procedures work within AutoIT.

Does anyone have any suggestions?
Thanks in advance for any suggestions
======================================================================================

Sub Input_Loop()

For i = "a" to "z"

Main (i)

Next i

End Sub

Sub Main ( $Input_Char as String)

Local Const $sFilePath = "D:\Temp_" & $Input & ".txt"; which become "D:\Temp_k.txt" as return
Local $Input = $Input_Char

Local $hFileOpen = FileOpen("D:\Temp_" & $Input & ".txt", 2) ; which become "D:\Temp_k.txt" as return
FileWrite($hFileOpen, $Input & @CRLF)
FileClose($hFileOpen)

End Sub

 

Edited by oemript
  • Moderators
Posted

oemript,

If you use Chr then you can get the loop to work:

For $i = 97 To 122
    _Main(Chr($i))
Next

Func _Main($sChar)
    ConsoleWrite($sChar & @CRLF)
EndFunc

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted (edited)
  On 3/4/2018 at 11:17 AM, Melba23 said:

oemript,

If you use Chr then you can get the loop to work:

For $i = 97 To 122
    _Main(Chr($i))
Next

Func _Main($sChar)
    ConsoleWrite($sChar & @CRLF)
EndFunc

M23

Expand  

For following codes, I need to add the $sChar into FilePath as well.

Local Const $sFilePath = "D:\Temp_" & $sChar & ".txt"; which become "D:\Temp_k.txt" as return

Local $hFileOpen = FileOpen("D:\Temp_" & $sChar & ".txt", 2) ; which become "D:\Temp_k.txt" as return

Do you have any suggestions on how to join the string together within AutoIT?
Thank you very much for any suggestions (^v^)

 

Edited by oemript
  • Moderators
Posted (edited)

 

oemript,

  Quote

Do you have any suggestions

Expand  

Have you checked to see it what you have works? It looks to me as if it should:

For $i = 97 To 122
    _Main(Chr($i))
Next

Func _Main($sChar)
    ConsoleWrite("D:\Temp_" & $sChar & ".txt" & @CRLF)
EndFunc

M23

Edit: When you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily.

 

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted (edited)

I would like to know on whether ErrorStdOut is Error or not.

For_Loop.png

Do you have any suggestions?
Thank you very much for any suggestions (^v^)

 

Edited by oemript
  • Developers
Posted
  On 3/4/2018 at 1:00 PM, oemript said:

I would like to know on whether ErrorStdOut is Error or not.

Expand  

I don't understand the question, please elaborate.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Please see following image, there is "ErrorStdOut", I would like to know on whether it is Error or not.

For_Loop.png

Do you have any suggestions?
Thanks, to everyone very much for any suggestions (^v^)

  • Developers
Posted

All that parameter does is that AutoIt3 reports any messages to STDOUT/STDERR in stead of showing a MSGBOX, but I still don't understand what you are asking as you simply repeated what you typed before.... and I know I am slow but telling me twice the same things doesn't help much! :)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Moderators
Posted

oemript,

No, that is not the result of an error in your script - as Jos has pointed out above, it is a standard parameter to the wrapper function that SciTE uses when you run it so that any errors that you do have will appear in the SciTE console. Nothing to worry about!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

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