It is currently Mon Jul 06, 2020 5:31 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Shortcut to #PB_Any?
PostPosted: Tue Jun 09, 2020 12:17 am 
Offline
User
User

Joined: Fri Jun 05, 2020 12:47 am
Posts: 37
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Shortcut to #PB_Any?
PostPosted: Tue Jun 09, 2020 1:03 am 
Offline
Addict
Addict

Joined: Thu Apr 18, 2019 8:17 am
Posts: 893
Not that I know of. I suggest you post it as a wish in the Requests area.


Top
 Profile  
Reply with quote  
 Post subject: Re: Shortcut to #PB_Any?
PostPosted: Tue Jun 09, 2020 1:28 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jan 10, 2008 1:30 pm
Posts: 1282
Location: Germany, Glienicke
Just compile this code and add it as a IDE tool with your specified shortcut (for example Ctrl+Shift+A)
Code:
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")

_________________
ImageImage


Top
 Profile  
Reply with quote  
 Post subject: Re: Shortcut to #PB_Any?
PostPosted: Tue Jun 09, 2020 1:49 am 
Offline
Addict
Addict

Joined: Thu Apr 18, 2019 8:17 am
Posts: 893
Thanks, but that's a hotkey. We're talking about auto-complete.


Top
 Profile  
Reply with quote  
 Post subject: Re: Shortcut to #PB_Any?
PostPosted: Tue Jun 09, 2020 8:30 am 
Offline
Addict
Addict
User avatar

Joined: Wed Apr 30, 2003 8:15 am
Posts: 1027
Location: Germany
@STARGÅTE: nice tool, thank you!

_________________
"Daddy, I'll run faster, then it is not so far..."


Top
 Profile  
Reply with quote  
 Post subject: Re: Shortcut to #PB_Any?
PostPosted: Tue Jun 09, 2020 2:00 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Sep 20, 2004 7:12 am
Posts: 584
Location: Hell
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye