September 28, 2021, 17:32:46

Author Topic: Any Way to Run a Cmd From Blitzmax?  (Read 1069 times)

Offline Hardcoal

  • Hero Member
  • *****
  • Posts: 743
  • nothing is personal
Any Way to Run a Cmd From Blitzmax?
« on: November 08, 2019, 14:27:25 »
Hi

As ive asked on my hardcoal editor thread.

Im looking for a way to make tprocess to open MaxIDE with a certain file I want.
anyone has an Idea?

the second choice is to somehow Run Cmd from blitzmax.
if i go on the second choice, i will have to find a way to know that maxide was closed so i can execute some actions.
« Last Edit: November 08, 2019, 14:29:27 by Hardcoal »
...

Offline Derron

  • Hero Member
  • *****
  • Posts: 3653
Re: Any Way to Run a Cmd From Blitzmax?
« Reply #1 on: November 08, 2019, 15:17:33 »
If you kick off a process your TProcess is "alive" until that process has ended ("blide/maxide closed").


I answered your question (a bit of it at least) in your other thread. give the editor a temporary file to open (depends on whether the editor accepts parameters like "blide c:\myfile.bmx"). Once the file is open, check filetime to see when stuff was saved to allow reloading in your editor. When the process exits, remove the temporary file again.

Some editors might lock the file for other applications - so you cannot open it in your application then until the editor removes its lock on the file.


bye
Ron

Offline degac

  • Full Member
  • ***
  • Posts: 172
    • graphio.net
Re: Any Way to Run a Cmd From Blitzmax?
« Reply #2 on: November 10, 2019, 18:56:46 »
Hi

you could start a process and wait an answer from the 'output' pipeline.
But for what I know MaxIDE doesn't 'print' any final message (just made a test).
You could try to change MaxIDE if you need this.

If there's a problem, there's at least one solution.
www.blitzmax.org

Offline Hardcoal

  • Hero Member
  • *****
  • Posts: 743
  • nothing is personal
Re: Any Way to Run a Cmd From Blitzmax?
« Reply #3 on: November 10, 2019, 19:05:17 »
I eventually decided to simply use openurl command and let the user decide which app opens his BMX file.
And all I do is check filetime constantly until it changes.
That's how i know it was edited
...

Offline Kippykip

  • Full Member
  • ***
  • Posts: 130
    • Kippykip Forums!
Re: Any Way to Run a Cmd From Blitzmax?
« Reply #4 on: December 14, 2019, 14:26:26 »
You can try using TProcess, here's me running windows explorer onto a directory.

Code: [Select]
'Open a directory
Function OpenDir(Directory:String)
Local Explorer:TProcess = CreateProcess:TProcess("explorer.exe " + Chr(34) + Directory + Chr(34))
DetachProcess(Explorer)
End Function

Offline Hardcoal

  • Hero Member
  • *****
  • Posts: 743
  • nothing is personal
Re: Any Way to Run a Cmd From Blitzmax?
« Reply #5 on: December 14, 2019, 14:44:03 »
Thanks
...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal