[solved] send a file to the ide?

Just starting out? Need help? Post your questions and find answers here.
User avatar
idle
Always Here
Always Here
Posts: 6026
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

[solved] send a file to the ide?

Post by idle »

I need to find a nice way to send a file to the IDE from an external tool
current method doesn't work if there are spaces in the file name and it will also open another instance of the IDE which isn't intended.
#Gadget_file is a button gadget and on left click it

Code: Select all

RunProgram(#PB_Compiler_Home + "purebasic.exe",GetGadgetText(#Gadget_file),"")
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4991
Joined: Sun Apr 12, 2009 6:27 am

Re: send a file to the ide?

Post by RASHAD »

Hi idle
Did not test it but I think it might work
1- Register your file type to PB (like *.txt)
2- Use the next

Code: Select all

ShellExecute_(#Null, @"open"	, @Yourfile$, @"", @"Purebasic folder", #SW_NORMAL)
I hope it will work
Just test it with *.txt and the context menu Open with and it works
Egypt my love
User avatar
idle
Always Here
Always Here
Posts: 6026
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: send a file to the ide?

Post by idle »

RASHAD wrote: Mon Jan 13, 2025 1:46 am Hi idle
Did not test it but I think it might work
1- Register your file type to PB (like *.txt)
2- Use the next

Code: Select all

ShellExecute_(#Null, @"open"	, @Yourfile$, @"", @"Purebasic folder", #SW_NORMAL)
I hope it will work
Just test it with *.txt and the context menu Open with and it works
Thanks it works, sent you a PM
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4991
Joined: Sun Apr 12, 2009 6:27 am

Re: send a file to the ide?

Post by RASHAD »

Got it
Thanks idle for every thing
I wish you and your family a very good year and the next year and the next..... :D
Egypt my love
User avatar
idle
Always Here
Always Here
Posts: 6026
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: send a file to the ide?

Post by idle »

RASHAD wrote: Mon Jan 13, 2025 2:20 am Got it
Thanks idle for every thing
I wish you and your family a very good year and the next year and the next..... :D
:D
Thank you, the forum is a much better place with you around.
I plan to be around for many more years.
AZJIO
Addict
Addict
Posts: 2224
Joined: Sun May 14, 2017 1:48 am

Re: [solved] send a file to the ide?

Post by AZJIO »

idle wrote: Mon Jan 13, 2025 1:09 am

Code: Select all

RunProgram(#PB_Compiler_Home + "purebasic.exe",GetGadgetText(#Gadget_file),"")
1. All paths that are in the second parameter must be escaped with quotes, since on the command line a space is a parameter separator, and quotes correct this.
2. #PB_Compiler_Home - this is the path for your OS, on other computers it is different. This is correct only if the source is used, then on another computer its own path will be obtained.

Code: Select all

path$ = GetEnvironmentVariable("PB_TOOL_IDE")
If Asc(path$) And FileSize(path$) > 0
	RunProgram(path$, #DQUOTE$ + GetGadgetText(#Gadget_file) + #DQUOTE$,"")
EndIf
If two IDEs of different versions are open, then PB_TOOL_IDE uses the path from the instance in which the tool is running.
User avatar
idle
Always Here
Always Here
Posts: 6026
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: [solved] send a file to the ide?

Post by idle »

AZJIO wrote: Mon Jan 13, 2025 4:38 am
idle wrote: Mon Jan 13, 2025 1:09 am

Code: Select all

RunProgram(#PB_Compiler_Home + "purebasic.exe",GetGadgetText(#Gadget_file),"")
1. All paths that are in the second parameter must be escaped with quotes, since on the command line a space is a parameter separator, and quotes correct this.
2. #PB_Compiler_Home - this is the path for your OS, on other computers it is different. This is correct only if the source is used, then on another computer its own path will be obtained.

Code: Select all

path$ = GetEnvironmentVariable("PB_TOOL_IDE")
If Asc(path$) And FileSize(path$) > 0
	RunProgram(path$, #DQUOTE$ + GetGadgetText(#Gadget_file) + #DQUOTE$,"")
EndIf
If two IDEs of different versions are open, then PB_TOOL_IDE uses the path from the instance in which the tool is running.
Thanks, that works great.
Post Reply