Search the Community
Showing results for tags 'ascii'.
-
This "cow" seems funny to me, At this link (https://dodona.ugent.be/en/activities/1605325419/#) a brief rough description of what this script can do (sorry for the laziness, but that description may be fine). You can use the _CowSayWin() function to display a message formatted in a comic along with an ascii art figure in a standalone window, or you can use _String_CowSay() function to format a plain string in a comic along with an ascii art figure and have it returned in a string for your own purposes, you will probably use it in Consolewrite () or whatever ... The script makes use of the _StringSize() function written by @Melba23 (thanks Melba) of the StringSize.au3 udf that you can extract from the zip file located at this link: https://www.autoitscript.com/forum/topic/114034-stringsize-m23-new-version-16-aug-11/. You have to save that udf file in the same directory along with this script. It also makes use of the _WinSetClientSize() function written by @KaFu. (thanks kafu) This function is already built into the main script. I hope you have fun #include <FontConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <WinAPISys.au3> #include <array.au3> #include <String.au3> #include "StringSize.au3" ; <-- https://www.autoitscript.com/forum/topic/114034-stringsize-m23-new-version-16-aug-11/ _Example() Func _Example() SRandom(@SEC) Local $hCowWin, $aMsg = 0 Local $sMessage, $iWidth, $iClipart, $iTextAlig Local $aMessages[] = ["Bottled water companies don’t produce water, they produce plastic bottles.", _ "The greatest glory in living lies not in never falling, but in rising every time we fall.", _ "Your time is limited, so don't waste it living someone else's life. " & _ "Don't be trapped by dogma which is living with the results of other people's thinking.", _ "Insanity is doing the same thing over and over again and expecting different results", _ "The way to get started is to quit talking and begin doing."] For $i = 1 To 6 $sMessage = $aMessages[Random(0, UBound($aMessages) - 1, 1)] $iWidth = Random(21, 90, 1) $iClipart = Random(0, 3, 1) $iTextAlign = 1 ; Random(0, 2, 1) Left and right alignments are a bit ugly. ; they are allowed however if you need them ; ; You can use the _CowSayWin() function to create the "cowsay" message in a window $hCowWin = _CowSayWin($sMessage, $iWidth, $iClipart, $iTextAlign) ; ; or you can use the _String_CowSay() function to get a string of the "cowsay ascii clipart" ; so that you can use it however you like, probably in a Consolewrite () for example ... ConsoleWrite(_String_CowSay($sMessage, $iWidth, $iClipart, $iTextAlign) & @CRLF) While 1 $aMsg = GUIGetMsg($GUI_EVENT_ARRAY) Switch $aMsg[1] Case $hCowWin Switch $aMsg[0] Case -3 ; $GUI_EVENT_CLOSE ExitLoop EndSwitch EndSwitch WEnd GUIDelete(HWnd($hCowWin)) Next EndFunc ;==>_Example ; #FUNCTION# ==================================================================================================================== ; Name ..........: _CowSayWin ; Description ...: Display a message in a standalone windows formatted in a balloon along with an ascii art figure ; Syntax ........: _CowSayWin($sMsg[, $iBoxLen = 21[, $iShape = 0[, $iAlign = 1]]]) ; Parameters ....: $sMsg - a string value. The message to display (in a single line without @cr and or @lf) ; $iBoxLen - [optional] an integer value. Default is 21. ; The wanted width of the Box contining the message ; $iShape - [optional] an integer value. Default is 0. ; The index of the ascii art figure to be displayed along with the message. ; Available values are: ; 0 -> a cow ; 1 -> a sandwich-man ; 2 -> the penguin Tux ; 3 -> a hanging monkey ; ..... to be continued (maybe) ; $iAlign - [optional] an integer value. Default is 1. ; How to justify the string within the frame, that is: ; 0 -> left justified ; 1 -> center justified (default) ; 2 -> right justified ; Return values .: The handle of the created window ; Author ........: Gianni Addiego (Chimp) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _CowSayWin($sMsg, $iBoxLen = 21, $iShape = 0, $iAlign = 1) If $iBoxLen < 21 Then $iBoxLen = 21 Local $iSize = 12 Local $iWeight = $FW_NORMAL Local $iAttrib = $GUI_FONTNORMAL Local $sFont = "Courier new" Local $sSay = _String_CowSay($sMsg, $iBoxLen, $iShape, $iAlign) Local $aMsgReturn = _StringSize($sSay, $iSize, $iWeight, $iAttrib, $sFont) Local $iXpos = (@DesktopWidth - $aMsgReturn[2]) / 2 If $iXpos < 0 Then $iXpos = 0 Local $iYpos = (@DesktopHeight - $aMsgReturn[3]) / 2 If $iYpos < 0 Then $iYpos = 0 Local $hCow = GUICreate("Cowsay", -1, -1, $iXpos, $iYpos, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) ;0x94C803C5, 0x00010101) ; , $WS_EX_DLGMODALFRAME) ;0x94C803C5, 0x00010101) ; Style & ExStyle same as msgbox GUISetFont($iSize, $FW_NORMAL, $GUI_FONTNORMAL, $sFont) _WinSetClientSize($hCow, $aMsgReturn[2], $aMsgReturn[3]) GUICtrlCreateLabel($sSay, 0, 0, $aMsgReturn[2], $aMsgReturn[3]) GUISetState(@SW_SHOW, $hCow) #cs While 1 Switch GUIGetMsg() Case -3 ; $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd #ce Return $hCow EndFunc ;==>_CowSayWin ; By kafu ; https://www.autoitscript.com/forum/topic/201524-guicreate-and-wingetclientsize-mismatch/?do=findComment&comment=1446141 Func _WinSetClientSize($hWnd, $iW, $iH) Local $aWinPos = WinGetPos($hWnd) Local $sRect = DllStructCreate("int;int;int;int;") DllStructSetData($sRect, 3, $iW) DllStructSetData($sRect, 4, $iH) _WinAPI_AdjustWindowRectEx($sRect, _WinAPI_GetWindowLong($hWnd, $GWL_STYLE), _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE)) WinMove($hWnd, "", $aWinPos[0], $aWinPos[1], $aWinPos[2] + (DllStructGetData($sRect, 3) - $aWinPos[2]) - DllStructGetData($sRect, 1), $aWinPos[3] + (DllStructGetData($sRect, 4) - $aWinPos[3]) - DllStructGetData($sRect, 2)) EndFunc ;==>_WinSetClientSize ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StringToColumn ; Description ...: passing a (long) string and a value, it returns that same string ; formatted in a column as wide as the value (string is split by @CRs). ; Whenever possible, it tries not to break the words but to split ; lines in between two words ; Syntax ........: _StringToColumn($sString[, $x = 21]) ; Parameters ....: $sString - a string value. The string to format ; $iColumnWidth - [optional] an integer value. Default is 21. ; The wanted width of the text column ; Return values .: The string formatted as required ; Author ........: Gianni Addiego (Chimp) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _StringToColumn($sString, $iColumnWidth = 21) If $iColumnWidth < 1 Then $iColumnWidth = 1 Local $iPreviousSplit = 1 Local $i = $iColumnWidth While $i <= StringLen($sString) $iSplitPoint = StringInStr($sString, " ", 0, -1, $i + 1) If $iSplitPoint = 0 Or $iSplitPoint <= $iPreviousSplit Then $iSplitPoint = $i $sString = StringLeft($sString, $iSplitPoint) & @CR & StringMid($sString, $iSplitPoint + 1) $i = $iSplitPoint + 1 Else $sString = StringReplace($sString, $iSplitPoint, @CR) $i = $iSplitPoint EndIf $iPreviousSplit = $iSplitPoint $i += $iColumnWidth WEnd If StringRight($sString, 1) = @CR Then $sString = StringTrimRight($sString, 1) Return $sString EndFunc ;==>_StringToColumn ; #FUNCTION# ==================================================================================================================== ; Name ..........: _StringToFrame ; Description ...: places borders only to the left and to the right of the passed string block ; Syntax ........: _StringToFrame($sStr, $iFrameWidth[, $iAlign = 1[, $sV = "|"]]) ; Parameters ....: $sStr - The string to format; multiline string must be splitted by a @cr. ; $iFrameWidth - wanted Width of the frame ; If the desired width is less than the length of the string, the exceeding part is cut off ; If the desired width is wider than the length of the string, spaces are added ; $iAlign - [optional] an integer value. Default is 1. ; The string is justified within the frame based on the value of the $iAlign variable, that is: ; 0 -> left justified ; 1 -> center justified (default) ; 2 -> right justified ; $sV - [optional] a string value. Default is "|". ; This is the character used to draw the two vertical edges ; Return values .: The formatted string ; Author ........: Gianni Addiego (Chimp) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _StringToFrame($sStr, $iFrameWidth, $iAlign = 1, $sV = "|") ; $iAlign: 0=Left; 1=Center; 2=Right If $iFrameWidth < 1 Then $iFrameWidth = 1 Local $a = StringSplit($sStr, @CR, 2) ; 2 = $STR_NOCOUNT For $i = 0 To UBound($a) - 1 Switch $iAlign Case 1 ; Center string $a[$i] = $sV & _StringSetLen(_StringCenter($a[$i], $iFrameWidth), $iFrameWidth) & $sV Case 2 ; Align to right $a[$i] = $sV & _StringSetLen($a[$i], $iFrameWidth * -1) & $sV Case Else ; otherwise Align to left $a[$i] = $sV & _StringSetLen($a[$i], $iFrameWidth) & $sV EndSwitch Next Return _ArrayToString($a, @CR) EndFunc ;==>_StringToFrame ; passing a string and a value it returns that string with a len as required ; By Gianni Addiego Func _StringSetLen($sString, $iWantedLen = 1, $sFillChr = " ") If $iWantedLen = 0 Then Return "" Local $iLen = StringLen($sString) Local $iKeepLeft = $iWantedLen > 0 ; else keep the right side of the string $iWantedLen = Abs($iWantedLen) If $iLen >= $iWantedLen Then ; reduce the string length If $iKeepLeft Then Return StringLeft($sString, $iWantedLen) Else Return StringRight($sString, $iWantedLen) EndIf Else ; add chars to the string to reach the wanted len If $iKeepLeft Then Return $sString & _StringRepeat($sFillChr, $iWantedLen - $iLen) Else Return _StringRepeat($sFillChr, $iWantedLen - $iLen) & $sString EndIf EndIf EndFunc ;==>_StringSetLen ; place a string in the middle of a given space ; By Gianni Addiego Func _StringCenter($sString, $iSpace) Local $iLen = StringLen($sString) $iHloc = Int($iSpace / 2) - Int($iLen / 2) If $iHloc < 0 Then Return StringMid($sString, Abs($iHloc) + 1, $iSpace) Else Return _StringRepeat(" ", $iHloc) & $sString EndIf EndFunc ;==>_StringCenter ; #FUNCTION# ==================================================================================================================== ; Name ..........: _String_CowSay ; Description ...: Formats a string in a balloon along with an ascii art figure ; Syntax ........: _String_CowSay($sMsg[, $iBoxLen = 21[, $iShape = 0[, $iAlign = 1]]]) ; Parameters ....: $sMsg - a string value. The String to format (in a single line without @cr and or @lf) ; $iBoxLen - [optional] an integer value. Default is 21. ; The wanted width of the Box contining the message ; $iShape - [optional] an integer value. Default is 0. ; The index of the ascii art figure to be displayed along with the message. ; Available values are: ; 0 -> a cow ; 1 -> a sandwich-man ; 2 -> the penguin Tux ; 3 -> a hanging monkey ; ..... to be continued (maybe) ; $iAlign - [optional] an integer value. Default is 1. ; How to justify the string within the frame, that is: ; 0 -> left justified ; 1 -> center justified (default) ; 2 -> right justified ; Return values .: The passed string formatted in the required format. ; Author ........: Gianni Addiego (Chimp) ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _String_CowSay($sMsg, $iBoxLen = 21, $iShape = 0, $iAlign = 1) ; minimum $iBoxLen is 21 If $iBoxLen / 2 = Int($iBoxLen / 2) Then $iBoxLen += 1 If $iBoxLen < 22 Then $x = 0 Else $x = Ceiling(($iBoxLen - 21) / 2) EndIf Local $sS = _StringRepeat(" ", $x), $sT = _StringRepeat("~", $x) Local $sHeader, $sFooter Switch $iShape Case 1 $sHeader = _ $sS & " \|||/" & @CRLF & _ $sS & " (o o)" & @CRLF & _ "," & $sT & "oo0~~~~~~(_)~~~~~~~~~" & $sT & "," & @CRLF ; header $sFooter = _ "'" & $sT & "~~~~~~~~~~~~~~~~~~oo0" & $sT & "'" & @CRLF & _ ; footer $sS & " |__|__|" & @CRLF & _ $sS & " || ||" & @CRLF & _ $sS & " oo0 0oo" Case 2 $sHeader = _ "," & $sT & "~~~~~~~~~~~~~~~~~~~~~" & $sT & "," & @CRLF ; header $sFooter = _ "'~~~~~~~~~~~~~~~~~~~~~" & $sT & $sT & "'" & @CRLF & _ " \ .--." & @CRLF & _ " \ |o_o |" & @CRLF & _ " |:_/ |" & @CRLF & _ " // \ \" & @CRLF & _ " (| | )" & @CRLF & _ " /'\_ _/`\" & @CRLF & _ " \___)=(___/" Case 3 $sHeader = _ "," & $sT & "~~~~~~~~~~~~~~~~~~~~~" & $sT & "," & @CRLF ; header $sFooter = _ "'" & $sT & "oo0~~~~~~~~~~~~~~~0oo" & $sT & "'" & @CRLF & _ ; footer $sS & " \\ //" & @CRLF & _ $sS & " > \ \\|||// / <" & @CRLF & _ $sS & " > \ _ _ / <" & @CRLF & _ $sS & " > \ / \ / \ / <" & @CRLF & _ $sS & " > \\_o_o_// <" & @CRLF & _ $sS & " > ( (_) ) <" & @CRLF & _ $sS & " >| |<" & @CRLF & _ $sS & " / |\___/| \" & @CRLF & _ $sS & " / (_____) \" & @CRLF & _ $sS & " / o \" & @CRLF & _ $sS & " ) ___ (" & @CRLF & _ $sS & " / / \ \" & @CRLF & _ $sS & " ( / \ )" & @CRLF & _ $sS & " >< ><" & @CRLF & _ $sS & " ///\ /\\\" & @CRLF & _ $sS & " ''' '''" Case Else $sHeader = _ "," & $sT & "~~~~~~~~~~~~~~~~~~~~~" & $sT & "," & @CRLF ; header $sFooter = _ "'~~~~~~~~~~~~~~~~~~~~~" & $sT & $sT & "'" & @CRLF & _ " \ ^__^" & @CRLF & _ " \ (oo)\_______" & @CRLF & _ " (__)\ )\/\" & @CRLF & _ " ||----w |" & @CRLF & _ " || ||" EndSwitch Return $sHeader & _StringToFrame(_StringToColumn($sMsg, $iBoxLen), $iBoxLen, $iAlign) & @CRLF & $sFooter EndFunc ;==>_String_CowSay
-
(Edited from original. Please note that I AM NOT AN AUTOIT EXPERT. I write code using Autoit frequently but I am no expert, especially when it comes to I/O. So any remarks that start with "Why did you..." can be answered by referring to the first sentence. This project was done in Autoit because of an interface I built to display the data.) Attached is a program and ascii input file I wrote to read stock price data, convert it to binary and then read it back into the program in binary. The goal was to show increased performance for reading the files in binary and provide a demo on how to read/write binary for int32, int64, double and strings for anyone who might find it helpful. The results on my PC show the following: Time to read ascii file only: 456.981951167202 Ascii read & process time: 6061.83075631701 Binary write file time: 14787.9184635239 Time just to read binary file: 42.418867292311 Binary read and process time: 4515.16129830537 A couple things to note: 1) The 32 MB ascii file took 10x longer to read than the 15 MB binary file. Not entirely sure why. Both were read into a buffer. 2) The Binary write takes a long time but I made no effort to optimize this because the plan was to write this file one time only so I don't mind if it takes longer to write this file. I care much more about how long it takes to read the file because I will be reading it many times. 3) There was a modest gain in converting the ascii file to binary in terms of file size and reading speed. So big picture... not sure it's worth the effort to convert the files to binary even though most of the data is numerical data in the binary file. That was actually surprising as I expected there would be more of a difference. Any ideas on how to get the binary data to read at a faster rate would be great. binary.au3 2019_02_08.zip
-
Need to read a small file which looks like 01 01 01 00 21 21 48 4F ����!HHO (cut from hexedit) First four are binary but don't show, last four are ascii "!HHO" I have tried to split the file and look for the ascii string but not succeeded: ; Set the working directory ... or set PATH! ... FileChangeDir("C:\S3_GUI\ncat\") ; Run(@ComSpec & " /k " & "C:\S3_GUI\ncat\Home.bat", "", @SW_HIDE);;comment: not over write Local $hFileOpen = FileOpen("C:\S3_GUI\ncat\homerep", $FO_READ) ;; homerep Local $sFileRead = FileRead($hFileOpen) Local $Comp = StringInStr ($sFileRead,"!HHO",1,4) If( $Comp = 1) Then MsgBox($MB_OK, "Head is Home", "!HHO") Else MsgBox($MB_OK, "Head not Home!","!HHx") EndIf Fails every time. If I open it as binary then I lose the ascii? I've been advised to include the whole file but it's getting big. You need to see it all?
-
I had a need, and so I developed. Before I did that though, I did a quick search of the forum, and found a few things, but none seemed to suit what I really wanted ... though to be honest, I did not investigate them deeply or search extensively. In any case, I am not very good at modifying the code of others, nor do I enjoy doing so, so in the end I decided it was best to start from scratch ... re-inventing the wheel perhaps, but a wheel I feel a certain degree of comfort with. I also thought about Maps, but don't know enough. _IniString Functions (was Ini_InMem) Ini in memory Settings INI - Read/Write once to the disk INI File Processing Functions ... sure to be others. As with all my stuff, feel free to use (no guarantees) or modify ... just give me credit where due. I always go for the quick & simple approach, as those who know me here, are well aware, so without a doubt, my code could be improved - sped up, RegExp used, etc. So feel free to do that, and convert into a proper UDF, if you want, following best practices etc, as I am sure others will appreciate it. Recently, I have come upon a need to extract data from an approximately 50 Mb downloaded Index file, just extracting the few elements I need, and storing them in an INI file. It is quite a time consuming process, especially on my underpowered Netbook, which is where I am using the program I built. I have been considering ways to speed up things. Two good sounding methods, out of several possibles, have come to mind - 1) RAM Disk and 2) Virtual INI processing. That last being a better option, when sharing code (program) with others. Another method, which I am currently using, that did give me some measurable benefit, was to download the almost 50 Mb Index file in Stages (i.e. 30 x 1.4 Mb roughly), extracting data from each in turn. I have also considered extracting to 10 (or 11) separate INI files, rather than the single large INI file (4~5 Mb), as things noticeably slow up as the INI file increases in size ... obviously due to writing time. I can't really speed up the extraction process, but that last method may speed up the writing stage. However, it would require significant program changes, and perhaps not gain me much benefit. To complicate things, there are too many Section names (Index ID's) for the IniReadSectionNames command, so I have had to split them off into their own (read/write) line-by-line index file, and create code to deal with duplicates. When read, Index ID's and Titles populate a Listbox control in a user GUI. So at this point in time, it seems best to use the Virtual INI approach to gain a significant reduction in time taken. For my own specific use, with my slow Netbook, I may also use a RAM Disk. Due to the aforementioned INI issues, and lack of available specific data, probably because it is always program concentric, I have created an ASCII Checker program, which I guess you can say, is AutoIt concentric. Because others may also find it handy, I am providing it here. NOTE - As yet, I am only aware that Escape characters exist, but have not investigated or catered for them in any way. ASCII Checker.zip The Virtual_INI_UDF is still a work in progress, though I have done most of the functions now, with the working but incomplete _Ini_Test function, still requiring changes etc from the information gleaned by the ASCII Checker program. Here's something to play with meanwhile. Updated files (24th February 2017) Virtual_INI_UDF.au3 NEW Example.au3 (23rd February 2017) All pretty basic, but managed to load my 4 Mb INI file (seemingly ok, but took a few seconds) ... though I have only worked with much smaller testing ones so far. P.S. While I have done a fair amount of testing, it has been pretty basic, and mostly limited to the examples provided. Testing has definitely not been extensive.
-
-
Bitmap2AscII use Lucida Console font with a size set to 8, so Windows 8/8.1 users need to change their notepad font and size for get a correct display. Image Rescale slider is only available when saving as image. A click on the "PreviewEdit" open AscII string in Notepad. You can save as Text, Html or Image (add the extension you want) Each setting change is immediately applied. Downloads available in the download section Hope you like it !
-
Hi. I am trying whole day yesterday and today to make script work. Code shouldnt be a problem but I just dont understand how some characters work. I will try to explain. I have a bunch of chars that I picked up from http://fsymbols.com/emoji/ and if you paste them in facebook page they work fine. But if you paste more then 20 or 40 (I am not sure anymore) they will not show well. Same thing happens in a script. When I had less then 20 everything worked fine. Now when I put much more it wont work. For example if code is "ΓÿÇ" then I need to get " ☀" when it goes trough code and that worked fine. When I put much more in a script it just wouldnt work. Same happens on facebook page. I have just checked it shows first 40 and then it wont decode others. Same happens in script. I even changed a bit way it works and instead that code is inside script i have put it in a .txt file so it will just load a line i need trough scrip (to make it work somehow) but it just doesnt work. Can anyone solve this ghost inside a script? #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> $hGUI = GUICreate("v3.00", 752, 418, -1, -1) ;GUICtrlSetStyle(-1, ) GUICtrlSetFont(-1, 8.5, 400, 0, "MS Shell Dlg", 5) $oIE = ObjCreate("Shell.Explorer.2") ;GUICtrlSetStyle(-1, ) $hPic = GUICtrlCreatePic("", 13, 33, 16, 16) GUICtrlSetImage(-1, "E:\0\autoit\2014-03-31 Facebook Spec Chars\img\01.bmp") $hPic2 = GUICtrlCreatePic("", 13, 51, 16, 16) GUICtrlSetImage(-1, "E:\0\autoit\2014-03-31 Facebook Spec Chars\img\02.bmp") $hButton = GUICtrlCreateButton("#", 37, 33, 16, 16) $hButton2 = GUICtrlCreateButton("#", 37, 51, 16, 16) $hButton3 = GUICtrlCreateButton("#", 37, 69, 16, 16) $hButton4 = GUICtrlCreateButton("#", 37, 87, 16, 16) $hButton5 = GUICtrlCreateButton("#", 37, 105, 16, 16) $hButton6 = GUICtrlCreateButton("#", 37, 123, 16, 16) $hButton7 = GUICtrlCreateButton("#", 37, 141, 16, 16) GUISetState() While 1 $hMsg = GUIGetMsg() Switch $hMsg Case $GUI_EVENT_CLOSE Exit EndSwitch Select Case $hMsg = $hButton ClipPut("ðŸ") ; those are chars that needs to be inserted in a facebook Case $hMsg = $hButton2 ClipPut("â˜") ; here also Case $hMsg = $hButton3 ClipPut("☔") Case $hMsg = $hButton4 ClipPut("⛄") Case $hMsg = $hButton5 ClipPut("âš¡") Case $hMsg = $hButton7 ClipPut("") EndSelect WEnd At the end I need to get "
- 2 replies
-
- characters
-
(and 2 more)
Tagged with:
-
I do not like Charmap, it's too small and you can't test a character with another font, you only get all chars for each font so it's not very handy. SpecialCharactersViewer permit with the Segoe UI Symbol font to display a maximum ( not all! ) of Ascii and Unicode characters. Simple click on a char and the corresponding Chr or ChrW code is displayed. Free to you to choose another font for see if the selected character can be used with. Windows XP do not have Segoe UI Symbol font, so it's more for Win7/Win8 users... Previous downloads : 100 Source : SpecialCharactersViewer v1.0.1.0.au3 Executable : SpecialCharactersViewer.exe.html (Once this html file downloaded, double click on it for start the download) Will be added to the next version of SciTE Hopper. Hope it can help !
- 16 replies
-
- Special
- Characters
-
(and 3 more)
Tagged with:
-
I'm using InetRead to access a machine's ID on the amazon ec2 service. to access the string containing the machine's ID I'm using the line: $instanceID = InetRead("http://169.254.169.254/latest/meta-data/instance-id",4) ConsoleWrite($instanceID) ConsoleWrite(@CRLF) $instanceID = StringLeft($instanceID,10) ; use the first ten characters ConsoleWrite($instanceID) ConsoleWrite(@CRLF) I think the "4" option in the InetRead function call should force ASCII format, but it must be struggling. The first ConsoleWrite returns: i-aa0fa69e (which is the properly formatted machine ID) and the second ConsoleWrite returns: 0x692D6161 which appears to be the hex equivalent of the original string. Does any body know how I can force the $instanceID variable to be an ASCII string? This one is really confusing me
-
Peers: (binary model), the peers value may be a string consisting of multiples of 6 bytes. First 4 bytes are the IP address and last 2 bytes are the port number. All in network (big endian) notation. The list of peers is length 50 by default. How can I convert the attached? http://en.wikipedia.org/wiki/Endianness#Big-endian I've tried BinaryToString with no luck. Thanks in advance. Peers.txt
-
I would like to programmatically check to see if a given tracker has information on the torrent I specify. This requires that the SHA-1 Info Hash of a torrent be encoded to make valid requests. I read from: http://nakkaya.com/2009/12/03/bittorrent-tracker-protocol/ If you don't pay attention to the spec and send this directly to tracker you will get an error this should be in URL Encoded form. Padding every two chars with % sign also doesn't work, been there done that don't waste your time. Any hex in the hash that corresponds to a unreserved character should be replaced, a-z A-Z 0-9 -_.~ Partition the hex in to chunks of two and check if the hex corresponds to any of these values, if they do replace them with the unreserved char. So that a hash such as, 123456789abcdef123456789abcdef123456789a becomes, %124Vx%9a%bc%de%f1%23Eg%89%ab%cd%ef%124Vx%9a notice that hex 34 became 4 which is what it is in ASCII. You can test the correctness of your hashes using the tracker url but don't request from announce request from file, http://some.tracker.com/file?info_hash=hash If you get a torrent back that means you have the correct hash. I have tried the above and failed. Here's my code: $testStr = "123456789abcdef123456789abcdef123456789a" ConsoleWrite(_EncodeHash($testStr) & @CRLF) Func _EncodeHash($sString) If (Not IsString($sString)) Or $sString = "" Then Return SetError(1, 0, 0) Local $aArray = StringRegExp($sString, "(?s).{1," & 2 & "}", 3), $sEncodedHash For $i = 0 To UBound($aArray) -1 If StringInStr($sString, Chr(Dec($aArray[$i]))) Then $sEncodedHash &= Chr(Dec($aArray[$i])) Else $sEncodedHash &= "%" & $aArray[$i] EndIf Next Return $sEncodedHash EndFuncIf you follow the first link in my post there is an example but I'm unfamiliar with the language being used. Thanks for any help.