Shortcut to #PB_Any?

Working on new editor enhancements?
AMpos
Enthusiast
Enthusiast
Posts: 128
Joined: Fri Jun 05, 2020 12:47 am

Shortcut to #PB_Any?

Post by AMpos »

Is there a shortcut, or a way to define one, so when I type in the IDE something like "##", it changes to "#PB_Any"? (I'm getting tired of writing the full "#PB_Any")

Thanks in advance.
BarryG
Addict
Addict
Posts: 1506
Joined: Thu Apr 18, 2019 8:17 am

Re: Shortcut to #PB_Any?

Post by BarryG »

Not that I know of. I suggest you post it as a wish in the Requests area.
User avatar
STARGÅTE
Addict
Addict
Posts: 1497
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Shortcut to #PB_Any?

Post by STARGÅTE »

Just compile this code and add it as a IDE tool with your specified shortcut (for example Ctrl+Shift+A)

Code: Select all

Procedure GetProcessFromWindow(WindowID.i)
	Protected ProcessID.i
	If GetWindowThreadProcessId_(WindowID, @ProcessID)
		ProcedureReturn OpenProcess_(#PROCESS_ALL_ACCESS, #False, ProcessID)
	EndIf
EndProcedure

Procedure SendText(Text.s)
	Protected ScintillaID.i = Val(GetEnvironmentVariable("PB_TOOL_Scintilla"))
	Protected ProcessID.i = GetProcessFromWindow(ScintillaID)
	Protected Length.i
	Protected *MemoryID, *Buffer, Format.i
	If ProcessID
		Select SendMessage_(ScintillaID, #SCI_GETCODEPAGE, #Null, #Null)
			Case 0     : Format = #PB_Ascii
			Case 65001 : Format = #PB_UTF8
		EndSelect
		Length.i = StringByteLength(Text, Format)
		*Buffer = AllocateMemory(Length+SizeOf(Character))
		If *Buffer
			PokeS(*Buffer, Text, #PB_Default, Format)
			*MemoryID = VirtualAllocEx_(ProcessID, #Null, Length, #MEM_RESERVE|#MEM_COMMIT, #PAGE_EXECUTE_READWRITE)
			If *MemoryID
				WriteProcessMemory_(ProcessID, *MemoryID, *Buffer, Length, #Null)
				SendMessage_(ScintillaID, #SCI_ADDTEXT, Length, *MemoryID)
				VirtualFreeEx_(ProcessID, *MemoryID, Length, #MEM_RELEASE)
			EndIf
			FreeMemory(*Buffer)
		EndIf
		CloseHandle_(ProcessID)
	EndIf
EndProcedure

SendText("#PB_Any")
PB 5.73 ― Win 10, 20H2 ― Ryzen 9 3900X ― Radeon RX 5600 XT ITX ― Vivaldi 3.6 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
BarryG
Addict
Addict
Posts: 1506
Joined: Thu Apr 18, 2019 8:17 am

Re: Shortcut to #PB_Any?

Post by BarryG »

Thanks, but that's a hotkey. We're talking about auto-complete.
dige
Addict
Addict
Posts: 1098
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: Shortcut to #PB_Any?

Post by dige »

@STARGÅTE: nice tool, thank you!
"Daddy, I'll run faster, then it is not so far..."
User avatar
HeX0R
Enthusiast
Enthusiast
Posts: 654
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Shortcut to #PB_Any?

Post by HeX0R »

AMpos wrote:Is there a shortcut, or a way to define one, so when I type in the IDE something like "##", it changes to "#PB_Any"? (I'm getting tired of writing the full "#PB_Any")

Thanks in advance.
Use -1 instead ;)
Link dead?
Change h3x0r.ath.cx into hex0rs.coderbu.de and all will be fine.
User avatar
oreopa
Enthusiast
Enthusiast
Posts: 275
Joined: Sat Jun 24, 2006 3:29 am
Location: Edinburgh, Scotland.

Re: Shortcut to #PB_Any?

Post by oreopa »

Code: Select all

#z = #PB_Any
Proud supporter of PB! * Musician * C64/6502 Freak
User avatar
Caronte3D
Enthusiast
Enthusiast
Posts: 155
Joined: Fri Jan 22, 2016 5:33 pm
Location: Spain

Re: Shortcut to #PB_Any?

Post by Caronte3D »

HeX0R wrote:Use -1 instead ;)
Nice! :wink:
Post Reply