Occasionally I find the need to insert a path or a file path into code.
It might be a useful new feature for the IDE to be able to look up a path/file using the Path or Open File requesters which would then insert that path/file into code at the current cursor position.
E.g.
If OpenFile(0, "")
...
After entering in the above code you would put the cursor in between the quotes, then select the new IDE 'Insert Path...' or 'Insert File Path...' option & do the path/file lookup to be inserted into the code.
If OpenFile(0, "c:\myprog\data\test.dat") ;Inserted full file path
...
myfile.s = "test.dat"
If OpenFile(0, "c:\myprog\data\" + myfile) ;Inserted just path
...
IDE - Insert path or path/file into code
Re: IDE - Insert path or path/file into code
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
Get the Scintilla handle provided by the IDE via arguments or envVariable and just start taking control of the IDEs Scintilla gadgetUSCode wrote:An external tool can insert text directly into the IDE editor?
(Not paste from clipboard but insert directly into the text after selecting the path/file)

Check out OOP support for PB here!
> An external tool can insert text directly into the IDE editor?
Sure. Here's my example. Make it an exe, then add it to the Tools menu.
Just set the "Commandline", "Name" and "Event to trigger" fields for it.
> Not paste from clipboard but insert directly into the text after selecting
> the path/file
Mine uses the clipboard but doesn't lose the existing contents, if that's
what you're worried about?
Sure. Here's my example. Make it an exe, then add it to the Tools menu.
Just set the "Commandline", "Name" and "Event to trigger" fields for it.
> Not paste from clipboard but insert directly into the text after selecting
> the path/file
Mine uses the clipboard but doesn't lose the existing contents, if that's
what you're worried about?
Code: Select all
p$=PathRequester("Select path to paste into the IDE:","")
If p$
c$=GetClipboardText()
SetClipboardText(Chr(34)+p$+Chr(34))
keybd_event_(#VK_CONTROL,0,0,0)
keybd_event_(#VK_V,0,0,0)
keybd_event_(#VK_V,0,#KEYEVENTF_KEYUP,0)
keybd_event_(#VK_CONTROL,0,#KEYEVENTF_KEYUP,0)
SetClipboardText(c$)
EndIf
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
cross-platform ?
Can this be done in a cross-platform manner, with pure PB or does it require platform-specific API calls?