Jump to content

Concatenate a Func Name


 Share

Recommended Posts

Question:

Possible to Concatenate a Function's Name? Meaning, can I append a variable at the end of a Function? Note: Trying to avoid If Statements as a work-around

Example:

User Selects options A, B, or C. Then, the according Function is run:

Example_A ()

Example_B ()

Example_C ()

So then, can I make the Function look like?:

; Below is the Function Name Example with its trailing option of A, B, or C.
Example_ & $option ()

Thanks In Advance.

Link to comment
Share on other sites

Hi,

sorry, but for what? Why not the easy way?

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Ha! I was thinking this was the easy way...

In short, I would have to write another function for the If statements. Which, is not the end of the world, but in this instance it was easier to concatenate, than write another If Func.

If I have to write the If statements I can, but out of curiousity is it possible to do this?

Link to comment
Share on other sites

Hi,

$input = InputBox("A,B,C", "")

Call("Example_" & $input)

Func Example_A()
    MsgBox(0,"","A")
EndFunc
Func Example_B()
    MsgBox(0,"","B")
EndFunc
Func Example_C()
    MsgBox(0,"","C")
EndFunc

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Ahhh, yes I see what you mean....Thanks for the feedback.

HI,

no problem.

And I thought, it would be easier to do it like this:

Example(InputBox("A,B,C", ""))

Func Example($input)
    Switch $input
        Case "A"
            MsgBox(0, "Func: " & $input, "A")
        Case "B"
            MsgBox(0, "Func: " & $input, "B")
        Case "C"
            MsgBox(0, "Func: " & $input, "C")
    EndSwitch
EndFunc   ;==>Example

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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...