Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 13 of 13
  1. #1
    Join Date
    Apr 2007
    Location
    Suffolk, UK
    Posts
    176

    need input help please.

    i was simply wondering if it was possible to set a line to a different colour depending on what the first character is (ig a colon means the lines blue) and if so could someone give me an example of this.

    im also struggling to get it to add text where the cursor is instead of the end of the input as i can get it to add the text to the end of the input easy.

    thanks in advance.

    James

  2. #2
    Join Date
    May 2006
    Posts
    5,380
    you can not change the text color of a input on a per line basis

    for more control over where the text is added use worms caret dll

    http://www.indigorose.com/forums/sho...10&postcount=9
    Open your eyes to Narcissism, Don't let her destroy your life!!

  3. #3
    Join Date
    Apr 2007
    Location
    Suffolk, UK
    Posts
    176
    that smells, thanks for the dll link though


    ok, after looking at that project i still have no idea how to insert the text at the cusor position, could you please give me an example? i would be extremely grateful.
    Last edited by screwed over; 04-28-2007 at 02:57 AM.

  4. #4
    Join Date
    May 2006
    Posts
    5,380
    sure,

    this code will add any text from the clipboard to the input at the current caret position

    Code:
    -- check if there is any text on the clipboard
    isCBText = Clipboard.IsTextAvailable(); 
    -- text is available
    if isCBText then 
    -- get the text from the main input
    strText = Input.GetText( "Input1"); 
    -- get the text from the clipboard
    strAddText = Clipboard.GetText(); 
    -- get the caret position
    cPos=GetCaretPos( "Input1") 
    cRow=GetCaretRow( "Input1") 
    	-- get the length of the clipboard text string
    	strAddTextLen = String.Length(strAddText); 
    	-- get the text before the caret
    	BeforCaret = String.Mid(strText, 1, cPos); 
    	-- get the text after the caret
    	AfterCaret = String.Mid(strText, cPos+1, -1); 
    	-- reset the text in the input, adding the clipboard text in the right place
    	Input.SetText( "Input1", BeforCaret..strAddText..AfterCaret); 
    	-- reset the caret to the end of the string that was just added
    	Input.SetSelection( "Input1", cPos+strAddTextLen+1, cPos+strAddTextLen); 
    	-- scroll to the right line
    	Input.ScrollToLine( "Input1", cRow); 
    else 
    -- there is no text on the clipboard so show a message
    Dialog.Message( "Notice", "There is no text on the clipboard", MB_OK, MB_ICONNONE, MB_DEFBUTTON1); 
    end
    output enhanced with AMS Code Pretty

    EDIT, you need worms caret dll and enable the clipboard plugin for this to work
    Open your eyes to Narcissism, Don't let her destroy your life!!

  5. #5
    Join Date
    Apr 2007
    Location
    Suffolk, UK
    Posts
    176
    thanks rizlauk, your now my official #1 hero

    --edit--
    GAH!! im full of problems, how would i copy the text of a selected item to the clipboard, sorry if im being a noob or whatever, but i'm new to APMS and didnt expect so much coding would be needed.
    Last edited by screwed over; 04-28-2007 at 11:18 AM.

  6. #6
    Join Date
    May 2006
    Posts
    5,380
    lol, no problem

    just support the cause and buy the t-shrit
    Last edited by RizlaUK; 02-01-2009 at 11:35 AM.
    Open your eyes to Narcissism, Don't let her destroy your life!!

  7. #7
    Join Date
    May 2005
    Posts
    1,115
    Lol :d
    Never know what life is gonna throw at you.
    (Based on a true story.)

  8. #8
    Join Date
    May 2006
    Posts
    5,380
    how would i copy the text of a selected item to the clipboard
    here, try this:

    Code:
    strText = Input.GetText( "Input1"); 
    cPos=GetCaretPos( "Input1") 
    cRow=GetCaretRow( "Input1") 
    selString = Input.GetSelection( "Input1"); 
    if selString ~= nil then 
    	sel = selString.End-selString.Start 
    	Selection = String.Mid(strText, selString.Start, sel+1); 
    	Clipboard.CopyText(Selection); 
    end
    output enhanced with AMS Code Pretty
    Open your eyes to Narcissism, Don't let her destroy your life!!

  9. #9
    Join Date
    Apr 2007
    Location
    Suffolk, UK
    Posts
    176
    no it doesnt work aaargh!!!thanks anyway though.

  10. #10
    Join Date
    May 2006
    Posts
    5,380
    it dose work, you cant be using it right

    here is the test apz i was using to make your code, try it
    Last edited by RizlaUK; 02-01-2009 at 11:35 AM.
    Open your eyes to Narcissism, Don't let her destroy your life!!

  11. #11
    Join Date
    Apr 2007
    Location
    Suffolk, UK
    Posts
    176
    sorry, i just realised i didnt make my post clear, sorry, i mean a selected item in a listbox, sorry for that, my bad.

  12. #12
    Join Date
    May 2001
    Location
    51.531249 | -0.610962
    Posts
    1,244

    Lightbulb

    Code:
    selected = ListBox.GetSelected("ListBox1")
    Clipboard.CopyText(ListBox.GetItemText("ListBox1", selected[1]));
    Perhaps it would be a good idea to browse thru AMS and the help file to see what is available to you.
    The names of the actions (ie: Clipboard.CopyText) is sometimes a pretty good clue
    -
    = Derek
    ["All glory comes from daring to begin" - fortune cookie]

  13. #13
    Join Date
    Apr 2007
    Location
    Suffolk, UK
    Posts
    176
    hmm, strange, that was the first thing i tried but it would only paste the line number, i wonder what i got wrong, anyway, thank you two so, so much! i wouldnt be able to do it without you!! thanks again!

Similar Threads

  1. Input Box Wierdness
    By Roboblue in forum AutoPlay Media Studio 6.0
    Replies: 9
    Last Post: 11-18-2005, 01:20 PM
  2. Input object graying out
    By dthompson16 in forum AutoPlay Media Studio 5.0
    Replies: 7
    Last Post: 07-28-2004, 07:28 PM
  3. Lorne’s two great input validation scripts
    By csd214 in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 06-09-2004, 09:13 AM
  4. Function: Test Whether An Input Object Is Empty
    By Lorne in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 06-08-2004, 02:18 PM
  5. multiline input table apocalypse
    By dulux1309 in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 04-09-2004, 05:28 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