Jump to content
Macro Express Forums

Bkelevate

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Bkelevate

  1.  

    Split should work.

    Variable Set String %Sample% to "615900205-10-1"
    Split String "%Sample%" on "-" into %Part%, starting at 1
    Text Box Display: Result
    

    You can copy this one into a macro. You need to define %Part% as an string with 3 elements.

    <VARIABLE SET STRING Option="\x00" Destination="%Sample%" Value="615900205-10-1" NoEmbeddedVars="FALSE"/>
    <SPLIT STRING Source="%Sample%" SplitChar="-" Dest="%Part%" Index="1"/>
    <TEXT BOX DISPLAY Title="Result" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %Part[1]%\r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="1" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
    
    

    Thank you, this worked as well. I've never used variables that weren't the standard %T[1]%, %N[1]%, etc so thank you for that new information.

  2. Variable Set String %T1% "abcdef-ghi" sample text for testing

    Variable Set Integer %N1% from Position of Text in Variable %T1% locate position of first hyphen within the text

    Variable Modify Integer: Dec (%N1%) set position back by one so hyphen won't be copied

    Variable Modify String: Copy Part of %T1% to %T2% copy desired text to another variable, length N1

     

     

    I used Notepad to type the variable before and after your steps and it worked perfectly. Thanks!
    <WINDOW ACTIVATE Title="Untitled - Notepad" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
    <VARIABLE SET STRING Option="\x00" Destination="%T[1]%" Value="615900205-10-1" NoEmbeddedVars="FALSE"/>
    <TEXT TYPE Action="0" Text="%T[1]%<ENTER>"/>
    <VARIABLE SET INTEGER Option="\x0E" Destination="%N[1]%" Text_Variable="%T[1]%" Text="-" Ignore_Case="FALSE"/>
    <VARIABLE MODIFY INTEGER Option="\x01" Destination="%N[1]%" Value1="%N[1]%" Value2="1"/>
    <VARIABLE MODIFY STRING Option="\x09" Destination="%T[1]%" Variable="%T[1]%" Start="1" Count="%N[1]%" NoEmbeddedVars="FALSE"/>
    <WINDOW ACTIVATE Title="Untitled - Notepad" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
    <TEXT TYPE Action="0" Text="%T[1]%"/>
  3. This is an example of the Order ID format we use - "615900205-10-1". The first part of the number is what I need to keep and I need to delete everything else. The problem is, none of the sections are a consistent number of digits so I am unsure how to use the "Delete part of text" variable where it asks for a Starting Position. I looked into Split String and choosing "-" for Split string on, however it just returned this "615900205101".

     

    So how can I delete everything to the right, starting with the first dash, if the starting position is not constant?

     

    Thanks.

×
×
  • Create New...