├── LICENSE ├── README.md ├── Screenshot.png └── scr └── TextConverter.ahk /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TextConverter by jNizM 2 | Convert text via AutoHotkey 3 | 4 | 5 | ## Features 6 | * Convert Text to: Char, Decimal, Octal, Hexadecimal, Binary 7 | 8 | ## Screenshot 9 | ![Screenshot](Screenshot.png) 10 | 11 | 12 | ## Info 13 | * Version: v0.2 14 | * URL: [AHK Thread](http://ahkscript.org/boards/viewtopic.php?f=6&t=133) 15 | 16 | 17 | ## Changelog 18 | * 0.2 | Fixed bugs, Improved code, Removed Morsecode, Added Dec/Hex to Char 19 | * 0.1 | First Release 20 | 21 | 22 | ## Contributing 23 | * thanks to hd0202 for his function 24 | * thanks to tomoe_uehara for her idea 25 | * thanks to AutoHotkey Community 26 | 27 | 28 | ## Copyright and License 29 | [Unlicense](LICENSE) -------------------------------------------------------------------------------- /Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jNizM/TextConverter/69a35f503b2bff27d6963af0b77e2f0cf21f0378/Screenshot.png -------------------------------------------------------------------------------- /scr/TextConverter.ahk: -------------------------------------------------------------------------------- 1 | ; =============================================================================================================================== 2 | ; AHK Version ...: AHK_L 1.1.20.03 x64 Unicode 3 | ; Win Version ...: Windows 7 Professional x64 SP1 4 | ; Description ...: Convert Text to: 5 | ; Char / Decimal / Octal / Hexadecimal / Binary 6 | ; Version .......: v0.2 7 | ; Modified ......: 2015.03.22-1732 8 | ; Author ........: jNizM 9 | ; Licence .......: Unlicense (http://unlicense.org/) 10 | ; =============================================================================================================================== 11 | ;@Ahk2Exe-SetName TextConverter 12 | ;@Ahk2Exe-SetDescription TextConverter 13 | ;@Ahk2Exe-SetVersion v0.2 14 | ;@Ahk2Exe-SetCopyright Copyright (c) 2013-2015`, jNizM 15 | ;@Ahk2Exe-SetOrigFilename TextConverter.ahk 16 | ; =============================================================================================================================== 17 | 18 | ; GLOBAL SETTINGS =============================================================================================================== 19 | 20 | #Warn 21 | #NoEnv 22 | #SingleInstance Force 23 | 24 | global name := "TextConverter" 25 | global version := "v0.2" 26 | 27 | ; SCRIPT ======================================================================================================================== 28 | 29 | Gui, Main: +LabelMain 30 | Gui, Main: Margin, 10, 10 31 | Gui, Main: Font, s9, Courier New 32 | 33 | Gui, Main: Add, Text, xm ym w80 h22 0x202, Text 34 | Gui, Main: Add, Edit, x+10 ym w390 vTextTo gCONVERT 35 | Gui, Main: Add, Text, xm y+10 w483 h1 0x10 36 | 37 | Gui, Main: Add, Text, xm y+10 w80 h22 0x202, % "Char" 38 | Gui, Main: Add, Edit, x+10 yp w390 0x0800 vCHAR 39 | Gui, Main: Add, Text, xm y+6 w80 h22 0x202, % "Decimal" 40 | Gui, Main: Add, Edit, x+10 yp w390 0x0800 vDEC 41 | Gui, Main: Add, Text, xm y+6 w80 h22 0x202, % "Octal" 42 | Gui, Main: Add, Edit, x+10 yp w390 0x0800 vOCT 43 | Gui, Main: Add, Text, xm y+6 w80 h22 0x202, % "Hexadecimal" 44 | Gui, Main: Add, Edit, x+10 yp w390 0x0800 vHEX 45 | Gui, Main: Add, Text, xm y+6 w80 h22 0x202, % "Binary" 46 | Gui, Main: Add, Edit, x+10 yp w390 0x0800 vBIN 47 | 48 | Gui, Main: Add, Text, xm y+10 w483 h1 0x10 49 | 50 | Gui, Main: Add, Text, xm y+10 w80 h22 0x202, % "Text Length" 51 | Gui, Main: Add, Edit, x+10 yp w40 0x0800 vTXTL 52 | 53 | Gui, Main: Add, Button, x+10 yp h23 gGUIChild, % "Chr()" 54 | 55 | Gui, Main: Font, cSilver, 56 | Gui, Main: Add, Text, x+10 yp w282 h22 0x202, % "made with " Chr(9829) " and AHK 2013-" A_YYYY ", jNizM" 57 | 58 | Gui, Main: Show, AutoSize, % name " " version 59 | Gui, Main: +LastFound 60 | WinSet, Redraw 61 | return 62 | 63 | CONVERT: 64 | Gui Main: Default 65 | Gui, Submit, NoHide 66 | CTCHR := CTDEC := CTOCT := CTHEX := CTBIN := "" 67 | loop % Lenght := StrLen(TextTo) 68 | { 69 | CCHAR := SubStr(TextTo, A_Index, 1) 70 | CTASC := Asc(CCHAR) 71 | CTCHR .= "Chr(" CTASC ")" 72 | CTDEC .= CTASC " " 73 | CTOCT .= ConvertBase(10, 8, CTASC) " " ; or Format("{1:o}", CTASC) 74 | CTHEX .= "0x" ConvertBase(10, 16, CTASC) " " ; or Format("{1:#x}", CTASC) 75 | CTBIN .= ConvertBase(10, 2, CTASC) " " 76 | } 77 | GuiControl,, TXTL, % Lenght 78 | GuiControl,, CHAR, % CTCHR 79 | GuiControl,, DEC, % CTDEC 80 | GuiControl,, OCT, % CTOCT 81 | GuiControl,, HEX, % CTHEX 82 | GuiControl,, BIN, % CTBIN 83 | return 84 | 85 | GUIChild: 86 | Gui, Main: +0x8000000 87 | Gui, Child: New, +e0x80 -0x20000 +LabelChild +OwnerMain 88 | Gui, Child: Margin, 10, 10 89 | Gui, Child: Font, s9, Courier New 90 | Gui, Child: Add, Text, xm ym w80 h22 0x200, % "Dec / Hex" 91 | Gui, Child: Add, Edit, x+5 ym w100 gTOCHAR vVarIn 92 | Gui, Child: Add, Text, xm y+10 w188 h1 0x10 93 | Gui, Child: Add, Text, xm y+10 w80 h22 0x200, % "Char" 94 | Gui, Child: Add, Edit, x+5 yp w100 0x0800 vVarOut 95 | Gui, Child: Show, AutoSize, % "DEC/HEX to Char" 96 | Gui, Child: -e0x80 97 | return 98 | 99 | TOCHAR: 100 | Gui Child: Default 101 | Gui, Submit, NoHide 102 | GuiControl,, VarOut, % Chr(VarIn) 103 | return 104 | 105 | ; FUNCTIONS ===================================================================================================================== 106 | 107 | ConvertBase(InputBase, OutputBase, nptr) ; Base 2 - 36 108 | { 109 | static u := A_IsUnicode ? "_wcstoui64" : "_strtoui64" 110 | static v := A_IsUnicode ? "_i64tow" : "_i64toa" 111 | VarSetCapacity(s, 66, 0) 112 | value := DllCall("msvcrt.dll\" u, "Str", nptr, "UInt", 0, "UInt", InputBase, "CDECL Int64") 113 | DllCall("msvcrt.dll\" v, "Int64", value, "Str", s, "UInt", OutputBase, "CDECL") 114 | return s 115 | } 116 | 117 | ; EXIT ========================================================================================================================== 118 | 119 | MainClose: 120 | ExitApp 121 | 122 | ChildClose: 123 | Gui, Main: -0x8000000 124 | Gui, Child: Destroy 125 | return --------------------------------------------------------------------------------