|
|
#1 |
|
Junior Member
Join Date: Feb 2007
Posts: 7
|
Please help to create function StrToCodes
Please help to create function StrToCodes
That she found for instance word Qwerty after passing through this function became aea8baadaba6 Q W E R T Y U I O P A S D F G H J K L Z X C V B N M ae a8 ba ad ab a6 aa b6 b0 af be ac bb b9 b8 b7 b5 b4 b3 a5 a7 bc a9 bd b1 b2 q w e r t y u i o p a s d f g h j k l z x c v b n m 8e 88 9a 8d 8b 86 8a 96 90 8f 9e 8c 9b 99 98 97 95 94 93 85 87 9c 89 9d 91 92 1 2 3 4 5 6 7 8 9 0 ce cd cc cb ca c9 c8 c7 c6 cf ` - = ~ ! @ # $ % ^ & * ( ) _ + { } | [ ] \ ; ' : " , . / < > ? 9f d2 c2 81 de bf dc db da a1 d9 d5 d7 d6 a0 d4 84 82 83 a4 a2 a3 c4 d8 c5 dd d3 d1 d0 c3 c1 c0 Sorry for bad English |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Mar 2006
Location: Dallas
Posts: 462
|
The tricky part of this is the conversion from a single character to ASCII. A function in the wiki does that; the rest was pretty straight-forward.
The codes you want to convert the letters into are inverted ASCII (ASCII that has been subtracted from 255). Don |
|
|
|
|
|
#3 |
|
Major Dude
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
|
The attached should work. (I've not tested it very well, but from the little I did, it works.)
It relies on outputing a "translation file" (basically a config file I use to "look up" each letter of the string.) It relies on logiclib, ConfigReadS, and ConfigWriteS. One problem, however, is that I wasn't able to write the translation code for the backward quote (`). Not sure whether or not this is a bug with NSIS. Here's the line that failed: code: Maybe someone else would have some suggestions. Since it uses a file, speed might become an issue if you have to translate large sets of data. (If you need to boost performance, you might try using the NSIS Array plugin instead of a file to use for the lookup table). I've wrapped it into an NSH file. Usage is simple: 1) Include TextToCode.nsh in the top of your script 2) Add the command ${InitTranslator} to .OnInit 3) to translate text, use ${TextToCode} "text" $var (where $var is your output variable) See the attached sample. |
|
|
|
|
|
#4 |
|
Major Dude
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
|
hmm... I must have posted the same time as demiller9...
I was thinking it looked like HEX codes, but they didn't seem to be the same HEX codes as a regular PC uses. (Maybe I'm wrong?) |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Feb 2007
Posts: 7
|
Thanks
Both of a variant approach, but at demiller9 the idle time (that that is necessary) Sorry for bad English =) |
|
|
|
|
|
#6 | |
|
Senior Member
Join Date: Mar 2006
Location: Dallas
Posts: 462
|
Comperio wrote:
Quote:
I didn't check a backquote in my method until I read your post; my test program handles `, ', and " OK. Don |
|
|
|
|
|
|
#7 | |
|
Junior Member
Join Date: Oct 2007
Posts: 10
|
Quote:
Paying it forward, I used this as a base for a URLEncode function and these are the adjustments that I made:Add these two lines at the appropriate places: !include "WordFunc.nsh" !insertmacro WordFind And then this is URLEncode function, based on demiller's StrToCodes (with un-inverted ASCII )code: |
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|