Jump to content

smashly

Active Members
  • Posts

    1,612
  • Joined

  • Last visited

Everything posted by smashly

  1. Thank you for taking the time to read my post and or any feedback provided. I found a function that hashes an input string. But even simple bit operations always have me lost even in AutoIt native code. Most parts of the algorithm function seem easy enough translate. But the starting bit #define has me lost in how to translate it. I gather the hashing function was used in asm (I'm sorta clueless as you can tell). Most cases I can translate what I need from MSDN for native win api functions to AutoIt. But I don't have an easy reference to compare or to translate the code below. #define ROR(val, shift) ((val << (0x20 - shift)) | (val >> shift)) #define ROL(val, shift) ((val >> (0x20 - shift)) | (val << shift)) #define INIT_VAL 0xABCDEFAB unsigned long hash32(char *str,unsigned long init) { unsigned long i, m, len, c; unsigned long k[3]; len = strlen(str); k[2] = k[1] = k[0] = init + len + 0xDEADBEEF; if ( len ) { if ( len > 12 ) { m = ((unsigned long long)(len - 13) * 0xAAAAAAAB >> 35) + 1; while ( m-- ) { for ( i = 0; i < 12; i++ ) { c = str[i]; if (c - 0x41 <= 0x19) c += 0x20; k[(11 - i) / 4] += c << ((i % 4) * 8); } k[2] = (k[2] - k[0]) ^ ROL(k[0], 4); k[0] += k[1]; k[1] = (k[1] - k[2]) ^ ROL(k[2], 6); k[2] += k[0]; k[0] = (k[0] - k[1]) ^ ROL(k[1], 8); k[1] += k[2]; k[2] = (k[2] - k[0]) ^ ROL(k[0], 16); k[0] += k[1]; k[1] = (k[1] - k[2]) ^ ROR(k[2], 13); k[2] += k[0]; k[0] = (k[0] - k[1]) ^ ROL(k[1], 4); k[1] += k[2]; str += 12; len -= 12; } } for ( ; len > 0; len-- ) { c = str[len - 1]; if (c - 0x41 <= 0x19) c += 0x20; k[(11 - (len - 1)) / 4] += c << (( (len - 1) % 4) * 8); } k[0] = (k[0] ^ k[1]) - ROL(k[1], 14); k[2] = (k[2] ^ k[0]) - ROL(k[0], 11); k[1] = (k[1] ^ k[2]) - ROR(k[2], 7); k[0] = (k[0] ^ k[1]) - ROL(k[1], 16); k[2] = (k[2] ^ k[0]) - ROL(k[0], 4); k[1] = (k[1] ^ k[2]) - ROL(k[2], 14); k[0] = (k[0] ^ k[1]) - ROR(k[1], 8); } return k[0]; }
  2. Hi, Thank You for taking the time to read my post. Could someone please post a brief example of using StringRegExpReplace() to replace a word at a specific count. For example I'm trying to replace only the 2nd instance of the word "Dog" with "Turtle" in the string below. $sStr = "CatDogMouseBirdHorseDogBirdHorseMouseBirdDogAnt"
  3. Hi,#include <GDIPlus.au3> #include <WinAPI.au3> Global $sSaveImage = @ScriptDir & "Colors.jpg" Global $iImageSize = 200, $iSquareSize = 10 Global $hBMP, $hImage, $hGraphic, $hBrush, $iX = 0, $iY = 0 _GDIPlus_Startup() $hBMP = _WinAPI_CreateBitmap($iImageSize, $iImageSize, 1, 32) $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) $hBrush = _GDIPlus_BrushCreateSolid() For $i = 1 To ($iImageSize * $iImageSize) Step $iSquareSize _GDIPlus_BrushSetSolidColor($hBrush, Random(0xFF000000, 0xFFFFFFFF, 1)) _GDIPlus_GraphicsFillRect($hGraphic, $iX, $iY, $iSquareSize, $iSquareSize, $hBrush) If $iX >= $iImageSize Then $iX = 0 $iY += $iSquareSize Else $iX += $iSquareSize EndIf Next _GDIPlus_ImageSaveToFile($hImage, $sSaveImage) _WinAPI_DeleteObject($hBMP) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() If FileExists($sSaveImage) Then ShellExecute($sSaveImage)
  4. Hi, #include <GUIConstantsEx.au3> $Form1 = GUICreate("Hung", 131, 273, 192, 114) $Label1 = GUICtrlCreateLabel("Combo Retarget Loot", 16, 16, 105, 17) $Button1 = GUICtrlCreateButton("ComRe", 16, 40, 99, 25) $Label2 = GUICtrlCreateLabel("Combo Loot", 32, 80, 61, 17) $Label3 = GUICtrlCreateLabel("Bm3 Retarget Loot", 16, 152, 93, 17) $Button2 = GUICtrlCreateButton("ComLo", 16, 112, 99, 25) $Button3 = GUICtrlCreateButton("Bm3Re", 16, 176, 99, 25) $Label4 = GUICtrlCreateLabel("Bm3 Loot", 40, 216, 49, 17) $Button4 = GUICtrlCreateButton("Bm3Lo", 16, 240, 99, 25) GUISetState(@SW_SHOW, $Form1) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($Button1) = "ComRe" Then AdlibRegister("ComRe", 500) GUICtrlSetData($Button1, "STOP") Else AdlibUnRegister("ComRe") GUICtrlSetData($Button1, "ComRe") EndIf EndSwitch WEnd Func ComRe() Send("5") Send("z") Send("0") EndFunc ;==>ComRe Cheers
  5. Hi, Quote from help file if using 64bit os eg:#include <GuiConstantsEx.au3> _Main() Func _Main() Local $sHKLM, $aValue, $sReturn $sHKLM = "HKLMSOFTWARESMUDO" If Not StringInStr(@OSArch, "X86") Then $sHKLM = StringReplace($sHKLM, "HKLM", "HKLM64") $aValue = StringSplit("AssetTag|ClientVersion|ServerVersion|Division|Hardware|Language", "|", 2) GUICreate("Support Information", 300, 350, (@DesktopWidth - 300) / 2, (@DesktopHeight - 350) / 2) For $i = 0 To UBound($aValue) - 1 $sReturn = RegRead($sHKLM, $aValue[$i]) If StringInStr($aValue[$i], "Language") Then $sReturn = StringLeft($sReturn, StringInStr($sReturn, Chr(32))) GUICtrlCreateLabel($aValue[$i] & ":" & @TAB & $sReturn, 10, ($i * 20) + 10, 280, 20) Next GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSwitch WEnd EndFunc ;==>_Main
  6. The game rules are bs even if they are simple and needed. My opinion is irrelevant and it's not my given right to be a member of the forums, it's a privilege which can be revoked at any time. Yeah I'm an "enthusiastically stupid user wishes to challenge the status quo", so revoke my privilege permanently please. As I can't beat it and I don't want to bow to it and I'm definitely not joining it. Farewell.
  7. Hi, I know it's not what you want to hear, but I think you'll have probs with members jumping on you due to it's game related. I'm aware its not to automate a game, but the rules have really got out of hand when it it comes to anything game related. What makes it worse is members snowball on the rules until the topic gets locked. It all turns into a baited flame fest, usually by the op being baited until he/she snaps then and then baiter is made out to be the one in the right due to the op topic was borderline to start with and the baiter has been here longer. If you can avoid mentioning a third party game in your topic, and make your code generic so it doesn't look like it's to do with a third party game you'll probably get away with help and answers without the whole above scenario happening. Good luck
  8. Hi, Thank you for sharing. You could make your scripts into 1 function. #RequireAdmin $iPreviousValue = _Toggle_UAC() If Not @error Then ConsoleWrite("-> _Toggle_UAC() @error: " & @error & @LF) ConsoleWrite("-> Previous UAC Value: " & $iPreviousValue & @LF) ConsoleWrite("-> Current UAC Value: " & _Toggle_UAC(-3) & @LF) Else ConsoleWrite("-> _Toggle_UAC() @error: " & @error & @LF) EndIf ; #FUNCTION# ==================================================================================================================== ; Name...........: _Toggle_UAC ; Description ...: Toggle or Force UAC Off or On or Query UAC current setting without changing. ; Syntax.........: _Toggle_UAC([$iValue = -2]) ; Parameters ....: $iValue - [Optional] Default is -2, see below for explanations and other values. ; -1 = Toggle the current UAC to the oposite of what it is currently. ; If UAC is curently disabled then It will be enabled using 1, ; Prompt the Consent Admin to enter his or her user name and password ; (or another valid admin) when an operation requires elevation of privilege. ; -2 = Toggle the current UAC to the oposite of what it is currently. ; If UAC is curently disabled then It will be enabled using 2, ; Admin Approval Mode to select either "Permit" or "Deny" an operation that requires elevation of privilege. ; -3 = Return the current UAC value found in the registry, don't change anything. ; 0 = Set UAC to 0 Allow the Consent Admin to perform an operation that requires elevation without consent or credentials. ; 1 = Set UAC to 1 Prompt the Consent Admin to enter his or her user name and password ; (or another valid admin) when an operation requires elevation of privilege. ; 2 = Set UAC to 2 Admin Approval Mode to select either "Permit" or "Deny" an operation that requires elevation of privilege. ; Return values .: Success - Value that was found in the registry before changinging and @error 0, Return could be as follows: ; 0 = UAC was disabled ; 1 = UAC was Prompt the Consent Admin to enter his or her user name and password ; 2 = UAC was Admin Approval Mode to select either "Permit" or "Deny" ; Failure - -1 and @error ; @error 1 = Current user is not Admin ; @error 2 = OS is not Vista or Win 7 ; @error 3 = Reading the the registry key failed, check @extended for the returned error from RegRead() as to why it failed. ; @error 4 = Writing the registry keyname value failed, check @extended for the returned error from RegWrite() as to why it failed. ; @error 5 = $iValue parameter not valid ; Author ........: AlienStar ; Modified.......: smashly ; Remarks .......: ; Related .......: ; Link ..........: http://msdn.microsoft.com/en-us/library/cc232761%28v=prot.10%29.aspx ; Example .......: ; =============================================================================================================================== Func _Toggle_UAC($iValue = -2) If Not IsAdmin() Then Return SetError(1, 0, -1) If Not StringInStr("WIN_VISTA|WIN_7", @OSVersion) Then Return SetError(2, 0, -1) Local $sHKLM, $sName, $iReadValue, $iNewValue $sHKLM = "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem" $sName = "ConsentPromptBehaviorAdmin" $iReadValue = RegRead($sHKLM, $sName) If @error Then Return SetError(3, @error, -1) Switch $iValue Case -1, -2 Switch $iReadValue Case 0 $iNewValue = Abs($iValue) Case Else $iNewValue = 0 EndSwitch Case -3 Return SetError(0, 0, $iReadValue) Case 0, 1, 2 $iNewValue = $iValue Case Else Return SetError(5, 0, -1) EndSwitch RegWrite($sHKLM, $sName, "REG_DWORD", $iNewValue) If @error Then Return SetError(4, @error, -1) Return SetError(0, 0, $iReadValue) EndFunc ;==>_Toggle_UACI haven't tried the code I modded of yours, but it's just to give you an idea of what I mean. Cheers
  9. Hi, Sorry to raise a dead dog, but some one pm'd for a working link so I just updated the the first post with a new link. Not sure how long it'll last or what the host is like. But help yourselves Cheers
  10. Yes, but you'd need to write and call the mixer api functions found in Winmm.dll. You can check out the mixer functions at MSDN: http://msdn.microsoft.com/en-us/library/dd756704%28v=VS.85%29.aspx I'm pretty sure someone may have already written most the functions in autoit, but I don't have a link to the thread sorry.
  11. Hi, That's a nice Grey Scale example taietel. Another way if your not after grey scale and you still want some color but a grey or any other color overlay. #include <GDIPlus.au3> Global $sLoadImage, $sFinalImage, $hImage, $hGraphics, $hBrush _GDIPlus_Startup() $sLoadImage = @ScriptDir&"\test.jpg" $sFinalImage = @ScriptDir&"\test_grey.jpg" $hImage = _GDIPlus_ImageLoadFromFile($sLoadImage) $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage) $hBrush = _GDIPlus_BrushCreateSolid(0xC0C0C0C0) ; Grey _GDIPlus_GraphicsFillRect($hGraphics, 0, 0, _GDIPlus_ImageGetWidth($hImage), _GDIPlus_ImageGetHeight($hImage), $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_ImageSaveToFile($hImage, $sFinalImage) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() ShellExecute($sFinalImage) Cheers
  12. Hi, You might want to look at Cheers
  13. Hi, Use the flag parameter in control send. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> Global $hGui, $iInput, $iButton ShellExecute("notepad.exe") $hGui = GUICreate("", 217, 157, 192, 124, -1, $WS_EX_TOPMOST) $iInput = GUICtrlCreateInput("^^2233^^", 50, 65, 121, 21, $ES_UPPERCASE) $iButton = GUICtrlCreateButton("Send", 60, 96, 97, 20) GUISetState(@SW_SHOW, $hGui) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $iButton ControlSend("[CLASS:Notepad]", "", "[CLASSNN:Edit1]", GUICtrlRead($iInput) & @CR, 1); flag 1, keys are sent raw. GUICtrlSetData($iInput, "") EndSwitch WEnd
  14. Hi, Your better off using PsaltyDS version, since mac address is hex value. In your mock up mac address string you have 0t-z4, a mac address will not have t or z. mac address will only contain 0 to 9 and A to F. Hence PsaltyDS using [:xdigit:] for a search pattern is the better method. Global $sBogusMacAddress, $sMacAddress $sBogusMacAddress = "77.10.119.232 - 255.255.254.0 - 00-15-46-5b-0t-z4 -27/09/2011 8:30:52 AM -D- PC0005.test.local" MsgBox(64, "$sBogusMacAddress", _MacAddressFromString($sBogusMacAddress)) $sMacAddress = "77.10.119.232 - 255.255.254.0 - 00-15-46-5b-0F-F4 -27/09/2011 8:30:52 AM -D- PC0005.test.local" MsgBox(64, "$sMacAddress", _MacAddressFromString($sMacAddress)) Func _MacAddressFromString($sString) Local $aSRE $aSRE = StringRegExp($sString, "[[:xdigit:]]{2}-[[:xdigit:]]{2}-[[:xdigit:]]{2}-[[:xdigit:]]{2}-[[:xdigit:]]{2}-[[:xdigit:]]{2}", 1) If IsArray($aSRE) Then Return "Found Mac Address: " & $aSRE[0] Return "No Mac Address found." EndFunc Cheers
  15. Hi, There's probably a better search pattern, but I gave it a shot. Global $sString, $aSRE $sString = "77.10.119.232 - 255.255.254.0 - 00-15-46-5b-0t-z4 -27/09/2011 8:30:52 AM -D- PC0005.test.local" $aSRE = StringRegExp($sString, "(\w{2}-\w{2}-\w{2}-\w{2}-\w{2}-\w{2})", 1) If IsArray($aSRE) Then MsgBox(64, "Success", "Found Mac Address: " & $aSRE[0]) Else MsgBox(64, "Failed", "No Mac Address found.") EndIf Edit: damn I'm so slow at posting..lol
  16. Hi, you can use $ES_UPPERCASE style for your input box. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> Global $hGui, $iInput, $iButton ShellExecute("notepad.exe") $hGui = GUICreate("", 217, 157, 192, 124, -1, $WS_EX_TOPMOST) $iInput = GUICtrlCreateInput("hello", 50, 65, 121, 21, $ES_UPPERCASE) $iButton = GUICtrlCreateButton("Send", 60, 96, 97, 20) GUISetState(@SW_SHOW, $hGui) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $iButton ControlSend("[CLASS:Notepad]", "", "[CLASSNN:Edit1]", GUICtrlRead($iInput) & @CR) GUICtrlSetData($iInput, "") EndSwitch WEnd Cheers
  17. So who you calling a troll?... bot boy. If your to old to click the controls in a game and not smart enough to write your own bot then give up without posting here in AutoIt help forum. It's obvious your intent is to get a script written for you just to help you play a game. Also obvious is that this forum has rules against posting about automating games, which you refuse to adhere to. The ppl you refer to as trolls are users that could probably actually help you, but won't. As a guess from your own admission that your wanting help automating a game it won't be long before your thread is locked.
  18. "Would you like fries with that?" Fancy that a free scripting language, and I can't tame it and no one else will fix it for me. Call the President would be my choice!
  19. Hi, I don't think I can be any help then as I have no idea on what your trying to accomplish apart from automating web based trading. From what I can see, it sounds more like a timing issue as to why not all commands are being processed. Other things that come to mind is the account calling and passing the same account name for subsequent function calls using the same acount name leads to invalid data return. That's the impression I get from the reading about initialization. http://www.ninjatrader.com/support/helpGuides/nt7/initialization.htmBut as I don't understand the software your using then I have to say you'll need to muddle through it on your own or wait until someone with a better understanding of what your after comes along. Cheers
  20. Hi, Don't know if it'll help but you may want to use DllOpen then DllCall it as many times as needed then use DllClose. Just using DllCall() without opening the dll, then DllCall is opening and closing the Dll every call. I also think that there is more to this dll then just calling the function. I gather the Dll needs to be initialized in some way. As I receive a msgbox from the dll "Failed to initialize Ninja Trader DLL NtDirect.dll (0x80040154)" Even though the AutoIt DllCall itself doesn't error. Global $hDll, $aResult $hDll = DllOpen("NtDirect.dll") If $hDll <> -1 Then For $i = 1 To 50 $aResult = DllCall($hDll, "double", "AvgEntryPrice", "str", "ES 09-11", "str", "Sim102") If Not @error Then ConsoleWrite("DllCall: " & $i & " = " & $aResult[1] & " " & $aResult[2] & " " & $aResult[0] & @LF) Else Msgbox(0,"DllCall: " & $i, "DllCall Failed @error: " & @error) ExitLoop EndIf Next Else Msgbox(0, "DllOpen", "DllOpen failed") EndIf DllClose($hDll) Edit: the "Failed to initialize Ninja Trader DLL NtDirect.dll (0x80040154)" is because I don't have Ninja Trader installed on my pc and it is required to make the call. Or that's the impression I get from reading http://www.ninjatrader.com/support/forum/showthread.php?t=33947
  21. Hi, Use _GDIPlus_BitmapLockBits() to play with the pixels. This code will actually generate a blank transparent png in xp , or at least it does for me #include <WinAPI.au3> #include <GDIPlus.au3> Global $iW = 100, $iH = 100, $hBitmap, $hBMP, $tBitmapData, $tPixels _GDIPlus_Startup() $hBitmap = _WinAPI_CreateBitmap($iW, $iH , 1 , 32) $hBMP = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) _WinAPI_DeleteObject($hBitmap) $hBitmap = _GDIPlus_BitmapCloneArea($hBMP, 0, 0, $iW, $iH, $GDIP_PXF32ARGB) _GDIPlus_BitmapDispose($hBMP) $tBitmapData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $iW, $iH, $GDIP_ILMWRITE, $GDIP_PXF32ARGB) $tPixels = DllStructCreate("byte[" & $iH * $iW * 4 & "]", DllStructGetData($tBitmapData, "Scan0")) ; Create DLL structure for all pixels DllStructSetData($tPixels, 1, StringReplace(DllStructGetData($tPixels, 1), "000000FF", "00000000")) _GDIPlus_BitmapUnlockBits($hBitmap, $tBitmapData) $tPixels = 0 $tBitmapData = 0 _GDIPlus_ImageSaveToFile($hBitmap, @MyDocumentsDir & "\11111.png") _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() Cheers
  22. Hi, Most of it can be done with AutoIt and windows winmm.dll waveIn functions for recording and waveOut functions for playback. The visulisation part can be done while reading the buffers while recording or playback and drawing then to screen. Myself I use lame_enc.dll to convert to mp3. If your looking for some sort of example of recording using waveIn to mp3 you can probably have a look at my script in Examples. Maybe you could use bits 'n' pieces of my code to get you started. Cheers
  23. Doh my post was to slow..lol, nvm
  24. Hi, GDIPlus and GUICtrlSendMsg, #include <GDIPlus.au3> Global $ImgPath = @ProgramFilesDir & "\AutoIt3\Examples\GUI\logo4.gif" Local $hGui, $iPic, $hGraphic, $hBitmap, $hImage $hGui = GUICreate("", @DesktopWidth, 480) $iPic = GUICtrlCreatePic("", 0, 455, @DesktopWidth, 25) _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui) $hBitmap = _GDIPlus_BitmapCreateFromGraphics(@DesktopWidth, 25, $hGraphic) _GDIPlus_GraphicsDispose($hGraphic) $hGraphic = _GDIPlus_ImageGetGraphicsContext ($hBitmap) $hImage = _GDIPlus_ImageLoadFromFile ($ImgPath) For $i = 0 To @DesktopWidth - 128 Step 128 _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, $i, 0, 128, 25) Next _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) $hImage = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) _WinAPI_DeleteObject(GUICtrlSendMsg($iPic, 0x0172, 0, $hImage)) _GDIPlus_ShutDown() GUISetState(@SW_SHOW, $hGui) While GUIGetMsg() <> -3 WEnd Cheers
×
×
  • Create New...