Page 1 of 1
[solved] send a file to the ide?
Posted: Mon Jan 13, 2025 1:09 am
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),"")
Re: send a file to the ide?
Posted: Mon Jan 13, 2025 1:46 am
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
Re: send a file to the ide?
Posted: Mon Jan 13, 2025 1:55 am
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
Re: send a file to the ide?
Posted: Mon Jan 13, 2025 2:20 am
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.....

Re: send a file to the ide?
Posted: Mon Jan 13, 2025 3:07 am
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.....
Thank you, the forum is a much better place with you around.
I plan to be around for many more years.
Re: [solved] send a file to the ide?
Posted: Mon Jan 13, 2025 4:38 am
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.
Re: [solved] send a file to the ide?
Posted: Mon Jan 13, 2025 4:50 am
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.