Author Topic: Open file for editing from another program  (Read 3272 times)

Offline mikex

  • Single posting newcomer
  • *
  • Posts: 3
Open file for editing from another program
« on: March 18, 2008, 09:06:44 pm »
I am trying to open a .cpp file to edit by executing a 'codeblocks theFile.cpp' command from another program, but I get the following message:

Another program instance is already running.

I only want one copy of codeblocks running, I just want 'theFile.cpp' to come up in the editor under a new tab.  Is there some undocumented command line switch that will send a signal to codeblocks dde server to just open the file?

I'm running under windows XP SP2 and I've tried associating .cpp with codeblocks and issuing a 'cmd.exe theFile.cpp' but that just blocks execution in my calling program even though I've issued the command asynchronously.

mariocup

  • Guest
Re: Open file for editing from another program
« Reply #1 on: March 18, 2008, 10:10:36 pm »
Hi,

If you want to open a new file in CodeBlocks you could use the shell extension plugin, that integrates a file explorer in CodeBlocks.

See the manual http://www.codeblocks.org/user-manual section "File Explorer and Shell Extension Plugin"  for details.

Bye,

Mario

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Open file for editing from another program
« Reply #2 on: March 18, 2008, 10:20:15 pm »
I am trying to open a .cpp file to edit by executing a 'codeblocks theFile.cpp' command

if CB is associated with .cpp files, it should be enough to use "theFile.cpp" as the command line (it at least works at the dos prompt, but if it doesn't work in your program you might try "cmd /c theFile.cpp" instead). it shoud be asynchronous.
« Last Edit: March 18, 2008, 10:24:39 pm by dmoore »

Offline mikex

  • Single posting newcomer
  • *
  • Posts: 3
Re: Open file for editing from another program
« Reply #3 on: March 18, 2008, 10:55:50 pm »
Worked like a charm dmoore, that /c did the trick.

Many thanks :D