Jump to content
Sign in to follow this  
SomeBody22

Converts punctuation from ASCII code(From VB.net)

Recommended Posts

SomeBody22

Hello, Ineed a function like the one below(VB.net), which convertsextended characters to standard(printable Characters/Punctuation):

CType(ConvertPunct(i), Char)

Example:

While 1
For $i = 150 To 190
If $i = 162 Then
ConsoleWrite("LControl")
ElseIf $i = 163 Then
ConsoleWrite("RControl")
ElseIf $i = 188 Then
ConsoleWrite(","); 188 should be 44(,)
ElseIf $i = 189 Then
ConsoleWrite("-"); -(Hyphen Key) = BD(Hex) = 189(Dec on Extended Character ANSII) = 45(Dec on ASCII)
ElseIf $i = 190 Then
ConsoleWrite("."); .(Period Key) = BE(Hex) = 190(Dec on Extended Character ANSII) =46(Dec on ASCII)
;[Continued ...]
EndIf
Next
Sleep(1)
WEnd
Edited by SomeBody22

Share this post


Link to post
Share on other sites
jchd

Can you explain where you got those decimal values from? They don't match common character sets.

Corollary: what's your locale?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
SomeBody22

#include <Misc.au3>

While 1
For $i = 0 To 190
$a_Result = _IsPressed(Hex($i))
If $a_Result = 1 Then
If $i = 162 Then
ConsoleWrite("LControl")
ElseIf $i = 163 Then
ConsoleWrite("RControl")
ElseIf $i = 188 Then
ConsoleWrite(","); 188 should be 44(,)
ElseIf $i = 189 Then
ConsoleWrite("-"); -(Hyphen Key) = BD(Hex) = 189(Dec on Extended Character ANSII) = 45(Dec on ASCII)
ElseIf $i = 190 Then
ConsoleWrite("."); .(Period Key) = BE(Hex) = 190(Dec on Extended Character ANSII) = 46(Dec on ASCII)
Else
ConsoleWrite("Pressed key: " & Chr($i) & @CRLF);
;[Continued ...]
EndIf
EndIf
Next
WEnd

I need make a macro to do that, soon after pressing a key with punctuation he must recognize and record the key to later be used at the time of reproduction, currently, isn't recognizing properly the key pressed.

And I don't want to bind the keys with the HotKeySet.

Edited by SomeBody22

Share this post


Link to post
Share on other sites
jchd

_IsPressed is not the right thing for you. Lookup _WinAPI_SetWindowsHookEx in the help file.

Now you're on your own!

  • Like 1

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
SomeBody22

Thank you very much, _WinAPI_SetWindowsHookEx is really better than _IsPressed in this case...

But the dilemma remains, how to convert a Virtual-Key into a character ASCII(easily)?

Share this post


Link to post
Share on other sites
jchd

Use the vkCode element from the structure $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) in the callback procedure you register. This is the extended ASCII character code, and some extra codes for special keys, which you can find on MSDN after searching for vkCode.

As I said I've good reason to keep my hints a bit cryptic. There's some potential here we don't want to discuss for obvious reasons.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
SomeBody22

Thanks again.

I managed to solve using "GetKeyState" and "GetKeyNameText".

Edited by SomeBody22

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • Bester
      By Bester
      Hello, 
      i would like to ask for some help on how to write something like this in Autoit
      If CType(update, WUApiLib.IUpdate3).BrowseOnly = True Then opt_updates = opt_updates + 1 Else imp_updates = imp_updates + 1 End If I`m trying to find Important Windows updates only, but for some reason this code:
      $ColNeeded = $objSearcher.Search("BrowseOnly=0 and IsInstalled=0 and IsHidden=0") $update = $ColNeeded.Updates.Item($i - 1) returns all update (important and optional) as important (even though BrowseOnly=0). I think i`m missing a reference to WUApi.DLL in my code but i couldn`t find anything else to help me :/
      If someone could help me either by providing a Autoit alternative to 
      CType(update, WUApiLib.IUpdate3).BrowseOnly = True or another way to find only important Windows updates i would be very grateful.
      Thank you
    • trynhyty
      By trynhyty
      Hi everybody, new here.

      I'm messing around with AutoIT since a few days. 

      I'm actually doing some experiment on my computer, and want to do a simple textbox on my desk, and when I type some things like "chrome" then click OK or input Enter, it launch chrome.exe

      Anyway, I'm storing a historic of my inputs in a txt file. And if I push my BackSpace button, I'd like to make my code delete the last character of the txt file instead of FileWrite ($historic, 'BACKSPACE') .. 

       Is there a special character that can delete my last char in the txt file ? I remember doing domething like that in C but it was years ago and I was beginning... 

      Thanks for your help !
    • Command3r
      By Command3r
      Hi, i wanted to make inputbox password, need to get it's chars length in it, because the "password char" is too secure
      and i need the user to know if he is writing or not!!

      here's my effort

      Global $length, $Pw $Pw = InputBox("Security", "Type password to Encrypt/Decrypt file." & @CRLF & "Notice: password case sensitive" & @CRLF & "Pw length: " & $length, "", "ٌ", 220, 150) $length = StringLen($Pw) MsgBox(0, "", $length) i tried to put $length above $Pw but didn't work too.

      thanks
    • twitchyliquid64
      By twitchyliquid64
      Title says it all.

      I'm trying to communicate with a server, where the first two bytes are an u16 of the length of the packet.

      But I have no idea how to go to u16...in order to send it over TCP...

      Anyone know how?

      Thanks in advance.
×