Jump to content

All Activity

This stream auto-updates     

  1. Today
  2. This is a UDF to handle the AutoIt Error msgbox when our awesome code goes I've been using trancexx's code for the longest time and since I iron some wrinkles in my ( personal use ) UDF, decided to organize it in a dignifying way and post it. The ZIP with the code is in the downloads area. I'm posting this because most other handlers use /ErrorStdOut to catch errors and they are not that common, for us great coders So makes little sense to me to run 2 EXEs for something unlikely to happen. No one made a UDF of this, so, I did. oh, ..there are things where this will be of no use, say, infinite recursion or what not, so, if the the AutoIt Error msgbox was to popup then this UDF should do it. ...let me know if you liked it, or post your views to better it. Cheers
  3. Version 0.2020.05.24

    1 download

    ..a more flexible way to handle a This UDF, declared as the first ( or close to the top ) in a script, will catch the dreaded "AutoIt Error" MsgBox and prettify it, or just plain hide it. Is optional. Also add an EventLog Entry ( or not, is optional ). Add an entry in a log file ( or not, is optional ). Run another program to do something about the mishap ( or not, is optional ). There is an example of usage in the ZIP along with an example of the other program that handles the aftermath.
  4. So I have a huge text file that is admittedly laid out perfectly for this but I can't seem to think of the best way to do it. I'm trying to manage some data and want to condense it. Example data <span class='color3'>Serpent's Small Charm of Inertia</span> (83)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 40</span><BR><span class='color3'>+3% Faster Run/Walk</span><BR><span class='color3'>+13 to Mana</span> <span class='color3'>Ruby Small Charm of Dexterity</span> (85)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 32</span><BR><span class='color3'>+2 to Dexterity</span><BR><span class='color3'>Fire Resist +11%</span> <span class='color3'> Small Charm of Inertia</span> (81)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 27</span><BR><span class='color3'>+3% Faster Run/Walk</span> <span class='color3'> Small Charm of Inertia</span> (84)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 27</span><BR><span class='color3'>+3% Faster Run/Walk</span> <span class='color3'>Fine Small Charm of Sustenance</span> (77)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 21</span><BR><span class='color3'>+2 to Maximum Damage</span><BR><span class='color3'>+19 to Attack Rating</span><BR><span class='color3'>+14 to Life</span> <span class='color3'>Bronze Small Charm of Sustenance</span> (86)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 17</span><BR><span class='color3'>+7 to Attack Rating</span><BR><span class='color3'>+15 to Life</span> <span class='color3'>Shimmering Small Charm of Dexterity</span> (79)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 25</span><BR><span class='color3'>+2 to Dexterity</span><BR><span class='color3'>All Resistances +4</span> <span class='color3'>Serpent's Small Charm of Strength</span> (86)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 40</span><BR><span class='color3'>+2 to Strength</span><BR><span class='color3'>+17 to Mana</span> <span class='color3'>Steel Small Charm of Dexterity</span> (81)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 49</span><BR><span class='color3'>+33 to Attack Rating</span><BR><span class='color3'>+2 to Dexterity</span> <span class='color3'>Bronze Small Charm of Dexterity</span> (79)<BR><span class='color0'>Keep in Inventory to Gain Bonus</span><BR><span class='color1'>Required Level: 5</span><BR><span class='color3'>+4 to Attack Rating</span><BR><span class='color3'>+1 to Dexterity</span> So first goal; Read Into Array And Split Between Each Line and then further split between each needed field, which is conveniently the same line as the StringRegExp $ReadFile = FileOpenDialog("Find Mule...", "D:\Documents\d2mr-1.14d\d2bot-with-kolbot-master\d2bot-with-kolbot-master\d2bs\kolbot\mules", "Text files (*.txt)", 4) Dim $aRecords If Not _FileReadToArray($ReadFile,$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] $ArrayData = StringRegExp($aRecords[$x],"(?i)(?s)<span class='color3'>(.*?)</span>",3) Next Now I want to do one more thing that I can't think of how to do The first instance of the RegExp gives me the Title, so I can assign that something like $Title = $ArrayData[$x][0] I then need to iterate through however many more instances there are and add them together like $Field = $Field + $ArrayData[$x][xxxx] until no more fields found This is where I am stuck
  5. Sounds good. Definitely compare the two because the compiled example and iDispatchasm.au3 are the same thing, just one has all the source assembly code and gets compiled on the fly every time you run it with fasmg and the other has all the assembly code replaced with precompile machine code. So the example one would not need the fasmg and include folder to run where the iDispatchasm.au3 does.
  6. My bad. Goodness !. Sorry about my line of questioning, Got to look at the IdispatchASM.au3 and made sense of it. I was just running IdispatchASM_compiled_example.au3 and doing other things.
  7. well, the way I had it in my head is that 1 script would have functions that can be called from another script. And thought it would be ala dll due to the iDispach. Am I too far off ? Edit: run in both PCs, a-OK
  8. Yesterday
  9. The way you quoted "Dllcall" here has got me a bit confused. Are you talking about splitting the example into a separate file with "include Idispatchasm.au3" so they are 2 scripts? I found the issue going on with the betas and have reuploaded with the fix. The fix is updating the flags check to force a word value instead of default within the invoke method and should be done for 32bit as well even though its doesnt seem to be a problem. _(' .if word[wFlags] = DISPATCH_PROPERTYGET');.. line 207
  10. At the top of the page, there is a cookie acceptance button with the caption: "Got it!" After several hours searching on the forum, Google and just trial and error, I manage to click the "Got it!"-button with the following lines: Local $oTags = _IETagNameGetCollection($oIE, "a") For $oTag In $oTags If $oTag.InnerText="Got it!" Then _IEAction($oTag, "click") ExitLoop EndIf Nex The above snippet works, however does anyone knows a "cleaner" way of hitting that button?
  11. I think I seen a rule saying we can't ask about games so I apologize. My question is for a game based solution but generally I would like the answer of how to best get more accurate selections if there are any tips. If neither is allowed feel free to delete! Thanks!
  12. Hey everyone, I apologize if in the wrong place. Was a few general options so wasn't exactly positive. If I am Just advise and I can post elsewhere. So I am completely new to Autoit. Been spending lots of the quarantine learning new languages. I'm pretty good with Javascript, C++, C#, Python but never messed with Autoit. Anyway, the thing I'm running into here is the ImageSearch/PixelSearch. Not sure if there is a better way to make these more useful for me. I've attached an image to the post to demonstrate what I'm trying to match up with. I've tried both Pixel and Image to accomplish the goal. Pixel actually doesn't have any issue finding an acceptable color however, I need it to be like a 10px-10px opening for unit placement it's finding small gaps where units can't be placed. So I figure this is where image would come in but the only time I have luck with that is if the image is if I select 1 portion of the pattern in the image but then it's too large and if other units are in the way it will simply state not found. Is there a better way to use pixel or image to find an appropriate area that I want the mouse to drag to? Code is below. Maybe a suggestion on another method of doing this? The light green(image example) is where you can place units. As you can see all the little sprites are characters already placed. My bot already checks if a unit is available (in the bottom) then it scans for a location to put it (and fails) however it does grab the character and drags it but not in a valid location then it returns by pressing the home button. This is a PVE game where you just play vs NPCs characters like a raid.You can place 1 unit with your team every 5 minutes so trying to automate this portion. Below function is only for the locate light green area. func unitFind() ; $result = PixelSearch(430, 369, 1546, 718, 0x136F73, 0) $picture = "C:\Users\Jcape\Documents\RaidBot\img\validBF.png" $result = _ImageSearch_Area($picture, 488, 326, 1544, 759) if Not @error then MouseMove(261, 967, 50) MouseDown("LEFT") Sleep(200) MouseMove($result[1], $result[2], 50) MouseUp("LEFT") EndIf EndFunc
  13. ...now, would you code an example of how to "DllCall" a script to ...use it as 2 scripts ?. I'm really clueless and can't figure how to split it into 2 scripts, the IDispatch holder and the calling script.
  14. Yes, did that and worked on both PCs
  15. @argumentum Kudos for the effort! @aVen9er You might also want to consider an alternative method of detection, maybe you can pass custom command line parameters, or maybe even use the @Compiled macro. All of my suggestions of course are generic, it is not possible to suggest the best method without knowing the use case
  16. Thank you for that. This is indeed a pickle. I got the beta portion narrowed down to it not liking the any of the direct get code and setting the dllstruct name directly by name. Commenting that portion out gets the rest of it working and gives me something to look at but I'm stumped for what would be going on between windows versions. Local $aArray = [111, 222, 333] $oIDispatch = IDispatchASM() $oIDispatch.string = "string test" $oIDispatch.__string = "__string test2" $oIDispatch.float = 12.345145 $oIDispatch.array = $aArray $oIDispatch.binary = Binary(12345678) $oIDispatch.bool = True $oIDispatch.dllStruct = DllStructCreate("BYTE t") ;~ $oIDispatch.dllStruct.t = 99 ;~ ConsoleWrite('-Direct get test:' & @CRLF & _ ;~ '$oIDispatch.string = ' & $oIDispatch.string & @CRLF & _ ;~ '$oIDispatch.__string = ' & $oIDispatch.__string & @CRLF & _ ;~ '$oIDispatch.float = ' & $oIDispatch.float & @CRLF & _ ;~ '$oIDispatch.array[1] = ' & $oIDispatch.array[1] & @CRLF) ConsoleWrite('-method __keysau3 test:' & @CRLF) Local $aKeyAU3s = $oIDispatch.__keysau3() ConsoleWrite('$aKeyAU3s = ' & _ArrayToString($aKeyAU3s) & @CRLF) ConsoleWrite('-method __get test:' & @CRLF) For $k In $oIDispatch.__keysau3() $val = $oIDispatch.__get($k) ConsoleWrite('$oIDispatch.' & $k & ' = ' & (IsArray($val) ? _ArrayToString($val) : (IsDllStruct($val) ? DllStructGetData($val, 1) : $val)) & @CRLF) Next ConsoleWrite('-method __set test:' & @CRLF) Local $i = 0 For $k In $oIDispatch.__keysau3() $oIDispatch.__set($k) = $i ConsoleWrite('$oIDispatch.' & $k & ' = ' & $oIDispatch.__get($k) & @CRLF) $i += 1 Next >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /beta /ErrorStdOut /in "F:\AutoIt Scripts\FLAT Assembler\fasmg dll\IDispatchASM\IdispatchASM_compiled_example.au3" /UserParams +>14:51:22 Starting AutoIt3Wrapper v.19.102.1901.0 SciTE v.4.1.2.0 Keyboard:00000409 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\BJ\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\BJ\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.15.2) from:C:\Program Files (x86)\AutoIt3\Beta input:F:\AutoIt Scripts\FLAT Assembler\fasmg dll\IDispatchASM\IdispatchASM_compiled_example.au3 +>14:51:22 AU3Check ended.rc:0 >Running:(3.3.15.2):C:\Program Files (x86)\AutoIt3\Beta\autoit3_x64.exe "F:\AutoIt Scripts\FLAT Assembler\fasmg dll\IDispatchASM\IdispatchASM_compiled_example.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop -method __keysau3 test: $aKeyAU3s = string|__string|float|array|binary|bool|dllStruct -method __get test: $oIDispatch.string = string test $oIDispatch.__string = __string test2 $oIDispatch.float = 12.345145 $oIDispatch.array = 111|222|333 $oIDispatch.binary = 0x4E61BC00 $oIDispatch.bool = True $oIDispatch.dllStruct = 0 -method __set test: $oIDispatch.string = 0 $oIDispatch.__string = 1 $oIDispatch.float = 2 $oIDispatch.array = 3 $oIDispatch.binary = 4 $oIDispatch.bool = 5 $oIDispatch.dllStruct = 6 +>14:51:22 AutoIt3.exe ended.rc:0 +>14:51:22 AutoIt3Wrapper Finished. >Exit code: 0 Time: 0.8726
  17. #include <Debug.au3> #include <WinAPIProc.au3> _DebugArrayDisplay(WhereAreMyParents(), "WhereAreMyParents") Func WhereAreMyParents($iPID = @AutoItPID) Local $s, $a[11][3] = [[0, "", ""]] $a[1][0] = $iPID $a[1][1] = _WinAPI_GetProcessName($iPID) $a[1][2] = _WinAPI_GetProcessCommandLine($iPID) For $n = 2 To 10 $iPID = _WinAPI_GetParentProcess($iPID) If $iPID = 0 Then ExitLoop $a[0][0] = $n $a[$n][0] = $iPID $a[$n][1] = _WinAPI_GetProcessName($iPID) $a[$n][2] = _WinAPI_GetProcessCommandLine($iPID) Next ReDim $a[$a[0][0] + 1][3] Return $a EndFunc ;==>WhereAreMyParents ..I know I'm late but I type with 2 fingers and I was quite invested so, there !
  18. I think you would need to use 2 get parent process. With Scite at least it is working... MsgBox ($MB_SYSTEMMODAL,"",_WinAPI_GetProcessName(_WinAPI_GetParentProcess(_WinAPI_GetParentProcess())))
  19. I was thinking that given the differences between WIN_10 environments, OS:WIN_10 don't say enough. Could you add the ReleaseId to it, like OS:WIN_10(1903) to the wrapper ? ConsoleWrite('+ ReleaseId: ' & RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ReleaseId") & @CRLF) Thanks
  20. I think you can check parent process of your process. Something like _WinAPI_GetProcessName(_WinAPI_GetParentProcess()) PD: sorry for don't using sintaxis highlight I'm by phone. I'll update later. Saludos
  21. Hi, good idea, but also this suggested version from you: ________________________________________________________________________________ $data=_WinHttpSimpleReadData($hRequest) If Not @error Then GUICtrlSetData ($ReturnAnswer_LabelID, $data) ;Writing data onto a label to visualise it MsgBox(0, "Data", $data) EndIf _______________________________________________________________________________ is still signalising, as if a data would have been received, but nothing comes. It means @error is every time <>0, and MsgBox(0, "Data", $data) is coming up in every cycle. I know well, that I sent to the server such a message, which is not complete, so the server would not send me anything. Server sends me only a Header and a type of "Hello, I am here" message, that he understood my message, but does not send me anything. I tryed and this solution works: If Stringlen($data)<>0 Then... It seems, that "If Not @error Then..." does not work. In WinHTTP.au3 at _WinHttpSimpleReadData if no datareceived, it returns: Return SetError(2, 0, $vData) It means @error should be 2 if no data came. Bit interesting, that also If @error<>2 Then... does not work. I do not know, why. Main thing, I have now a solution for it. THX for helping !
  22. What a pickle !. In Win10 1909 ( run "winver" ), it behaves as in yours but on Win10 1607, is the other way around. My main PC is with 1607 but I have other PCs, mainly to test if my coding works abroad. Since Jon is looking at workarounds due to the, masterful updates in Win10, this may help him in debugging too, if he find it relevant to AutoIt. ..and as a side note: Is thanks to ppl like you is that I can have working code. Thanks. This is the 1607 console This is the 1909 console ...add to your code ConsoleWrite('+ ReleaseId: ' & RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ReleaseId") & @CRLF) ,to report what Win10 "class" is the user running. I think it may help on the console log.
  23. I would like my script to do something different depending on whether my * .au3 file was launched from Visual Studio Code (by pressing F5) or by double-clicking in Windows Explorer. How to detect if *.au3 file was launched from Visual Studio Code?
  1. Load more activity
×
×
  • Create New...