Home > Community > Forums > Custom IC Design > SKILL code to get user input from the CIW

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 SKILL code to get user input from the CIW 

Last post Mon, Oct 21 2013 12:57 PM by thomas1000. 9 replies.
Started by thomas1000 17 Oct 2013 02:58 PM. Topic has 9 replies and 2718 views
Page 1 of 1 (10 items)
Sort Posts:
  • Thu, Oct 17 2013 2:58 PM

    SKILL code to get user input from the CIW Reply

    This should be the easiest thing to do but I cannot find it in the documentation.  What command(s) are needed to prompt and receive user keyboard input from the CIW from a SKILL routine?  I am not looking for a custom user form - more on the order of one line of code or two at the most.  I don't want to get the input from a file - I want to enter it with the keyboard.

    Filed under:
    • Post Points: 20
  • Fri, Oct 18 2013 9:41 AM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,570
    • Points 15,605
    Re: SKILL code to get user input from the CIW Reply

    Hi Thomas,

    You could try enterString() - the documentation says that the string / entry is terminated when [Enter] is pressed. I have not played with this for a very long time, but I think it should fit your requirements.

    Regards,

    Lawrence

    • Post Points: 20
  • Mon, Oct 21 2013 11:23 AM

    Re: SKILL code to get user input from the CIW Reply

     Thanks but I created a procedure to do this and it didn't seem to work.  My procedure was

    procedure(test()
        a = enterString()
    )

    When I run it, it immediately returns and there is no opportunity to enter the string.  If I try to enter the string I get an error saying that the string is undefined.

    • Post Points: 35
  • Mon, Oct 21 2013 11:30 AM

    Re: SKILL code to get user input from the CIW Reply

    If you do:

     procedure(test()
        a = enterString(?prompts list("do this"))
        printf("The value of a was %L\n" a)
    )

    And then call test() - you need to type the string you want in quotation marks, otherwise it won't read it.

    I doubt this is really what you want. The CIW is not really intended for you to read responses from the user. Why not create a form?

    Andrew.

    • Post Points: 5
  • Mon, Oct 21 2013 11:33 AM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,570
    • Points 15,605
    Re: SKILL code to get user input from the CIW Reply

    Hi Thomas,

    Sorry to hear that it doesn't work - what are you trying to achieve?  Perhaps the string could be an argument for a procedure, i.e. gather the input before running?  Why not a small form to interact with the user to gather feedback?  Is the information being obtained a general-purpose text string, or is it a more specific purpose (e.g. a point list)?  Helping us to understand the problem better will elicit better responses.

    Regards,

    Lawrence.

    • Post Points: 20
  • Mon, Oct 21 2013 11:40 AM

    Re: SKILL code to get user input from the CIW Reply

    I don't want to be critical of SKILL but I have evidently been spoiled by other languages.  In VB you have an input statement and it creates a small form that you can use to enter values.  Everytime I look at the amount of code required for a form it is about 4 or 5 times as much code as my original application, which is very short.

     What I want to do is prompt for a number and have the user type the number (without quotes) and then use that number in a calculation.  A form would be nice but I thought I had remembered from class about 10 years back that there was something about 1 line long - maybe that memory was imagined.

    • Post Points: 20
  • Mon, Oct 21 2013 11:43 AM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,570
    • Points 15,605
    Re: SKILL code to get user input from the CIW Reply

    Hi Thomas,

    Have you tried enterNumber()?

    regards,

    Lawrence.

    • Post Points: 20
  • Mon, Oct 21 2013 11:55 AM

    Re: SKILL code to get user input from the CIW Reply

    Taking a cue from Andrew's post, I tried the following:

    procedure(test()
     a = enterNumber(?prompts list("Enter a number"))
     printf("That number squared is %f\n" a**2)
    )

    However, when I type test in the CIW, the routine proceeds without stopping for user input (this is not the final application).  If you try to enter a number it does not compute its squared value.  It simply blows right past all of that.  if you type, a, in the CIW, it is undefined but since my procedure made it global, it is evident that a was never assigned.

    • Post Points: 20
  • Mon, Oct 21 2013 12:54 PM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,570
    • Points 15,605
    Re: SKILL code to get user input from the CIW Reply

    Hi Thomas,

    Here's a quick and dirty example of creating a simple form to get the user input:

    
    ;; this is an example of using the input value
    procedure(CCFuseNum(form) printf("You entered: %L\n" form->CCFGetNumFloatField->value))
    
    ;; this is the simple form to get the number
    hiDisplayForm(
      hiCreateAppForm(?name 'CCFGetNum 
        ?fields    list( list(
                     hiCreateFloatField(?name 'CCFGetNumFloatField ?prompt "Enter number:")
                     0:0 130:30 80
                     )
                   )
        ?formTitle "Get Num"
        ?callback  'CCFuseNum
        ?dialogStyle 'modal)
    )

    There are more arguments to the hiCreateAppForm() function to control the appearance of the form etc.
    I've made the form "modal" so that the user has to interact with the form (OK/Cancel) before moving on
    to the next task.  The form structure is global, so you can access it any time after it was called, e.g.
      CCFGetNum->CCFGetNumFloatField->value
    so you do not have to use the form callback if you do not want to.

    I hope this helps you.

    Regards,

    Lawrence.

    • Post Points: 20
  • Mon, Oct 21 2013 12:57 PM

    Re: SKILL code to get user input from the CIW Reply

    Thanks - that looks a lot better than the other form code I have seen.  I will try it.

    • Post Points: 5
Page 1 of 1 (10 items)
Sort Posts:
Started by thomas1000 at 17 Oct 2013 02:58 PM. Topic has 9 replies.