Closed Thread
Results 1 to 4 of 4

Thread: Running .txt file from same place where is located .exe

  1. #1
    Join Date
    Mar 2010
    Posts
    11
    Rep Power
    0

    Running .txt file from same place where is located .exe

    How to do this ? Sugestion ? Advice ?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,494
    Blog Entries
    75
    Rep Power
    143

    Re: Running .txt file from same place where is located .exe

    What are you trying to do? You can't "run" a text file, just open it, display it, etc.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    abdul.gafur's Avatar
    abdul.gafur is offline Learning Programmer
    Join Date
    Mar 2010
    Location
    Salo, Riau, Indonesia
    Posts
    42
    Rep Power
    0

    Re: Running .txt file from same place where is located .exe

    Get it with googling, if you find any problem, we will discuss later

  5. #4
    Firebird_38 is offline Programmer
    Join Date
    Aug 2008
    Posts
    126
    Rep Power
    0

    Re: Running .txt file from same place where is located .exe

    To get the name of the file, no metter where the exe is:
    Code:
    function ExePathFileName(FileName:String):String;
    begin
     result:=ExtractFilePath(Application.ExeName)+FileName;
    end;
    If your EXE is 'C:\Dev\LoadAppText\MyAppTextLoader.exe' then a call to ExePathFileName('MyText.txt') will return 'C:\Dev\LoadAppText\MyText.txt'.

    Now that yourt app knows where it's at, you can "run" it:

    Add a form.
    Add a Memo to the form
    Name the Memo "TextMemo"
    Add a button. Set caption to "Load text".
    Double-click the button.

    Type:
    Code:
     TextMemo.Lines.LoadFromFile(ExePathFileName('MyText.txt'));
    This will display your text. If you want to "run" text, this text must be source code. This source code must be accompanied by a compiler or interpreter. You must then instruct the appropriate compiler or interpreter to either compile or interpret it using the appropriate controls and or commands available in such a compiler or interpreter according to the manual that comes with it, or the online documentation, or the newsgroups that provide such information. Please be advised that the langauge used in the txt file must match the language used by the compiler or interpreter. (Much like you need to be able to understand English to understand this post).

    To fire up notepad, use ShellExecute. Type "ShellExecute" in your delphi code editor and hit F1. If any terms seem unfamiliar in the manual/help, click on the underlined words (these are hyperlinks). Hope this helps.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problems running C file
    By JanitorMoe in forum C and C++
    Replies: 4
    Last Post: 10-26-2010, 08:26 PM
  2. Add items to combobox permanently + create file on place of the .exe
    By lordwittie in forum Visual Basic Programming
    Replies: 0
    Last Post: 05-03-2010, 12:50 PM
  3. [HELP] running a .bat file
    By jamietrent in forum C# Programming
    Replies: 4
    Last Post: 01-01-2010, 08:17 AM
  4. parameter input at program running(c:/file.exe -parameter)
    By granitt in forum Visual Basic Programming
    Replies: 1
    Last Post: 01-09-2009, 09:05 AM
  5. Running an exe file without an operating software.
    By taz15964 in forum General Programming
    Replies: 15
    Last Post: 08-06-2008, 04:16 PM

Tags for this Thread

Bookmarks

Posting Permissions

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