Re: Reformat macro?

"John Larimer" <[email protected]>
Newsgroups gmane.comp.systems.as400.code
Message-ID <[email protected]>
Vern:

I’m not picturing in my mind exactly what you are asking for but maybe this 
will help.

It sounds like you want to position your cursor to a column (editor command 
cursorpos xx), go to the previous word (shift-left arrow) and split the line 
(Alt-S).

I think that the macro recorder may help.  What I’ve bumped into is the 
macro recorder is only for keystrokes (you can’t record editor commands).

The work-around is to assign commands or macros to keystrokes.  I wrote a 
little macro that helps you do this on the fly:


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
*/
/*                                                                           
*/
/*  PGM NAME      -  map_key.lx                                              
*/
/*  PROGRAM TITLE -  Map Keyboard Key to Command or Macro                    
*/
/*  DATE WRITTEN  -  01/30/03                                                
*/
/*  AUTHOR        -  John Larimer                                            
*/
/*  NARRATIVE     -  Prompts for a key combination to map and then the       
*/
/*                   command to map to. Allows you to launch macros quickly. 
*/
/*                                                                           
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
*/
/*                                                                           
*/
/*  MODIFIED  LOG #  PGMR  DESCRIPTION                                       
*/
/*  --------  -----  ----  ------------------------------------------------  
*/
/*  01/30/03         JKL   Original Version                                  
*/
/*  02/07/03         JKL   Allow for Commands or Macros                      
*/
/*  -----------------------------------------------------------------------  
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
*/

/* Build First Prompt */
title = "Map Key - Key Combination"
prompt = "Enter Key Combination: (Example A-C-x (Alt-Ctrl-Key))"

'set lineread.title' title
'set lineread.prompt' prompt

/* Display Prompt */
lineread 9 "A-C-x"

'extract lastkey'

/* Check to Confirm Entry */
if lastkey = 'ESC' then
  return

'extract lastline'

if lastline = "" then
  return

KeyCombo = lastline

/* Build Second Prompt */

title = "Map Key - Command Name"
prompt = "Enter Command"

'set lineread.title' title
'set lineread.prompt' prompt

/* Display Prompt */
lineread 100 "Enter Command Here"

'extract lastkey'

/* Check to Confirm Entry */
if lastkey = 'ESC' then
  return

'extract lastline'

if lastline = "" then
  return

Command = lastline

/* Build Command */

'set ACTION.' || KeyCombo Command

exit

/* end of macro */


To play back macros quickly, I’ve mapped a key to the command LP_RECPLAY.  
Be sure to review the editor help in the IDE for a list of the LP_xx 
commands.

Hope you find it useful.

John





>From: Vern Hamberg <vhamberg-Ebbh53c6wcYkzXN11fiE55igCaZBIYHkAL8bYrjMMd8@public.gmane.org>
>Reply-To: CODE/400 Discussion & Support <code400-l-Zwy7GipZuJhWk0Htik3J/[email protected]>
>To: code400-l-Zwy7GipZuJhWk0Htik3J/[email protected]
>Subject: Reformat macro?
>Date: Fri, 20 Jun 2003 11:42:46 -0500
>
>Y'all
>
>Is there a macro or built-in function that will reformat source lines? I 
>need it for editing UIM help. I want to avoid a lot of manual steps using 
>ALT-S and ALT-J and keeping track of record length.
>
>It'd need to break the selected lines at word breaks.
>
>I can do this easily in TextPad. Probably other editors can, too.
>
>TIA
>
>Vern
>
>
>_______________________________________________
>This is the CODE/400 Discussion & Support (CODE400-L) mailing list
>To post a message email: CODE400-L-Zwy7GipZuJhWk0Htik3J/[email protected]
>To subscribe, unsubscribe, or change list options,
>visit: http://lists.midrange.com/mailman/listinfo/code400-l
>or email: CODE400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected]
>Before posting, please take a moment to review the archives
>at http://archive.midrange.com/code400-l.
>
>NOTE: WDSc for iSeries disucssion has it's own mailing list.
>Information can be found at 
>http://lists.midrange.com/cgi-bin/listinfo/wdsc-l
>

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail

_______________________________________________
This is the CODE/400 Discussion & Support (CODE400-L) mailing list
To post a message email: CODE400-L-Zwy7GipZuJhWk0Htik3J/[email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/code400-l
or email: CODE400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/code400-l.

NOTE: WDSc for iSeries disucssion has it's own mailing list.
Information can be found at http://lists.midrange.com/cgi-bin/listinfo/wdsc-l
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.