Register for your free account! | Forgot your password?

Go Back   elitepvpers › Coders Den › AutoIt
You last visited: Today at 02:06

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



GUI-Input als Variable.

Discussion on GUI-Input als Variable. within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 329
Join Date: Jan 2010
Posts: 6,047
Received Thanks: 1,741
GUI-Input als Variable.

Hey,
ich habe mit KODA eine Inputbox erstellt, möchte nun aber dass ich das was ich in die Inputbox eintrage dann per 'OK'-Knopfdruck im schon vorher geöffnetem Notepad geschrieben wird.[Habe schon bei Google gesucht, aber irgendwie nur Sachen gefunden die ich nicht verstehen ;O]

PHP Code:
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form3 = GUICreate("Test", 116, 82, 303, 219)
$Button1 = GUICtrlCreateButton("&OK", 8, 48, 99, 25)
GUICtrlCreateInput("", 16, 16, 81, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
= GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit

    EndSwitch
WEnd 
No Hawx is offline  
Old   #2
 
Imaginär's Avatar
 
elite*gold: 255
Join Date: Nov 2009
Posts: 2,900
Received Thanks: 1,408
PHP Code:
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form3 = GUICreate("Test", 116, 82, 303, 219)
$Button1 = GUICtrlCreateButton("&OK", 8, 48, 99, 25)
$Input1 = GUICtrlCreateInput("", 16, 16, 81, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
= GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
                Case 
$Button1
                   $auslesen 
= GuiCtrlRead($Input1)
                   
run("notepad.exe")
                   
send($auslesen)

    EndSwitch
WEnd 
mfg

//Edit: Wenn das Fenster schon aktiv ist kannst du es so machen:

PHP Code:
                Case $Button1
                   $auslesen 
= GuiCtrlRead($Input1)
                   
WinActivate("Unbenannt - Editor") ;da passt du deinen Fenstertitel an..
                   
send($auslesen) 
Imaginär is offline  
Thanks
2 Users
Old   #3
 
elite*gold: 329
Join Date: Jan 2010
Posts: 6,047
Received Thanks: 1,741
Oh, dankeschön
No Hawx is offline  
Old   #4
 
Imaginär's Avatar
 
elite*gold: 255
Join Date: Nov 2009
Posts: 2,900
Received Thanks: 1,408
Quote:
Originally Posted by KekzCracker View Post
Oh, dankeschön
Habe auch noch dazugeschrieben, wie man es machen kann, wenn das Fenster schon existiert.

Dafür muss man das Programm nicht nocheinmal starten, sondern lässt das Fenster mit

PHP Code:
WinActivate("Fenstertitel") 
einfach öffnen!
Imaginär is offline  
Thanks
1 User
Old   #5
 
elite*gold: 329
Join Date: Jan 2010
Posts: 6,047
Received Thanks: 1,741
Ah ok ^^
Ich bastel gerade an einem Solitärhack rum, aber irgendwie funtioniert es nicht ~.~
No Hawx is offline  
Old   #6
 
Imaginär's Avatar
 
elite*gold: 255
Join Date: Nov 2009
Posts: 2,900
Received Thanks: 1,408
Quote:
Originally Posted by KekzCracker View Post
Ah ok ^^
Ich bastel gerade an einem Solitärhack rum, aber irgendwie funtioniert es nicht ~.~
Was funktioniert denn genau nicht?

Kommst du mit allem klar(Cheat Engine;Adressen in AutoIt verabreiten)?^^
Imaginär is offline  
Old   #7
 
elite*gold: 329
Join Date: Jan 2010
Posts: 6,047
Received Thanks: 1,741
Naja, also das hier ist mein Code:
[Sorry, aber irgendwie hat der 'NoMadMemory.au3' nicht gefunden, auch nicht als ich es runtergeladen habe. Jetzt habe ich von 'NoMadMemory.au3' den Code rein!]
PHP Code:
;;;;;;;;;;; NoMadMemory.au3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#include-once
#region _Memory

Func _MemoryOpen($iv_Pid, $iv_DesiredAccess = 0x1F0FFF, $iv_InheritHandle = 1)
    
    If 
Not ProcessExists($iv_Pid) Then
        SetError
(1)
        Return 
0
    
EndIf
    
    
Local $ah_Handle[2] = [DllOpen('kernel32.dll')]
    
    If @
Error Then
        SetError
(2)
        Return 
0
    
EndIf
    
    
Local $av_OpenProcess = DllCall($ah_Handle[0], 'int', 'OpenProcess', 'int', $iv_DesiredAccess, 'int', $iv_InheritHandle, 'int', $iv_Pid)
    
    If @
Error Then
        DllClose
($ah_Handle[0])
        
SetError(3)
        Return 
0
    
EndIf
    
    
$ah_Handle[1] = $av_OpenProcess[0]
    
    Return 
$ah_Handle
    
EndFunc

Func _MemoryRead
($iv_Address, $ah_Handle, $sv_Type = 'dword')
    
    If 
Not IsArray($ah_Handle) Then
        SetError
(1)
        Return 
0
    
EndIf
    
    
Local $v_Buffer = DllStructCreate($sv_Type)
    
    If @
Error Then
        SetError
(@Error + 1)
        Return 
0
    
EndIf
    
    
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
    
    If 
Not @Error Then
        Local $v_Value 
= DllStructGetData($v_Buffer, 1)
        Return 
$v_Value
    
Else
        
SetError(6)
        Return 
0
    
EndIf
    
EndFunc

Func _MemoryWrite
($iv_Address, $ah_Handle, $v_Data, $sv_Type = 'dword')
    
    If 
Not IsArray($ah_Handle) Then
        SetError
(1)
        Return 
0
    
EndIf
    
    
Local $v_Buffer = DllStructCreate($sv_Type)
    
    If @
Error Then
        SetError
(@Error + 1)
        Return 
0
    
Else
        
DllStructSetData($v_Buffer, 1, $v_Data)
        If @
Error Then
            SetError
(6)
            Return 
0
        
EndIf
    EndIf
    
    
DllCall($ah_Handle[0], 'int', 'WriteProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
    
    If 
Not @Error Then
        
Return 1
    
Else
        
SetError(7)
        Return 
0
    
EndIf
    
EndFunc

Func _MemoryClose
($ah_Handle)
    
    If 
Not IsArray($ah_Handle) Then
        SetError
(1)
        Return 
0
    
EndIf
    
    
DllCall($ah_Handle[0], 'int', 'CloseHandle', 'int', $ah_Handle[1])
    If 
Not @Error Then
        DllClose
($ah_Handle[0])
        Return 
1
    
Else
        
DllClose($ah_Handle[0])
        
SetError(2)
        Return 
0
    
EndIf
    
EndFunc

Func SetPrivilege
( $privilege, $bEnable )
    
    Const 
$TOKEN_ADJUST_PRIVILEGES = 0x0020
    
Const $TOKEN_QUERY = 0x0008
    
Const $SE_PRIVILEGE_ENABLED = 0x0002
    Local $hToken
, $SP_auxret, $SP_ret, $hCurrProcess, $nTokens, $nTokenIndex, $priv
    $nTokens 
= 1
    $LUID 
= DLLStructCreate("dword;int")
    If 
IsArray($privilege) Then    $nTokens = UBound($privilege)
    
$TOKEN_PRIVILEGES = DLLStructCreate("dword;dword[" & (3 * $nTokens) & "]")
    
$NEWTOKEN_PRIVILEGES = DLLStructCreate("dword;dword[" & (3 * $nTokens) & "]")
    
$hCurrProcess = DLLCall("kernel32.dll","hwnd","GetCurrentProcess")
    
$SP_auxret = DLLCall("advapi32.dll","int","OpenProcessToken","hwnd",$hCurrProcess[0],   _
            
"int",BitOR($TOKEN_ADJUST_PRIVILEGES,$TOKEN_QUERY),"int_ptr",0)
    If 
$SP_auxret[0] Then
        $hToken 
= $SP_auxret[3]
        
DLLStructSetData($TOKEN_PRIVILEGES,1,1)
        
$nTokenIndex = 1
        
While $nTokenIndex <= $nTokens
            
If IsArray($privilege) Then
                $priv 
= $privilege[$nTokenIndex-1]
            Else
                
$priv = $privilege
            
EndIf
            
$ret = DLLCall("advapi32.dll","int","LookupPrivilegeValue","str","","str",$priv,   _
                    
"ptr",DLLStructGetPtr($LUID))
            If 
$ret[0] Then
                
If $bEnable Then
                    DLLStructSetData
($TOKEN_PRIVILEGES,2,$SE_PRIVILEGE_ENABLED,(3 * $nTokenIndex))
                Else
                    
DLLStructSetData($TOKEN_PRIVILEGES,2,0,(3 * $nTokenIndex))
                EndIf
                
DLLStructSetData($TOKEN_PRIVILEGES,2,DllStructGetData($LUID,1),(3 * ($nTokenIndex-1)) + 1)
                
DLLStructSetData($TOKEN_PRIVILEGES,2,DllStructGetData($LUID,2),(3 * ($nTokenIndex-1)) + 2)
                
DLLStructSetData($LUID,1,0)
                
DLLStructSetData($LUID,2,0)
            EndIf
            
$nTokenIndex += 1
        WEnd
        $ret 
= DLLCall("advapi32.dll","int","AdjustTokenPrivileges","hwnd",$hToken,"int",0,   _
                
"ptr",DllStructGetPtr($TOKEN_PRIVILEGES),"int",DllStructGetSize($NEWTOKEN_PRIVILEGES),   _
                
"ptr",DllStructGetPtr($NEWTOKEN_PRIVILEGES),"int_ptr",0)
        
$f = DLLCall("kernel32.dll","int","GetLastError")
    EndIf
    
$NEWTOKEN_PRIVILEGES=0
    $TOKEN_PRIVILEGES
=0
    $LUID
=0
    
If $SP_auxret[0] = 0 Then Return 0
    $SP_auxret 
= DLLCall("kernel32.dll","int","CloseHandle","hwnd",$hToken)
    If 
Not $ret[0] And Not $SP_auxret[0] Then Return 0
    
return $ret[0]
EndFunc   ;==>SetPrivilege

#endregion
;;;;;;;;;;;;;;;;;;;; END ~ NoMadMemory.au3 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,

;;;;;;;;;;;;;;;;;; 
KODA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 154, 78, 193, 125)
$Input1 = GUICtrlCreateInput("Input1", 16, 16, 121, 21)
$Button1 = GUICtrlCreateButton("Okay ^^", 32, 40, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

;;;;;;;;;;;;;; END ~ KODA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$ID = WinGetProcess("Solitär")
$process = _MemoryOpen($ID)

While 
1
    $nMsg 
= GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
         Case 
$Button1
                   $auslesen 
= GuiCtrlRead($Input1)
                   
_MemoryWrite(0x000A8FC0, $process, $Input1)
            Exit
    EndSwitch
WEnd

;;;;;;;;;;;;;;;;;;; HANDLE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$handle = WinGetHandle("Solitär", "")
If @
error Then
    MsgBox
(4096, "Fehler", "Das Solitär-Fenster konnte nicht gefunden werden")
Else
EndIf 
Problem ~ Immer wenn ich dann einen Wert in die Inputbox eingebe verändert sich die Punktezahl, aber nur auf 3. Wenn ich 600 eintrage kommt 3, wenn ich 10 eintrage kommt 3 usw.

Wahrscheinlich habe ich die Adresse falsch rausgesucht , werde es jetzt nochmal probieren.
No Hawx is offline  
Old   #8
 
omer36's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 2,317
Received Thanks: 1,255
es heißt "NomadMemory.au3" vllt liegts daran? ^^
omer36 is offline  
Old   #9
 
elite*gold: 0
Join Date: Nov 2009
Posts: 927
Received Thanks: 1,317
Wenn schon, dann liegt der Fehler da:

PHP Code:
 Case $Button1
                   $auslesen 
= GuiCtrlRead($Input1)
                   
_MemoryWrite(0x000A8FC0, $process, $Input1) 
denn entweder du machst es so:

PHP Code:
 Case $Button1
                   _MemoryWrite
(0x000A8FC0, $process, GUICtrlRead($Input1)) 
oder so:

PHP Code:
 Case $Button1
                   $auslesen 
= GuiCtrlRead($Input1)
                   
_MemoryWrite(0x000A8FC0, $process, $auslesen) 
huberhans is offline  
Thanks
2 Users
Reply


Similar Threads Similar Threads
Error Variable used .....
05/26/2010 - AutoIt - 3 Replies
Hi, #include <NomadMemory.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 625, 445, 193, 125)
Username in Variable
04/01/2010 - AutoIt - 2 Replies
Hallo, ich wollte ein kleines Programm für meine jüngere Cousine anfertigen, denn sie hat viel Spaß an solchen Programmen ;) Und zwar möchte ich zuerst eine InputBox erscheinen lassen, inder nach dem Namen gefragt wird. Danach soll sich eine MsgBox öffnen, wo steht: Herzlich Willkommen ... ( ... = der Name) So siehts im Moment aus. $input1 = InputBox("Hallo", "Hallöchen! Bevor es losgehen kann, &CRLF möchte ich gern wissen, wie du heißt.") MsgBox("Herzlich Willkommen", "Herzlich...
Variable und down/up befehl
09/23/2009 - AutoIt - 0 Replies
Hallo! Also ich habe folgendes Problem: Ich will meine variable ($taste1) und den "{down}" tastendruck ausführen aber wie krieg ich das hin also möchte das die variable taste1 runtergedrückt wird bis ich sie wieder mit "{up}" loslasse. Allerdings weis ich es bei up auch nicht Mein script sieht bisher so aus Send($taste1 "{down}") Thx schonmal in vorraus:confused::( ok habs jetzt nach langer zeit =) ich hab es einfach über eine if schleife gemacht Ok Funktioniert doch net hat keiner...
How do I add a variable
08/21/2009 - CO2 Private Server - 4 Replies
Couldn't find a guide when I searched. I want to make a variable so it will check how many times the player has already used unknown man. I know how to use the variable, but just don't know how to make it. Oh yea this is LOTF
Variable Mix + Max Values
08/24/2008 - Conquer Online 2 - 10 Replies
This is a reference for the minimum and maximum values for the Variables in C#. C# Type .Net Framework (System) type Signed? Bytes Occupied Possible Values sbyte System.Sbyte Yes 1 -128 to 127 short System.Int16 Yes 2 -32768 to 32767 int System.Int32 Yes 4 -2147483648 to 2147483647 long System.Int64 Yes 8 -9223372036854775808 to 9223372036854775807 byte System.Byte No 1 0 to 255 ushort System.Uint16 No 2 0 to 65535



All times are GMT +2. The time now is 02:06.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.