Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5

Thread: Preview Help #2

  1. #1
    Join Date
    Mar 2007
    Posts
    452

    Grin Preview Help #2




    Code:
    strText = Input.GetText("Input1");-- get the text
    -------------------------------------------------------------------------------------
    strText = String.Replace(strText, "
    ", "<p align=right>", false);-- translate strText = String.Replace(strText, "
    ", "</p>", false);-- translate strText = String.Replace(strText, "
    ", "<p align=center>", false);-- translate strText = String.Replace(strText, "
    ", "</p>", false);-- translate strText = String.Replace(strText, "
    ", "<p align=left>", false);-- translate strText = String.Replace(strText, "
    ", "</p>", false);-- translate strText = String.Replace(strText, "[color=", "<font color=", false); strText = String.Replace(strText, "[/COLOR]", "</FONT>", false);-- translate strText = String.Replace(strText, "[size=", "<font size=", false); strText = String.Replace(strText, "[/SIZE]", "</FONT>", false); strText = String.Replace(strText, "[font=", "<font face=", false); strText = String.Replace(strText, "
    1. ", "<ol>", false);-- translate strText = String.Replace(strText, "
    ", "</ol>", false);-- translate strText = String.Replace(strText, "[*]", "<li>", false);-- translate strText = String.Replace(strText, "
    • ", "<ul>", false);-- translate strText = String.Replace(strText, "
    ", "</ul>", false);-- translate strText = String.Replace(strText, "[*]", "<li>", false);-- translate strText = String.Replace(strText, "", "<b>", false);-- translate strText = String.Replace(strText, "", "</b>", false);-- translate strText = String.Replace(strText, "", "<i>", false);-- translate strText = String.Replace(strText, "", "</i>", false);-- translate strText = String.Replace(strText, "", "<u>", false);-- translate strText = String.Replace(strText, "", "</u>", false);-- translate strText = String.Replace(strText, "
    ", "<blockquote><P>", false);-- translate strText = String.Replace(strText, "
    ", "</P></blockquote>", false);-- translate strText = String.Replace(strText, "[URL=", "<a href=", false); strText = String.Replace(strText, "[/URL]", "</A>", false); strText = String.Replace(strText, "[EMAIL=", "<a href=mailto:", false); strText = String.Replace(strText, "[/EMAIL]", "</A>", false); strText = String.Replace(strText, "[IMG]", "<img src=", false); strText = String.Replace(strText, "[/IMG]", ">", false); strText = String.Replace(strText, "[QUOTE]", "<blockquote>", false); strText = String.Replace(strText, "[/QUOTE]", "</blockquote>", false); strText = String.Replace(strText, "[CODE]", "<PRE>", false); strText = String.Replace(strText, "[/CODE]", "</PRE>", false); strText = String.Replace(strText, "[php]", "<? ", false);-- translate strText = String.Replace(strText, "[/php]", " ?>", false);-- translate strText = String.Replace(strText, "[", "<", false); strText = String.Replace(strText, "]", ">", false); ----------------------------------------------------------------------------------------------------------- TextFile.WriteFromString("C:\\temp_preview.html","<HTML>"..strText.."</HTML>",false);-- write the html file Web.LoadURL("Web1", "C:\\temp_preview.html");-- show the preview
    i have that code on preview button but i cant make <br> can someone help please ???

  2. #2
    Join Date
    May 2006
    Posts
    5,380
    use this


    strText = String.Replace(strText, "\r\n", "<br>", false);
    Open your eyes to Narcissism, Don't let her destroy your life!!

  3. #3
    Join Date
    Mar 2007
    Posts
    452

    Thumbs up

    thanks Rizlauk
    there is only 1 word to say PERFECT

    will u also helpme with color palette, font and size comboboxes please ??? likethe ones u have in ur project ...

  4. #4
    Join Date
    Mar 2007
    Posts
    452

    Grin

    @ RizlaUk

    will u also helpme with color palette, font and size comboboxes please ??? like the ones u have in ur bbcoder v3 project ???

  5. #5
    Join Date
    May 2006
    Posts
    5,380
    thay all work with the same code, near enough, with some minor adjustments

    but, here goes anyway


    Size combo
    PHP Code:
    strText Input.GetText(MainInput);
    cPos=GetCaretPos(MainInput)
    selString Input.GetSelection(MainInput);
    sel ComboBox.GetSelected("co_size");
    Size ComboBox.GetItemData("co_size"sel);

    cRow=GetCaretRow(MainInput)
    if 
    sel ~= 1 then
        
    if selString ~= nil then
            BeforSelection 
    String.Mid(strText0selString.Start);
            
    AfterSelection String.Mid(strTextselString.End+1, -1);
            
    sel selString.End-selString.Start
            Selection 
    String.Mid(strTextselString.Startsel+1);
            
    Input.SetText(MainInputBeforSelection.."[SIZE="..Size.."]"..Selection.."[/SIZE]"..AfterSelection);
            
    Input.SetSelection(MainInputselString.Start+8selString.End+8);
            
    Input.ScrollToLine("inp_main"cRow);
        else
            
    BeforCaret String.Mid(strText1cPos);
            
    AfterCaret String.Mid(strTextcPos, -1);
            
    Input.SetText(MainInputBeforCaret.."[SIZE="..Size.."][/SIZE]"..AfterCaret);
            
    Input.SetSelection(MainInputcPos+9cPos+8);
            
    Input.ScrollToLine(MainInputcRow);
        
    end
    end 

    Font Combo
    PHP Code:
    strText Input.GetText(MainInput);
    cPos=GetCaretPos(MainInput)
    selString Input.GetSelection(MainInput);
    sel ComboBox.GetSelected("co_font");
    Font ComboBox.GetItemText("co_font"sel);
    FontLength String.Length(Font);
    cRow=GetCaretRow(MainInput)
    if 
    sel ~= 1 then
        
    if selString ~= nil then
            BeforSelection 
    String.Mid(strText0selString.Start);
            
    AfterSelection String.Mid(strTextselString.End+1, -1);
            
    sel selString.End-selString.Start
            Selection 
    String.Mid(strTextselString.Startsel+1);
            
    Input.SetText(MainInputBeforSelection.."[FONT="..Font.."]"..Selection.."[/FONT]"..AfterSelection);
            
    Input.SetSelection(MainInputselString.Start+7+FontLengthselString.End+7+FontLength);
            
    Input.ScrollToLine(MainInputcRow);
        else
            
    BeforCaret String.Mid(strText1cPos);
            
    AfterCaret String.Mid(strTextcPos, -1);
            
    Input.SetText(MainInputBeforCaret.."[FONT="..Font.."][/FONT]"..AfterCaret);
            
    Input.SetSelection(MainInputcPos+8+FontLengthcPos+7+FontLength);
            
    Input.ScrollToLine(MainInputcRow);
        
    end
    end 
    Color pallet- you will need worms color dialog plugin to make this work
    PHP Code:
    tblColors ColorDialog.Show(0)
    cRow=GetCaretRow(MainInput)
    if 
    tblColors then
        strText 
    Input.GetText(MainInput);
        
    cPos=GetCaretPos(MainInput)
        
    selString Input.GetSelection(MainInput);
        if 
    selString ~= nil then
            BeforSelection 
    String.Mid(strText0selString.Start);
            
    AfterSelection String.Mid(strTextselString.End+1, -1);
            
    sel selString.End-selString.Start
            Selection 
    String.Mid(strTextselString.Startsel+1);
            
    Input.SetText(MainInputBeforSelection.."[COLOR=#"..tblColors.Hex.."]"..Selection.."[/COLOR]"..AfterSelection);
            
    Input.SetSelection(MainInputselString.Start+15selString.End+15);
            
    Input.ScrollToLine(MainInputcRow);
        else
            
    BeforCaret String.Mid(strText1cPos);
            
    AfterCaret String.Mid(strTextcPos, -1);
            
    Input.SetText(MainInputBeforCaret.."[COLOR=#"..tblColors.Hex.."][/COLOR]"..AfterCaret);
            
    Input.SetSelection(MainInputcPos+16cPos+15);
            
    Input.ScrollToLine(MainInput", cRow);
        end    
    end 

    after all this code iv given you i expect some credit in your final app, if not a check in the post, lol (in pounds, sterling plz )
    Open your eyes to Narcissism, Don't let her destroy your life!!

Similar Threads

  1. is it possible to preview bbcode with AMS
    By GoOgLe in forum AutoPlay Media Studio 6.0
    Replies: 1
    Last Post: 03-23-2007, 02:40 PM
  2. INFO: The Difference Between Preview and Build
    By Support in forum AutoPlay Menu Studio 3.0
    Replies: 0
    Last Post: 10-29-2002, 12:22 PM
  3. Page Preview and buttons ?
    By RAZS in forum AutoPlay Menu Studio 3.0
    Replies: 2
    Last Post: 12-13-2001, 01:17 PM
  4. Preview Build Error
    By photoworks in forum AutoPlay Menu Studio 3.0
    Replies: 2
    Last Post: 05-11-2001, 04:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts