Jump to content
Sign in to follow this  
TrickyDeath

String, interger and binary stuff question

Recommended Posts

TrickyDeath

Hello everyone,

Again here with my new question.

I do have a value what is "text" string, what i read from memory adress, but i do not understand when i convert it, why i geting only the first 4 letter from the word...

I was reading how does it storeing in memory, but i am not 100% sure, i did understand right. :(

Anyone can explain how does it work? Or why i get only the first 4 letter only?

Ps.:

Useing Nomadmemory.

BinaryToString($MemRead, 1), 0, 0

The valuse is correct, if i do not convert it at all, but the valuse includeing only numbers. I tried different convert way, but nothing.


Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :)

[u]Tricky[/u]

You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei)

Share this post


Link to post
Share on other sites
Geir1983

If you are reading from a memory address you probably also have to specify the amount of bytes to read?

Share this post


Link to post
Share on other sites
TrickyDeath

I wana read commands and those commands can be short how short i want, but i do not wana use 4 letter length strings for command. My problem is this memory storeing thing is new for me, so i am on just about the begning.

I made a GUI with 1 edit and 3 different button on it. Each button storeing the text from Edit in the same value.

I did used Cheat Engine to find the adress for it, and in that program it showeing me the full lengh of the string, but with AutoIT i see only the first 4 letter somehow, and i could not find out why. BTW the GUI is just for test, cause i can try make it work w/o NET connection. Once it will work, i can change the process. Unfortunately skype and viber do not have any controll what i can read with autoIT to read the messages what i am geting or sending. :(

At least i did not found anything like that.

One sec i put the code here in new post, just let me find it.


Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :)

[u]Tricky[/u]

You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei)

Share this post


Link to post
Share on other sites
TrickyDeath

#include <NomadMemory.au3>
#include <Array.au3>
#include <String.au3>

#Region Communication List
Global $System[8][2], $Answares[6]
Global $MemRead, $Value, $OrderRegister, $OrderList
;Order List
$System[0][0] = "Shotdown PC" ;Shotdown PC
$System[1][0] = "Open emails"
$System[2][0] = "Undeclared"
$System[3][0] = "Undeclared"
$System[4][0] = "Undeclared"
$System[5][0] = "Undeclared"
$System[6][0] = "Undeclared"
$System[7][0] = "?"

;Function List
$System[0][1] = "ShotDown_PC"
$System[1][1] = "Open_Emails"
$System[2][1] = "Undeclared"
$System[3][1] = "Undeclared"
$System[4][1] = "Undeclared"
$System[5][1] = "Undeclared"
$System[6][1] = "Undeclared"
$System[7][1] = "Help"

;Answare List
$Answares[0] = "Login Failed"
$Answares[1] = "Incorrect Username and / or Password!"
$Answares[2] = "Acces Denide!"
$Answares[3] = "Acces Granted! Wellcome!"
$Answares[4] = "Undeclared"
$Answares[5] = "Undeclared"

$OrderList = $System[0][0] & @CRLF & $System[1][0] & @CRLF & $System[2][0] & @CRLF & $System[3][0] & @CRLF & $System[4][0] & @CRLF & $System[5][0] & @CRLF & $System[6][0] & @CRLF & $System[7][0]
#EndRegion Communication List

_Main()

While 1
    Sleep(100)
WEnd

Func _Main()
    if ProcessExists("Memtest.exe") = 0 Then
        Run("Memtest.exe", "G:\_Instal\4GL\AutoIT\Scripts\Windows\")
    EndIf
    MemoryOpen()
EndFunc   ;==>_Main

#Region - Work together !!!
Func MemoryOpen() ;Work properly !!!
    ;Reading the value from the Process searched Memory Adress

    While 1
        $Process = _MemoryOpen(ProcessExists("Memtest.exe"))
        ;$Process = _MemoryOpen(ProcessExists("Memtest.exe"))
        If Not @error Then
            $MemRead = _MemoryRead("0x" & "0095CD48", $Process)
            ;$MemRead = _MemoryRead("0x" & "0095A578", $Process)
            ToolTip(BinaryToString($MemRead, 1), 0, 0)
            If $OrderRegister <> $MemRead Then
                $OrderRegister = $MemRead
                _Arguments()
            EndIf
            _MemoryClose($Process)
        EndIf
        Sleep(100)
    WEnd
EndFunc   ;==>MemoryOpen

Func _Arguments()
    For $i = 0 To UBound($System) - 1
        If $MemRead = $System[$i][0] Then
            Call($System[$i][1])
        EndIf
    Next
EndFunc   ;==>_Arguments
#EndRegion - Work together !!!

The argument functions include only 1 messagebox message to see it work or not.

Do u need the memtest.exe code as well? also made with autoIT.

nvm, i post that as well.

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Memtest", 140, 170)
$Input1 = GUICtrlCreateInput("", 10, 10, 120, 21)
$btn = GUICtrlCreateButton("Number", 10, 40, 120)
$btn2 = GUICtrlCreateButton("String", 10, 70, 120)
$btn3 = GUICtrlCreateButton("Binary", 10, 100, 120)
$btn4 = GUICtrlCreateButton("Normal", 10, 130, 120)
GUISetState(@SW_SHOW)

Local $Text

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $btn
            $Text = Number(GUICtrlRead($Input1))
        Case $btn2
            $Text = String(GUICtrlRead($Input1))
        Case $btn3
            $Text = Binary(GUICtrlRead($Input1))
        Case $btn4
            $Text = GUICtrlRead($Input1)
    EndSwitch
WEnd

If have any other question let me know.


Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :)

[u]Tricky[/u]

You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei)

Share this post


Link to post
Share on other sites
Geir1983

you need to specify the length to read, default is a dword (4 bytes).

$MemRead = _MemoryRead("0x" & "0095CD48", $Process, "char[80]")
Edited by Geir1983

Share this post


Link to post
Share on other sites
TrickyDeath

I would be happy if we have a nice help file for that nomadmemory, but since that is just a home made function... the description not telling you everything. I like AutoIT help file, you can learn so much thing, without comming to forum all the time with any single simple question.

What does "char[80]" mean exactly?


Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :)

[u]Tricky[/u]

You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei)

Share this post


Link to post
Share on other sites
Geir1983

like you said, nomad.au3 is not part of the autoit package.. but it does have documentation for each of the functions inside the source code.

char[80] means it will read 80 characters (letters numbers etc), I did not test it but think it should work?

Share this post


Link to post
Share on other sites
TrickyDeath

I will chek it, just have to turn on my notebook, cause i am working on that at work, when i do have too much free time and nothing to do. :D

Actualy i start codeing on my mobile phone, then the boss will not realy notice what i do. :D

When the code is done and i go home, i jsut send it to my PC, so i can test it and see it is work or not.


Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :)

[u]Tricky[/u]

You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei)

Share this post


Link to post
Share on other sites
TrickyDeath

Ok i did test your example, and work perfect. Thank you for your help. Now i can continue to work on rest of the code to make the whole communication between PC and my phone. :-)


Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :)

[u]Tricky[/u]

You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei)

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

    • nooneclose
      By nooneclose
      I need help turning this string "20180913221626" into a formatted time string.
      I need to go from this: 20180913221626
      to this: 09/13/2018 10:16 PM
      I do not always know what the date will be so I can not just use a variable I need to actually convert/format. 
      I did see an older post in the forms that was basically the same question only the other guy did not post the working code and I can not figure out how to use _AD_GetObjectProperties properly to get what I want. 
      As always any help would be appreciated. 
      Here is the code I use to find the date, but it always gives me the unformatted version. 
      ;retrieve the items object $oItem = $oOutlook.Session.GetItemFromID($aItems[1][0], Default) $oItem.GetInspector $eSentOn = $oItem.SentOn ; When was the email sent? MsgBox("", "Sent On of the email", $eSentOn) ;******************************************************************************* ; Formats the date and time from the email ;******************************************************************************* ;Local $fDatenTime = _DateTimeFormat($eSentOn, 1) ;MsgBox("", "Formatted email time", $fDatenTime) $aProperties = _AD_GetObjectProperties($eSentOn) _ArrayDisplay($aProperties, "Did the conversion work?")  
    • Miliardsto
      By Miliardsto
      I got that func
      Func makeHelpImgGUI($title,$width,$height,$img) $img = GUICtrlCreatePic("",20,40,$width,$height) _ResourceSetImageToCtrl($img, "HERE") EndFunc and I call this func like that
      makeHelpImgGUI("Image",1190, 800,$SETTINGS_JPG)  
      so what is the problem in the parameter where is - "HERE" I need value of img but passed as string
      so $img = $SETTINGS_JPG and how make it "SETTINGS_JPG"
       
      I tried something like that but not work
      Func makeHelpImgGUI($title,$width,$height,$img) $name_str = String($img) $name_str = StringTrimLeft ($name_str, 1 ) $img = GUICtrlCreatePic("",20,40,$width,$height) _ResourceSetImageToCtrl($img, $name_str) EndFunc  
    • liagason
      By liagason
      Hello everyone,
      How can I display in ascending  sequence some numbers stored in a string variable?
      $str = "18,03,48,23" MsgBox(0,"test",$str) I would like it to display "03,18,23,48"
    • Rskm
      By Rskm
      Hi, I have the following line in a text file 'input.txt'. I know the line number - say '6'. I wish to replace the text 'WWW' in the below line with a random number (I can generate that with random()).
      WERIS  WWWJP   3.83  8.330  1.000                1097.RAXX 
      The WWW is a 3 digit integer (could be any number between 0 to 999), I can use stringtrimleft and get the numerical value of WWW in this file
      so, basically, I know the string to replace (ie; WWW stored in a variable), I know the line number to work on and the file location/name and the replacement variable (through random()). My requirement is to fill that 3 spaces with my random number (which Is a integer between 1 and 999)
      please put ur suggestions
       
    • nacerbaaziz
      By nacerbaaziz
      Hello Members of this best Forum
      i have a question please
      for example if i have a long string
      and i want to extract a text between two tag
      what i can do to make that?
      note :
      i know that there is a
      StringRegExp function
      it's do that work
      but it result is be as an array
      i want the result to be a string
      is there any function on autoit can do that?
      Thanks in advance.
×