|
You last visited: Today at 04:40
Advertisement
Autoit script HELP
Discussion on Autoit script HELP within the PW Hacks, Bots, Cheats, Exploits forum part of the Perfect World category.
02/19/2016, 14:27
|
#1
|
elite*gold: 0
Join Date: Aug 2013
Posts: 17
Received Thanks: 1
|
Autoit script HELP
hi, i just made a Autoit Script, its not working properly, can anyone pls help me, this is my first time to make an autoit script, my goal is,
after i log-in my toon, it should auto sign-in my daily attendance if i click my autoit script, but its not doing it right, kindly correct me pls.
here is my script:
HotKeySet ("{F1}", "myExit")
$x = WinActivate("Perfect World International: Eclipse")
while(1)
LC(1205,206)
LC(677,98)
Exit
WEnd
Func LC($x, $y)
MouseClick("left", $x, $y, 1, 1)
EndFunc
Func myExit()
MsgBox(0,"Exiting", "Bot is Quitting")
Exit
EndFunc
|
|
|
02/19/2016, 20:42
|
#2
|
elite*gold: 0
Join Date: Jul 2011
Posts: 145
Received Thanks: 97
|
It looks like it will do 2 clicks and then exit the script. How far does it get?
|
|
|
02/20/2016, 01:22
|
#3
|
elite*gold: 0
Join Date: Aug 2013
Posts: 17
Received Thanks: 1
|
yeah, it must first click the calendar then click the sign in attendance, but nothing happens when I start it, is there any problem in my script? thank you
|
|
|
02/20/2016, 04:07
|
#4
|
elite*gold: 0
Join Date: Dec 2009
Posts: 70
Received Thanks: 15
|
You probably miss some sleep times between your Leftclicks. Another thing would be to use WinWait("Perfect World International: Eclipse") after WinActivate. That way you're waiting till the window is actually activated.
If you want to use the method of sending packages then i put a test code together which does your DailySign here:
#include <NomadMemory.au3>
HotKeySet("{DELETE}", "_exit")
HotKeySet("{F1}", "SignIn")
func SignIn()
$pid = ProcessExists('elementclient.exe')
_DailySign($pid)
EndFunc
Func _DailySign($pid)
$packet = '9C00'
sendPacket($packet, 2, $pid)
EndFunc ;==>_DailySign
Func _Exit()
Exit
EndFunc ;==>_Exit
While 1
Sleep(10)
WEnd
Func _FloatToHex($floatval)
$sF = DllStructCreate("float")
$sB = DllStructCreate("ptr", DllStructGetPtr($sF))
If $floatval = "" Then Exit
DllStructSetData($sF, 1, $floatval)
$return = DllStructGetData($sB, 1)
Return $return
EndFunc ;==>_FloatToHex
Func _Hex($VALUE, $SIZE = 8, $TYPE = "int")
Local $tmp1, $tmp2, $i
If ($TYPE = "int") Then
$tmp1 = StringRight("000000000" & Hex($VALUE), $SIZE)
ElseIf ($TYPE = "float") Then
$tmp1 = StringRight("000000000" & _FloatToHex($VALUE), $SIZE)
EndIf
For $i = 0 To StringLen($tmp1) / 2 - 1
$tmp2 = $tmp2 & StringMid($tmp1, StringLen($tmp1) - 1 - 2 * $i, 2)
Next
Return $tmp2
EndFunc ;==>_Hex
Func memopen($pid)
;~ MsgBox("","in memopen","")
$kernel32 = DllOpen('kernel32.dll')
Local $mid = DllCall($kernel32, 'int', 'OpenProcess', 'int', 0x1F0FFF, 'int', 1, 'int', $pid)
Return $mid[0]
EndFunc ;==>memopen
Func memclose($mid)
$kernel32 = DllOpen('kernel32.dll')
DllCall($kernel32, 'int', 'CloseHandle', 'int', $mid)
EndFunc ;==>memclose
Func sendPacket($packet, $packetSize, $pid)
;//Declare local variables
Dim $pRemoteThread, $vBuffer, $loop, $result, $OPcode, $processHandle, $packetAddress
;//Open process for given processId
$kernel32 = DllOpen('kernel32.dll')
$processHandle = memopen($pid)
;//Allocate memory for the OpCode and retrieve address for this
$functionAddress = DllCall($kernel32, 'int', 'VirtualAllocEx', 'int', $processHandle, 'ptr', 0, 'int', 0x46, 'int', 0x1000, 'int', 0x40)
;//Allocate memory for the packet to be sent and retrieve the address for this
$packetAddress = DllCall($kernel32, 'int', 'VirtualAllocEx', 'int', $processHandle, 'ptr', 0, 'int', $packetSize, 'int', 0x1000, 'int', 0x40)
$ADDRESS_SENDPACKET = 0x7B8970
$ADDRESS_BASE = 0xDA433C
;//Construct the OpCode for calling the 'SendPacket' function
$OPcode &= '60' ;//PUSHAD
$OPcode &= 'B8' & _Hex($ADDRESS_SENDPACKET) ;//MOV EAX, sendPacketAddress
$OPcode &= '8B0D' & _Hex($ADDRESS_BASE) ;//MOV ECX, DWORD PTR [revBaseAddress]
$OPcode &= '8B4920' ;//MOV ECX, DWORD PTR [ECX+20]
$OPcode &= 'BF' & _Hex($packetAddress[0]) ;//MOV EDI, packetAddress //src pointer
$OPcode &= '6A' & _Hex($packetSize, 2) ;//PUSH packetSize //size
$OPcode &= '57' ;//PUSH EDI
$OPcode &= 'FFD0' ;//CALL EAX
$OPcode &= '61' ;//POPAD
$OPcode &= 'C3' ;//RET
;//Put the OpCode into a struct for later memory writing
$vBuffer = DllStructCreate('byte[' & StringLen($OPcode) / 2 & ']')
For $loop = 1 To DllStructGetSize($vBuffer)
DllStructSetData($vBuffer, 1, Dec(StringMid($OPcode, ($loop - 1) * 2 + 1, 2)), $loop)
Next
;//Write the OpCode to previously allocated memory
DllCall($kernel32, 'int', 'WriteProcessMemory', 'int', $processHandle, 'int', $functionAddress[0], 'int', DllStructGetPtr($vBuffer), 'int', DllStructGetSize($vBuffer), 'int', 0)
;//Put the packet into a struct for later memory writing
$vBuffer = DllStructCreate('byte[' & StringLen($packet) / 2 & ']')
For $loop = 1 To DllStructGetSize($vBuffer)
DllStructSetData($vBuffer, 1, Dec(StringMid($packet, ($loop - 1) * 2 + 1, 2)), $loop)
Next
;//Write the packet to previously allocated memory
DllCall($kernel32, 'int', 'WriteProcessMemory', 'int', $processHandle, 'int', $packetAddress[0], 'int', DllStructGetPtr($vBuffer), 'int', DllStructGetSize($vBuffer), 'int', 0)
;//Create a remote thread in order to run the OpCode
$hRemoteThread = DllCall($kernel32, 'int', 'CreateRemoteThread', 'int', $processHandle, 'int', 0, 'int', 0, 'int', $functionAddress[0], 'ptr', 0, 'int', 0, 'int', 0)
;//Wait for the remote thread to finish
Do
$result = DllCall('kernel32.dll', 'int', 'WaitForSingleObject', 'int', $hRemoteThread[0], 'int', 50)
Until $result[0] <> 258
;//Close the handle to the previously created remote thread
DllCall($kernel32, 'int', 'CloseHandle', 'int', $hRemoteThread[0])
;//Free the previously allocated memory
DllCall($kernel32, 'ptr', 'VirtualFreeEx', 'hwnd', $processHandle, 'int', $functionAddress[0], 'int', 0, 'int', 0x8000)
DllCall($kernel32, 'ptr', 'VirtualFreeEx', 'hwnd', $processHandle, 'int', $packetAddress[0], 'int', 0, 'int', 0x8000)
;//Close the Process
memclose($processHandle)
Return True
EndFunc ;==>sendPacket
With this you can do your Sign in via F1 and close the program again with the delete key
A completely different way would be to use ImageSearch to find the buttons, that way it would work basically always.
|
|
|
02/25/2016, 07:37
|
#5
|
elite*gold: 0
Join Date: Aug 2013
Posts: 17
Received Thanks: 1
|
Quote:
Originally Posted by sasukezero
You probably miss some sleep times between your Leftclicks. Another thing would be to use WinWait("Perfect World International: Eclipse") after WinActivate. That way you're waiting till the window is actually activated.
If you want to use the method of sending packages then i put a test code together which does your DailySign here:
#include <NomadMemory.au3>
HotKeySet("{DELETE}", "_exit")
HotKeySet("{F1}", "SignIn")
func SignIn()
$pid = ProcessExists('elementclient.exe')
_DailySign($pid)
EndFunc
Func _DailySign($pid)
$packet = '9C00'
sendPacket($packet, 2, $pid)
EndFunc ;==>_DailySign
Func _Exit()
Exit
EndFunc ;==>_Exit
While 1
Sleep(10)
WEnd
Func _FloatToHex($floatval)
$sF = DllStructCreate("float")
$sB = DllStructCreate("ptr", DllStructGetPtr($sF))
If $floatval = "" Then Exit
DllStructSetData($sF, 1, $floatval)
$return = DllStructGetData($sB, 1)
Return $return
EndFunc ;==>_FloatToHex
Func _Hex($VALUE, $SIZE = 8, $TYPE = "int")
Local $tmp1, $tmp2, $i
If ($TYPE = "int") Then
$tmp1 = StringRight("000000000" & Hex($VALUE), $SIZE)
ElseIf ($TYPE = "float") Then
$tmp1 = StringRight("000000000" & _FloatToHex($VALUE), $SIZE)
EndIf
For $i = 0 To StringLen($tmp1) / 2 - 1
$tmp2 = $tmp2 & StringMid($tmp1, StringLen($tmp1) - 1 - 2 * $i, 2)
Next
Return $tmp2
EndFunc ;==>_Hex
Func memopen($pid)
;~ MsgBox("","in memopen","")
$kernel32 = DllOpen('kernel32.dll')
Local $mid = DllCall($kernel32, 'int', 'OpenProcess', 'int', 0x1F0FFF, 'int', 1, 'int', $pid)
Return $mid[0]
EndFunc ;==>memopen
Func memclose($mid)
$kernel32 = DllOpen('kernel32.dll')
DllCall($kernel32, 'int', 'CloseHandle', 'int', $mid)
EndFunc ;==>memclose
Func sendPacket($packet, $packetSize, $pid)
;//Declare local variables
Dim $pRemoteThread, $vBuffer, $loop, $result, $OPcode, $processHandle, $packetAddress
;//Open process for given processId
$kernel32 = DllOpen('kernel32.dll')
$processHandle = memopen($pid)
;//Allocate memory for the OpCode and retrieve address for this
$functionAddress = DllCall($kernel32, 'int', 'VirtualAllocEx', 'int', $processHandle, 'ptr', 0, 'int', 0x46, 'int', 0x1000, 'int', 0x40)
;//Allocate memory for the packet to be sent and retrieve the address for this
$packetAddress = DllCall($kernel32, 'int', 'VirtualAllocEx', 'int', $processHandle, 'ptr', 0, 'int', $packetSize, 'int', 0x1000, 'int', 0x40)
$ADDRESS_SENDPACKET = 0x7B8970
$ADDRESS_BASE = 0xDA433C
;//Construct the OpCode for calling the 'SendPacket' function
$OPcode &= '60' ;//PUSHAD
$OPcode &= 'B8' & _Hex($ADDRESS_SENDPACKET) ;//MOV EAX, sendPacketAddress
$OPcode &= '8B0D' & _Hex($ADDRESS_BASE) ;//MOV ECX, DWORD PTR [revBaseAddress]
$OPcode &= '8B4920' ;//MOV ECX, DWORD PTR [ECX+20]
$OPcode &= 'BF' & _Hex($packetAddress[0]) ;//MOV EDI, packetAddress //src pointer
$OPcode &= '6A' & _Hex($packetSize, 2) ;//PUSH packetSize //size
$OPcode &= '57' ;//PUSH EDI
$OPcode &= 'FFD0' ;//CALL EAX
$OPcode &= '61' ;//POPAD
$OPcode &= 'C3' ;//RET
;//Put the OpCode into a struct for later memory writing
$vBuffer = DllStructCreate('byte[' & StringLen($OPcode) / 2 & ']')
For $loop = 1 To DllStructGetSize($vBuffer)
DllStructSetData($vBuffer, 1, Dec(StringMid($OPcode, ($loop - 1) * 2 + 1, 2)), $loop)
Next
;//Write the OpCode to previously allocated memory
DllCall($kernel32, 'int', 'WriteProcessMemory', 'int', $processHandle, 'int', $functionAddress[0], 'int', DllStructGetPtr($vBuffer), 'int', DllStructGetSize($vBuffer), 'int', 0)
;//Put the packet into a struct for later memory writing
$vBuffer = DllStructCreate('byte[' & StringLen($packet) / 2 & ']')
For $loop = 1 To DllStructGetSize($vBuffer)
DllStructSetData($vBuffer, 1, Dec(StringMid($packet, ($loop - 1) * 2 + 1, 2)), $loop)
Next
;//Write the packet to previously allocated memory
DllCall($kernel32, 'int', 'WriteProcessMemory', 'int', $processHandle, 'int', $packetAddress[0], 'int', DllStructGetPtr($vBuffer), 'int', DllStructGetSize($vBuffer), 'int', 0)
;//Create a remote thread in order to run the OpCode
$hRemoteThread = DllCall($kernel32, 'int', 'CreateRemoteThread', 'int', $processHandle, 'int', 0, 'int', 0, 'int', $functionAddress[0], 'ptr', 0, 'int', 0, 'int', 0)
;//Wait for the remote thread to finish
Do
$result = DllCall('kernel32.dll', 'int', 'WaitForSingleObject', 'int', $hRemoteThread[0], 'int', 50)
Until $result[0] <> 258
;//Close the handle to the previously created remote thread
DllCall($kernel32, 'int', 'CloseHandle', 'int', $hRemoteThread[0])
;//Free the previously allocated memory
DllCall($kernel32, 'ptr', 'VirtualFreeEx', 'hwnd', $processHandle, 'int', $functionAddress[0], 'int', 0, 'int', 0x8000)
DllCall($kernel32, 'ptr', 'VirtualFreeEx', 'hwnd', $processHandle, 'int', $packetAddress[0], 'int', 0, 'int', 0x8000)
;//Close the Process
memclose($processHandle)
Return True
EndFunc ;==>sendPacket
With this you can do your Sign in via F1 and close the program again with the delete key
A completely different way would be to use ImageSearch to find the buttons, that way it would work basically always.
|
wow, I never though someone will help me this far, this is not a simple coding and it worked  thank you very much,  thank you so much
now I would like to add this on your code, but I don't know how since this coding is very complicated for me, I would like to add: when press "F3" it must double click Jolly Old Jones (257,689 city of the lost) then "quest related" then "daily bounty orders" then "not bad. and you?" then "i would be willing to help if you share the rewards with me" then "that's what I like to hear! we have a deal" then "sounds good" to auto daily get may jolly old jones reward. of course I am beside the NPC jolly old jones b4 I press "F3". thank you, I hope you can help me with this. thank you very much. I love your work. tytyty  
|
|
|
02/25/2016, 18:30
|
#6
|
elite*gold: 0
Join Date: Dec 2009
Posts: 70
Received Thanks: 15
|
Never checked Jones but its just another interaction with a NPC. The DailySign i made was just a kickstart, the rest for whatever you'd like to do is on you. For informations you can check the Forum, also a lot is found here 
Other than that others including me are glad to help when you encounter a Problem after trying it first on your own
|
|
|
02/26/2016, 11:02
|
#7
|
elite*gold: 0
Join Date: Aug 2013
Posts: 17
Received Thanks: 1
|
ok, i will do it, i will post my first project here  thank you very much for your help
|
|
|
All times are GMT +1. The time now is 04:42.
|
|