Results 1 to 5 of 5

Thread: console scripts

  1. #1
    Member
    Join Date
    Jan 2007
    Age
    76
    Posts
    426
    Rep Power
    60

    console scripts

    If we write small sections of code using the console that we think would be useful to beginners, is this the right place to put them?

    Here is an example of what I mean:

    [code=thinbasic]
    Uses "CONSOLE"
    'define variables so program knows them
    %Menu_Color_Normal = 7
    dim Choose_type as string
    dim Result as string
    DIM Fruit_type as string

    'comsole_printat doesn't let the cursor drop down to the next line
    'the first CONSOLE_WRITELINE does that. The second CONSOLE_WRITE_LINE
    'provides a blank line
    console_printat("What do you like better? ",0 ,0, %Menu_Color_Normal)
    console_writeline("")
    console_writeline("")
    console_writeline("Type of fruit?")
    console_writeline("(A)pple, (B)anana, or (P)ear")
    Choose_type = %false
    WHILE Choose_type = %FALSE

    '---Read keyboard input
    Result = Console_inKeyb


    '---Handle returned string
    select case Result


    case "a","A"
    Fruit_Type = "Apple"
    Choose_type = %true
    case "b","B"
    Fruit_Type = "Banana"
    Choose_type = %true
    case "p","P"
    Fruit_type = "Pear"
    Choose_type = %TRUE
    end select
    wend

    console_writeline("")

    console_writeline("Your choice: " & Fruit_type)


    Console_SetCursorPosition(30, 23)

    Console_WriteLine("Press any key to exit.")

    Console_WaitKey[/code]

    If this isn't the right place for such please let me know.

  2. #2
    thinBasic MVPs Michael Hartlef's Avatar
    Join Date
    Sep 2006
    Location
    Germany
    Age
    58
    Posts
    3,299
    Rep Power
    348

    Re: console scripts

    Thanks for the script, the more resources to learn from, the better.

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Re: console scripts

    For the moment it is ok.
    A possibility coul be to add a sub-form of Console with code snipets. I can arrange if you like, no problem.

    Regarding code, when you post it, use "GeShi" tag instead of code tag. GeShi is an automatic syntax coloring tool. Just choose "thinBasic" from GeShi drop down and put you code inside. It will be automatically colored.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Re: console scripts

    OK, I've decided to add 2 new sub-forums in Console module forum regarding source code posts.
    I will do the same for other specific forums as soon as there will be some interest.

    If you will create some other examples and you think they will be useful to other people, please post them here.

    Ciao and thanks
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #5
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    68
    Posts
    3,865
    Rep Power
    405

    Re: console scripts

    That is great that you have a script example already Sandy. Thanks. Nothing like learning from looking at example code.

    I think having special script subfolders for the main categories is a good idea. It will make it easier to find additional samples.

    It might even be good to have links in the help for each module that has a special script subfolder, this way one looking for more help could click on the link and be in the correct folder to look up more examples.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

Similar Threads

  1. MOVED: console scripts
    By ErosOlmi in forum Console
    Replies: 0
    Last Post: 16-02-2007, 01:15

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •