Jump to content
Macro Express Forums

Limiting Length Of String Variable


polishmafia
 Share

Recommended Posts

Hi everyone.

 

I just joined this forum today, and have been using MacroExpress for a few months off and on. I tried searching for my answer, but I'm not exactly sure what I should be searching for :(

 

The macro I am currently working on asks the user for a variety of string inputs, all via the Set String via Prompt.

 

One variable the macro asks for is the person's name. Is there a way I can limit the input box to 15 characters max?

 

I thought of trimming the string starting at position 1, and trimming everything else past 15 characters. I would prefer to have MacroExpress not let the user type in more than 15 characters.

 

Any ideas? Thanks in advance!

Link to comment
Share on other sites

There is not a way to limit the number of characters that the user enters using the Variable Set String from Prompt command. But, as you have pointed out, you can trim the length after the fact. You could include the maximum number of allowed characters in the input prompt and then trim it after the user clicks the OK button. For example: 'Enter name (15 chars max)'

 

You may also be able to use the .hta forms to input the name. But I do not know if a field in a .hta form allows you to limit the number of characters that are entered. An example macro that uses a .hta form can be found here: http://pgmacros.com/community/index.php?showtopic=248

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...