Jump to content
Macro Express Forums

White Space In Script Affects Macro Run


tedblue

Recommended Posts

As a long time programmer, I prefer to create macros using the direct editor. However, I am finding that any white space affects the running of the macro. In other words, if I press ENTER at the end of a line to start a new line, the ENTER key is "played" when the macro runs. Same for all white space, including spaces, tabs, etc.

 

Here is an example (line numbers added for clarity):

 

01:<IVAR2:01:02:FHow many URLsFTCenter:Center>

02:

03:<IFVAR2:2:01:4:0>

04: <IFVAR2:2:01:1:1>

05: <TEXTTYPE:Here is a link to this item on our web site:>

06: <ELSE>

07: <TEXTTYPE:Here are the links to these items on our web site:>

08: <ENDIF>

09:<ENDIF>

10:

11:<REP3:05:000001:000001:0001:0:01:>

12: <TEXTTYPE:

13:

14:>

15: <MACRUN2:URL 1>

16:<ENDREP>

 

If this macro runs, it inserts all of the white space between the macro commands, not just the white space desired when using the TEXTTYPE command. To get the correct result, I have to remove all white space from the macro, which makes the macro look like the following:

 

01:<IVAR2:01:02:FHow many URLs?FTCenter:Center><IFVAR2:2:01:4:0><IFVAR2:2:01:1:1><TEXTTYPE:Here is a link to this item on our web site:><ELSE><TEXTTYPE:Here are the links to these items on our web site: ><ENDIF><ENDIF><REP3:05:000001:000001:0001:0:01:><TEXTTYPE:

02:

03:

04:><MACRUN2:URL 1><ENDREP>

 

This works, but is not easy to read and not very maintainable. Note that line 1 now extends for almost 200 characters, and the macro is condensed to four lines of code.

 

Is there a setting I am missing somewhere that will turn off the literal interpretation of white space in a macro script? I only want white space when using the TEXTTYPE command.

 

Ted Blue

Link to comment
Share on other sites

When editing via the Direct Editor all unformatted input is converted into Text Type commands. So, if you insert an <Enter>, it will become a "Text Type: <ENTER>" command.

 

You can include whitespace in the Scripting Editor by including a Remark statement and leaving it blank. Here is a simple macro as displayed in the Scripting Editor:

Text Type: <ENTER>Stuff

Text Type: more stuff<ENTER>

This is the same macro as displayed by the Direct Editor:

<TEXTTYPE:<ENTER>Stuff><REM2:><TEXTTYPE:more stuff<ENTER>>

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...