The attached file, "Get User Text.mcl", is a sample macro I previously posted that will extract the text from user commands and text elements. To use, enter the element number of the user command or text element when prompted. The macro will then group the identified element and do a "File - Print - Data - Active Group - (to) File" creating an ASCII data file named "TempFile.dat" containing the element data for just that one element. The macro will then read in the data file and search for the word "Text" and assigns the characters that follow to the string variable #UserText.
The PROMPT[] command within the macro can be removed and another method can be used to identify the element number using the variable #ElNum. The macro can be automated and run from within your macro using the MAC_EXE[] command. ================================================== Fred Lauzus, CAM Programming Coordinator High Steel Structures, Incorporated mailto:[EMAIL PROTECTED] http://www.highsteel.com ================================================== -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of John Gent Sent: Wednesday, May 05, 2004 7:20 PM To: [EMAIL PROTECTED] Subject: RE: [mfg-smartcam] Text string extraction Hey Michael, Here's something that may do close to what you want. It'll take some dinking with, but works with this example. The idea here is to put the text element as the only element in the active group, and dump it to a file. Then read the file and use only the 9th line for dinking with (the line with the text information). For my example I had a text element with the text "c:\temp\test.txt". This example will extract the word "test" from it. //----- // Subject text variable string:#test // Use for line counter for F_READ #count=1 // Dump the active group to a file. Supposed to be only one Text element. DUMP_LST[GP=1, OM=1, FN="c:\temp\junk.txt"] F_OPEN[FN="c:\temp\junk.txt", TY="r"] // The 9th line has the subject text in it. WHILE(#count<10) F_READ[FN="c:\temp\junk.txt", FMT="%s", VR="test"] #count=#count+1 ENDW F_CLOSE[FN="c:\temp\junk.txt"] // Extract a 4 letter word out of the 9th line. #count=STRLEN(#test)-7 #test=STRSUB(#test, #count,4) // The infamous Pause PAUSE[TX=#test, PT=0] //---- Let us know if this will help. Cheers. - John Gent -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Senack Sent: Tuesday, May 04, 2004 6:53 PM To: [EMAIL PROTECTED] Subject: [mfg-smartcam] Text string extraction LAYER_SEQ[BA=1, LY=22, ME=0] MOD_TEX[EL=SEQEL()-1, LV=0, XE=0, YE=5.47, TX="W:\\360\\VC11\\VC11-59.pm4 +Y", HT=0.25, AN=360] Is there a way to extract 'W:\\360\\VC11\\VC11-59' from 'W:\\360\\VC11\\VC11-59.pm4 +Y' in the above modify text macro command and place it in a string? Once in the string I'll use it in the file save macro command. Basically what I would like to accomplish is to remove the '.pm4 +Y' from the text element. Regards, Michael Senack ====================================================================== To find out more about this mailing list including how to unsubscribe, send the message "info mfg-smartcam" to [EMAIL PROTECTED] ======================================================================
Get User Text.mcl
Description: Binary data
