How to execute certain scripts based on what user selected. (If possible)



  • Hi I was wondering if its possible to run certain scripts based on what a person selected before running a program. Example, if theres is 3 options (option 1, option2, option 3) and they select option 1 I want it to run the option 1 script instead of running all the scripts. I hope this makes sense and if anyone can help me :)!



  • Yes, you just need to use resouce of type "select".
    There are 4 sub types of "select" >

    Combo
    Radio
    Check
    DragAndDrop

    So create desired "select" type that suits best your needs.
    Organize your script in functions, so that each function executes
    code of specific actions needed, and than simply call such functions
    based on user selection from "select" resource type.



  • @GaG Hi there thanks for the response but im still confused. Below you can see my choice options but if i wanna do email verified only what would i fill in for the function? You can also see below what i tried to do but i dont think it will work.
    d53bf68b-4d46-4f4c-be9b-7a108e875871-image.png
    e195f1dd-3d47-4b35-a77a-22b91016f915-image.png



  • Here is an minimalistic example.
    It has 2 functions, first is opening google and second yahoo.

    SelectFunction.xml

    You can open this script posted on forum directly in BAS:

    Project > Open From URL

    2022-08-30_084440.png



  • @GaG Ok thank you it worked :)! I also have one more question if you can help me with it. I have an option to put text into for example like an api key before you start the program but i cannot seem to get the text from what the user put so I can use it. I dont know if that makes sense but I hope it does. Below you can see the text input im talking about. I basically wanna do something like this use GET https://example.com/api-key={{API KEY}} something like that but of course replace the link with another link.
    9515122d-df4d-4557-9131-315a7314e37f-image.png



  • Propper way to thank anyone on this forum is
    by clicking on UPVOTE button >
    2022-09-01_202918.png

    @WolfBeasty said in How to execute certain scripts based on what user selected. (If possible):

    @GaG Ok thank you it worked :)! I also have one more question if you can help me with it. I have an option to put text into for example like an api key before you start the program but i cannot seem to get the text from what the user put so I can use it. I dont know if that makes sense but I hope it does. Below you can see the text input im talking about. I basically wanna do something like this use GET https://example.com/api-key={{API KEY}} something like that but of course replace the link with another link.
    9515122d-df4d-4557-9131-315a7314e37f-image.png

    Just create new resource of type "FixedString" and use it in the script
    like you described.


Log in to reply