Using GetString andGetValue

Using GetString andGetValue

5

    May 15, 2021#1

    I understand that the parameter after GetString and GetValue is a prompt to get a response.
    I'm confused where the response gets stored. Can I define a variable to hold it so I can further use the value repetitively in the macro?
    If so, how to I insert the value in a specific location? Can I put a value after the insert command?

    Thanks

    6,602547
    Grand MasterGrand Master
    6,602547

      May 16, 2021#2

      UltraEdit macros do not support variables. The string/value entered by the user is written into active file at current position of the caret. For that reason many of my macros using GetString or GetValue move the caret first to top of the file, then call one of the two macro commands, use next command SelectToTop and Cut to cut the user input string/value to clipboard (usually one of the 9 user clipboards) and then use Paste or a non-regular expression or an UltraEdit regular expression replace with ^c to insert the user input string/value where needed in the file. A non-regular expression or an UltraEdit regular expression find can contain also ^c to reference the clipboard content of currently active clipboard.

      UltraEdit scripts support variables and for that reason the scripting commands UltraEdit.getString() and UltraEdit.getVaule() have two function parameters. The first function parameter is the prompt text and the second parameter is either 0 for writing the input string/value into active file at current caret position or 1 to return the string/value as a result of the function call for assigning it to a string or integer variable for further processing by the script.
      Best regards from an UC/UE/UES for Windows user from Austria

      5

        May 16, 2021#3

        Thank you very much

        1

          8:05 - Today#4

          It seems like you're referring to a programming context, but you haven't specified a particular programming language or framework. However, I can provide a general explanation.

          In many programming languages, when you use functions like GetString or GetValue, the response is stored in a variable that you define. Here's a hypothetical example in a generic programming language:
          # Example in Python user_input = GetString("Enter your name: ") print("Hello, " + user_input + "!")

          It seems like you're referring to a programming context, but you haven't specified a particular programming language or framework. However, I can provide a general explanation.
          In many programming languages, when you use functions like GetString or GetValue, the response is stored in a variable that you define. Here's a hypothetical example in a generic programming language:
          pythonCopy code
          # Example in Python
          user_input = GetString("Enter your name: ")
          print("Hello, " + user_input + "!")

          In this example, the user's response to the prompt is stored in the variable user_input. You can then use this variable as needed in the rest of your code.

          1
          NewbieNewbie
          1

            8:12 - Today#5

            Thanks a bunch for sharing your knowledge with me. Your passion for sharing and teaching is truly inspiring.