koden Posted June 24, 2008 Report Share Posted June 24, 2008 I have a macro that in a mainframe window does this: ctrl+a (all text marked) ctrl+c (all text copied...more than 2000 characters) open notepad ctrl+v All characters is now in notepad.... BUT When i use the modify string command to remove characters after characters 999, then it will not copy text to notepad. I use: ctrl+a (all text marked) ctrl+c (all text copied...more than 2000 characters) variable set string T51 from clipboard variable modify string copy part of T51 to T50 (Copy from position 1 to 999) variable modify string save T50 to clipboard open notepad ctrl+v Not working. I have tryed speed 3 times slower and with 1000 MS between each comand.. What am I doing wrong? I think it's something about what i copy from the mainframe. When i make ctrl+v and C to notepad it's in notepad as characters and I can edit the characters. maybe before it gets to notepad it's a picture or something that modify string can't handle... Can i do something else? at the moment i first copy to notepad and back to clipboard and then use modify... that works, but it's an extra program and time... line 8 to 17 in the attached macro file test.mxe Quote Link to comment Share on other sites More sharing options...
rberq Posted June 24, 2008 Report Share Posted June 24, 2008 I don't think the typing speed has anything to do with it, and I don't think you are doing anything "wrong" as such. Most mainframe screens are "formatted", meaning that there are control bytes between the visible fields which control the displaying of data. Most control bytes do not have a corresponding keyboard character associated with them. They appear as blanks on the screen, but if you could look at the data stream you would see they are not really ascii '32' (ebcdic '40') values. There may even be several consecutive control bytes where only a single blank space appears on the screen. So you are probably right, that there are bytes in there that are not true text characters and perhaps the modify string can't handle them. I copied a mainframe screen and pasted it into Notepad, and Notepad changed the non-displayables to blanks, thereby cleaning up the data stream. In many languages it's easy to write a "translate" command to filter out the non-display characters, but I don't know how you would do it in ME. So you may be stuck with the solution you have found, using Notepad as the intermediary. Quote Link to comment Share on other sites More sharing options...
kevin Posted June 24, 2008 Report Share Posted June 24, 2008 I think rberg has identified the probable cause of the problem. It is likely that non-displayable characters (also called control characters) are causing the difficulty. You can write a macro to change non-displayable characters into blanks and avoid using Notepad as an intermediary. This sample macro converts all control characters into spaces. // Replace all control characters with a space Repeat Start (Repeat 31 times) Variable Set %T1% to ASCII Char of %N1% Replace "%T1%" with " " in %T52% Repeat End But it is likely that you do not want to convert all control characters into spaces. You may not want to convert tabs, carriage returns (CR) and linefeeds (LF). This macro converts all control characters except CRs and LFs into spaces: // Replace all control characters with a space Repeat Start (Repeat 31 times) Variable Set %T1% to ASCII Char of %N1% // Skip CR and LF characters If Variable %N1% <> 10 OR If Variable %N1% <> 13 Replace "%T1%" with " " in %T52% End If Repeat End To understand what is going on with your application and with these sample macros it would be helpful to understand ASCII Character Set. For more information see the ASCII Wikipedia article. Here are the sample macros in a form you can copy and paste into your macro file: <REM2:Replace all control characters with a space><REP3:01:000001:000001:00031:1:01:><ASCIIC:1:0:1><TMVAR2:21:52:01:000:000:%T1% ><ENDREP> <REM2:Replace all control characters with a space><REP3:01:000001:000001:00031:1:01:><ASCIIC:1:0:1><REM2:Skip CR and LF characters><IFVAR2:2:01:2:10><OR><IFVAR2:2:01:2:13><TMVAR2:21:52:01:000:000:%T1% ><ENDIF><ENDREP> Quote Link to comment Share on other sites More sharing options...
koden Posted June 24, 2008 Author Report Share Posted June 24, 2008 I love you guys :-) Thanks.... Quote Link to comment Share on other sites More sharing options...
rberq Posted June 24, 2008 Report Share Posted June 24, 2008 Thanks, Kevin. That's just what I had in mind, the MacroExpress equivalent of a mainframe assembler lanuage translate command. There may be some other unprintables above hex '31' that need to be converted to spaces as well, but I don't have my reference tables with me to tell you what they are. Quote Link to comment Share on other sites More sharing options...
kevin Posted June 24, 2008 Report Share Posted June 24, 2008 The control characters are under 20 hex or 32 decimal. All characters between 20h/32d and 7Fh/127d are printable. There may be some non-printable characters in the 80h/128d to FFh/255d range. ...but I don't have my reference tables...The Wikipedia article link in my previous post contains the tables. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.