Sign in to follow this  
Followers 0
justt

How to flag different sections of script

6 posts in this topic

Pretty sure this is going to have a beyond obvious answer but I'll ask anways.

Normally I have a script that runes from lines 1-100. Say I want to place flags on every 10th line so if I wanted to I could have my GUI start at the beginning, or start on the 30th, 50th, 70th, etc line. What would I use for this?

Thanks for the help.

Share this post


Link to post
Share on other sites



justt,

It sounds like you are asking for a "GoTo" type instruction - AutoIt does not have one. So I think you will have to have some form of conditional structure (Switch, Select) where where the various Cases run separate sections of the code.

Could you let us see what you have at the moment - it might well be that I have completely the wrong end of the stick. :graduated:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thanks, yes essentially I'm looking for a GoTo line X command. I've thought about using Switch but it would just get very bloated, I would have full code from lines 1-100 under first Case, then 10-100 on next, 20-100 on next Case, etc. This would make the script very long, and if say my code is in the thousands it probably wouldn't be worth it.

For an example say I wanted to have the number 1-100 sent. Each line would be Send ("1"), Send ("2"), Send ("3"), etc all the way to line 100. I am looking for a way to tell my script to only begin sending from Send ("30") without having to actually write the code from Send ("30") to Send ("100"), it would just know to begin from the correct position on my code that sends 1-100.

Share this post


Link to post
Share on other sites

justt,

Is your code really as simple as Sending 1-100? I rather doubt it as the solution to that is trivial. ;)

Perhaps something along these lines might help you to structure your code:

$iStart = InputBox("Where to start?", "Enter 1-5")

Switch $iStart
    Case 1
        _A()
        ContinueCase
    Case 2
        _B()
        ContinueCase
    Case 3
        _C()
        ContinueCase
    Case 4
        _D()
        ContinueCase
    Case 5
        _E()
EndSwitch

Func _A()
    ConsoleWrite("Part 1" & @CRLF)
EndFunc

Func _B()
    ConsoleWrite("Part 2" & @CRLF)
EndFunc

Func _C()
    ConsoleWrite("Part 3" & @CRLF)
EndFunc

Func _D()
    ConsoleWrite("Part 4" & @CRLF)
EndFunc

Func _E()
    ConsoleWrite("Part 5" & @CRLF)
EndFunc

This way you start at the line you want and all subsequent lines are also actioned.

Any help? If not then give me a concrete example of what you want to do. :graduated:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Lol, yes the code is not exactly as simple as 1-100 but the situation is roughly the same. And thank you, ContinueCase is something can I can use to do what I needed, problem solved!

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  
Followers 0