Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 7 of 7

Thread: text file help

  1. #1
    Join Date
    Jul 2007
    Posts
    287

    text file help

    help me please

    For example :

    my desktop have mustafa.txt ( and ı open mustafa.txt ı saw for example bla bla bla )

    -- Code
    UserText = Input.GetText("UserText");
    SaveTo = Dialog.FileBrowse(false, "Save to:", _DesktopFolder, "Text files (*.txt)|*.txt|", "", "txt", false, false);

    DoesExist = File.DoesExist(SaveTo[1]);
    if DoesExist then
    Replace = Dialog.Message("Warning", "File " .. SaveTo[1] .. " already exist. Do you want to replace the file?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    if Replace == IDYES then
    TextFile.WriteFromString(SaveTo[1], UserText, false);
    else
    Dialog.Message("Warning", "File not saved.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
    end
    else
    TextFile.WriteFromString(SaveTo[1], UserText, false);
    end

    -- End

    Result :

    ım write input (input name = UserText ) " mustafa " and then save to mustafa.txt on desktop but ı click open mustafa.txt ı saw mustafa where bla bla bla ? ı want if ı save mustafa.txt bla bla and ı saw mustafa.


    I cant speak english very well , ty

  2. #2
    Join Date
    May 2006
    Posts
    5,380
    Hi,

    Try it like this (note the bits in red)
    Code:
    UserText = Input.GetText("UserText");
    SaveTo = Dialog.FileBrowse(false, "Save to:", _DesktopFolder, "Text files (*.txt)|*.txt|", "", "txt", false, false);
    
    DoesExist = File.DoesExist(SaveTo[1]);
    if DoesExist then
    	Replace = Dialog.Message("Warning", "File " .. SaveTo[1] .. " already exist. Do you want to replace the file?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    	if Replace == IDYES then
    		OldText=TextFile.ReadToString(SaveTo[1]);
    		TextFile.WriteFromString(SaveTo[1], OldText.."\r\n"..UserText, false);
    	else
    		Dialog.Message("Warning", "File not saved.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
    	end
    else
    	TextFile.WriteFromString(SaveTo[1], UserText, false);
    end
    Hope it helps
    Open your eyes to Narcissism, Don't let her destroy your life!!

  3. #3
    Join Date
    Jul 2007
    Posts
    287
    Quote Originally Posted by RizlaUK View Post
    Hi,

    Try it like this (note the bits in red)
    Code:
    UserText = Input.GetText("UserText");
    SaveTo = Dialog.FileBrowse(false, "Save to:", _DesktopFolder, "Text files (*.txt)|*.txt|", "", "txt", false, false);
    
    DoesExist = File.DoesExist(SaveTo[1]);
    if DoesExist then
    	Replace = Dialog.Message("Warning", "File " .. SaveTo[1] .. " already exist. Do you want to replace the file?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    	if Replace == IDYES then
    		OldText=TextFile.ReadToString(SaveTo[1]);
    		TextFile.WriteFromString(SaveTo[1], OldText.."\r\n"..UserText, false);
    	else
    		Dialog.Message("Warning", "File not saved.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
    	end
    else
    	TextFile.WriteFromString(SaveTo[1], UserText, false);
    end
    Hope it helps
    ty too ty too

  4. #4
    Join Date
    Nov 2006
    Location
    Tehran
    Posts
    176
    Hello.How Are ...

    UserText = Input.GetText("UserText");
    SaveTo = Dialog.FileBrowse(false, "Save to:", _DesktopFolder, "Text files (*.txt)|*.txt|", "", "txt", false, false);

    DoesExist = File.DoesExist(SaveTo[1]);
    if DoesExist then
    Replace = Dialog.Message("Warning", "File " .. SaveTo[1] .. " already exist. Do you want to replace the file?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    if Replace == IDYES then
    TextFile.WriteFromString(SaveTo[1], "\r\n"..UserText, true);
    else
    Dialog.Message("Warning", "File not saved.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
    end
    else
    TextFile.WriteFromString(SaveTo[1], "\r\n"..UserText, true);
    end

  5. #5
    Join Date
    May 2006
    Posts
    5,380
    lol, why dident i think of that.......been working with another program for to long...im slipping
    Open your eyes to Narcissism, Don't let her destroy your life!!

  6. #6
    Join Date
    Jul 2007
    Posts
    287

    and..

    Code :
    UserText = Input.GetText("UserText");
    SaveTo = Dialog.FileBrowse(false, "Save to:", _DesktopFolder, "Text files (*.txt)|*.txt|", "", "txt", false, false);

    DoesExist = File.DoesExist(SaveTo[1]);
    if DoesExist then
    Replace = Dialog.Message("Warning", "File " .. SaveTo[1] .. " already exist. Do you want to replace the file?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    if Replace == IDYES then
    TextFile.WriteFromString(SaveTo[1], "\r\n"..UserText, true);
    else
    Dialog.Message("Warning", "File not saved.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
    end
    else
    TextFile.WriteFromString(SaveTo[1], "\r\n"..UserText, true);
    end
    End

    for example ; ım write input ( Usertext ) "12345" if ı save text file ı want to saw name "12345 --- How ?

  7. #7
    Join Date
    May 2006
    Posts
    5,380
    try this way:

    Code:
    UserText = Input.GetText("UserText");
    SaveTo = Dialog.FileBrowse(false, "Save to:", _DesktopFolder, "Text files (*.txt)|*.txt|", "", "txt", false, false);
    
    DoesExist = File.DoesExist(SaveTo[1]);
    if DoesExist then
    	Replace = Dialog.Message("Warning", "File " .. SaveTo[1] .. " already exist. Do you want to replace the file?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    	if Replace == IDYES then
    		OldText=TextFile.ReadToString(SaveTo[1]);
    		TextFile.WriteFromString(SaveTo[1], UserText.." - "..OldText, false);
    	else
    		Dialog.Message("Warning", "File not saved.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
    	end
    else
    	TextFile.WriteFromString(SaveTo[1], UserText, false);
    end
    if that is not what you need then you are going to have to be a little clearer about what you want

    when you say name, do you mean the file name ?
    Open your eyes to Narcissism, Don't let her destroy your life!!

Similar Threads

  1. Text File Header
    By markstaylor in forum AutoPlay Media Studio 6.0
    Replies: 0
    Last Post: 07-26-2007, 09:50 PM
  2. Help! Submit from a text file to a website
    By wedgea09 in forum AutoPlay Media Studio 6.0
    Replies: 6
    Last Post: 05-15-2007, 01:22 PM
  3. Import data from a text file
    By StealthFD in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 04-28-2004, 05:08 PM
  4. reading from text file
    By tstadheim in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 02-09-2004, 03:09 PM
  5. Writing Text to a File
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 09-22-2003, 02:02 PM

Posting Permissions

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