[Solved] How to load file to the IDE from an external tool

Working on new editor enhancements?
User avatar
Guimauve
Enthusiast
Enthusiast
Posts: 742
Joined: Wed Oct 22, 2003 2:51 am
Location: Canada

[Solved] How to load file to the IDE from an external tool

Post by Guimauve »

Hello everyone,

I'm currently creating a ToolBox Manager external Tool. What it does you say ?

In your source code look like this :

Code: Select all

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Project name : Example of ToolBoxFile system
; File Name : My source Code.pb
; File version: 0.0.0
; Programmation : OK
; Programmed by : Guimauve
; Date : 09-02-2012
; Last Update : 09-02-2012
; PureBasic code : 4.61
; Plateform : Windows, Linux, MacOS X
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

ToolBoxFile "Read Write Null Terminated String.pb"
ToolBoxFile "Vector2.pb", "Vector3.pb", "Vector4.pb"
ToolBoxFile "Matrix22.pb", "Matrix33.pb", "Matrix44.pb"

; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<
The ToolBoxManager will intercept the "PB_EditorOutput.pb" file then change it to :

Code: Select all

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Project name : Example of ToolBoxFile system
; File Name : My source Code.pb
; File version: 0.0.0
; Programmation : OK
; Programmed by : Guimauve
; Date : 09-02-2012
; Last Update : 09-02-2012
; PureBasic code : 4.61
; Plateform : Windows, Linux, MacOS X
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

IncludeFile "/home/guimauve/Codes PureBasic/75 - ToolBox/Read-Write/Read Write Null Terminated String.pb"
IncludeFile "/home/guimauve/Codes PureBasic/75 - ToolBox/Maths/Vector2.pb"
IncludeFile "/home/guimauve/Codes PureBasic/75 - ToolBox/Maths/Vector3.pb"
IncludeFile "/home/guimauve/Codes PureBasic/75 - ToolBox/Maths/Vector4.pb"
IncludeFile "/home/guimauve/Codes PureBasic/75 - ToolBox/Maths/Matrix22.pb"
IncludeFile "/home/guimauve/Codes PureBasic/75 - ToolBox/Maths/Matrix33.pb"
IncludeFile "/home/guimauve/Codes PureBasic/75 - ToolBox/Maths/Matrix44.pb"

; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<
So the compiler see only long IncludeFile and your source code will remain clear and your defined source can remain to the same folder. You don't have to specify were the ToolBoxFile are located just their names.

For the moment, 1 of 3 functionality work properly, the code compiling. The ToolBoxManager setting window are in progress. And ToolBox source file load is the blocking point (I use "Shift" + "F12" while cursor is located on the "ToolBoxFile" keyword). For the moment I can get the line :
  • ToolBoxFile "Matrix22.pb", "Matrix33.pb", "Matrix44.pb"
I can rebuilt the complete path + filename :
  • "/home/guimauve/Codes PureBasic/75 - ToolBox/Maths/Matrix22.pb"
  • "/home/guimauve/Codes PureBasic/75 - ToolBox/Maths/Matrix33.pb"
  • "/home/guimauve/Codes PureBasic/75 - ToolBox/Maths/Matrix44.pb"
But I can't tell the IDE to load them in new tabs, 1 for each file. Someone know how to do it ? Maybe something like :

Code: Select all

Current_IDE.s = GetEnvironmentVariable("PB_TOOL_IDE")
RunProgram(Current_IDE, Files, ??? )
But this don't work, or I have miss something important.

Thanks in advance and best regards.
Guimauve
Last edited by Guimauve on Mon Feb 13, 2012 11:51 pm, edited 1 time in total.
User avatar
spikey
Enthusiast
Enthusiast
Posts: 771
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: How to load file to the IDE from an external tool

Post by spikey »

Horst wrote an addon for the IDE which provides a context menu to open include files from within the ide. It shows how to do something similar and I'm sure you could adapt his code.
Go to this page and then follow the link to "InclOpen" - the source code is included so you can see how it works.
http://home.mnet-online.de/horst.muc/pb/

The interesting line is towards the bottom:-
ShellExecute_(Window,"open",IDE,#q2$+item()\path+#q2$,"",#SW_SHOW)

In your case you'd need to call the shell execute command multiple times - once for each include file in the list - but from what you say I think you're already most of the way there anyway.
User avatar
Guimauve
Enthusiast
Enthusiast
Posts: 742
Joined: Wed Oct 22, 2003 2:51 am
Location: Canada

Re: [Solved] How to load file to the IDE from an external to

Post by Guimauve »

Sorry if I'm late, but I have solved the problem last week-end.

Sometime just a little mistake make thing not working.

By the way, my ToolBox Manager will be released tomorrow, I just need to translate the help file.

Thanks anyway.

Best regards.
Guimauve
Post Reply