Jump to content
Macro Express Forums

Set Variable From Prompt - Multiple Lines Of Text


Graeme

Recommended Posts

Hi there,

 

I'm setting up a macro to automate creating html descriptions of products in a table which i can copy/paste into our website.

 

Basically I have the macro prompting for the user to input a series of values using the Set Text String Variables command, and the variables are then pasted into a html file in the correct places.

 

However, the Set Text String Variables command will only prompt for a single line of text - I need a text box where the user can type in a couple of lines to be saved as one variable.

 

Does anyone have any ideas of how I can do this using prompt boxes? (I'd rather not go into parsing values from text files/spreadsheets - want to keep this as idiot proof as possible).

 

Thanks in advance.

 

Graeme.

Link to comment
Share on other sites

You could use two separate Variable Set String from Prompt commands and then combine the results. We realize that this isn't as convenient as having a single prompt for more than one line. The request has been made to add this to a future version of Macro Express.

Link to comment
Share on other sites

Until ME does allow you to enter multiple lines of text in a prompt, why not get your users to enter one long text string using one or more delimiter characters to indicate where a new line should begin, e.g.

This is my first line\and this is my second (delimiter is \) OR

This is my first line^pand this is my second (delimiter is ^p)

 

Obviously the delimiter character(s) chosen must not be used except as the delimiter.

Link to comment
Share on other sites

Thanks for the replies guys, I was kinda afraid that would be the case, but nevermind. :)

 

I had a look at floyds HTA multiple input form (http://pgmacros.com/community/index.php?showtopic=248) and modified it to suit my needs using textarea tags for the fields i required. Worked out quite nicely although it will take a bit more work to configure it for other product layouts, but the input form should be easy enough for my users ;)

 

Attached the working version if anyone is interested.

TaitMotherboardCode.mxe

Link to comment
Share on other sites

Hey, Good work!

Thanks for that.

If you only want 3 lines and want to name them and the title on the fly; try;

// Set Form Title

Variable Set String %T1% "My Title Whatever I Want"

Variable Modify String: Save %T1% to Environment Variable

// Set Field Label 1

Variable Set String %T1% "Field1 - Surname "

Variable Modify String: Save %T1% to Environment Variable

// Set Field Label 2

Variable Set String %T1% "Field2 - Firstname"

Variable Modify String: Save %T1% to Environment Variable

// Set Field Label 3

Variable Set String %T1% "Field3 - email"

Variable Modify String: Save %T1% to Environment Variable

// Run macro

Macro Run: {_Form3}

// Display or retrieve 3 fields

Repeat Start (Repeat 3 times)

  Read Registry String: "FieldName%N1%"

  Variable Modify String: Save %T1% to Environment Variable

  Variable Modify String: Append "FieldName%N1% = " to %T2%

  Variable Modify String: Append "%T1%%CRLF%" to %T2%

Repeat End

Text Box Display:

<REM2:Set Form Title ><TVAR2:01:01:My Title Whatever I Want><TMVAR2:19:01:00:000:000:Title><REM2:Set Field Label 1><TVAR2:01:01:Field1 - Surname ><TMVAR2:19:01:00:000:000:Field1><REM2:Set Field Label 2><TVAR2:01:01:Field2 - Firstname><TMVAR2:19:01:00:000:000:Field2><REM2:Set Field Label 3><TVAR2:01:01:Field3 - email><TMVAR2:19:01:00:000:000:Field3><REM2:Run macro><MACRUN2:{_Form3}><REM2:Display or retrieve 3 fields><REP3:01:000001:000001:00003:1:01:><REGRSTR:1:HKEY_CURRENT_USER\Software\Professional Grade Macros\PGM Functions\Swap\FieldName%N1%><TMVAR2:19:01:00:000:000:FieldName%N1%><TMVAR2:07:02:00:000:000:FieldName%N1% = ><TMVAR2:07:02:00:000:000:%T1%%CRLF%><ENDREP><TBOX4:T:1:CenterCenter000278000200:000:T2=

=====================================

%T2%>

Best, Randall

EDIT; "{_Form3} corrected, replaced

__Form3_.mxe

Edited by randallc
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...
×
×
  • Create New...