Jump to content

Nine

MVPs
  • Posts

    7,045
  • Joined

  • Days Won

    156

Nine last won the day on June 2

Nine had the most liked content!

About Nine

Profile Information

  • Member Title
    Demain comme jamais
  • Location
    Montréal, Québec, Canada

Recent Profile Visitors

5,198 profile views

Nine's Achievements

  1. AFAIK, registering an issue on this is purely useless. If Google decides that chrome-driver cannot be ran with elevated priv, there is nothing you can do.
  2. You may want to try UIAutomation. To see if it detects controls, run UIAspy.au3.
  3. Holding down a key (to get repetitions) is a keyboard hardware thing more than a software thing (although there are some exceptions. e.g. ). So in order to get the right result, you could use this : SendTimer("{DOWN}", 3000) Func SendTimer($sChar, $iTime) Local $hTimer = TimerInit() While TimerDiff($hTimer) <= $iTime Send($sChar) WEnd EndFunc
  4. Please provide a small runnable snippet that shows the issue, so I can see what you are actually doing...
  5. Of course, but it is not clear what you want to do. You must make you request clear enough otherwise we will just do away.
  6. Here a working way to print colors in console with WriteConsole API. It seems the culprit is AllocConsole which does not provide the feature. I also added a way to ControlSend a command to the console. #include <WinAPIProc.au3> If Not @Compiled Then Exit MsgBox($MB_OK, "Error", "This script must be runned compiled") Local $iPID = Run(@ComSpec & " /k @echo off & echo " & Chr(27) & "[31mRed") ProcessWait($iPID) _WinAPI_AttachConsole($iPID) Local $hCon = _WinAPI_GetStdHandle(1) Local $sText = Chr(27) & "[33mYellow" & @CRLF _WinAPI_WriteConsole($hCon, $sText) Local $hWnd = WinGetHandle(@ComSpec) ControlSend($hWnd, "", "", "echo " & "^{^}[32mGreen" & @CRLF) ; <<<<<< depends on keyboard (could be ^[ for english KB) Sleep(2000) DllCall("kernel32.dll", "bool", "FreeConsole") ProcessClose($iPID) Note that you can start the exe from Explorer. ps. I must admit I spend way too many hours figuring what was the right ESC character to send
  7. Yes it is ! A variable containing a function...
  8. Remove the ByRef, but do not expect colors to be displayed...
  9. You can create the object simply with : Local $CLSID_IUserNotification = "{0010890E-8789-413C-ADBC-48F5B511B3AF}" Local $IID_IUserNotification = "{BA9711BA-5893-4787-A7E1-41277151550B}" Local $oNotif = ObjCreateInterface($CLSID_IUserNotification, $IID_IUserNotification, $tagIUserNotification) Or you can even simpler use : _WinAPI_ShellNotifyIcon
  10. You can simply : $oDict = 0 But the my intention was to understand the algorithm of OP, to provide proper solution that might have nothing to do with dictionary...
  11. You should post a snippet of your code so we can see how you handle it. Without code, it is just a guessing game. Effort can pay off, laziness will rarely do.
  12. New version available.
  13. Funny. I wonder why you post it in pseudo-code when you know that AutoIt is performing it in 1.5hr... Why didn't you use your own code instead ?!? Anyway, I was able to reduce your 1.5hr into about 20 secs with Optimization and Multi-threading. I tested with small amount of data and it seems to work fine. Here : #include <Array.au3> #include <FileConstants.au3> #include "..\Files\PMT-UDF.AU3" Local $a1 = [1, 2, 3, 4, 5, 6, 7, 8] Local $a2 = [4, 5, 7, 12, 23, 28, 44, 56, 57] $s2 = _ArrayToString($a2) Local $a3 = [3, 6, 9] $s3 = _ArrayToString($a3) Local $a4 = [12, 13, 18, 22, 28, 29, 33, 37, 40, 42, 51, 57] $s4 = _ArrayToString($a4) Local $a5 = [2, 15, 47, 56] $s5 = _ArrayToString($a5) Local $a6 = [6, 8, 9, 12, 15, 18, 22, 29, 33, 35] $s6 = _ArrayToString($a6) Local $a7 = [41, 51, 53, 55, 57, 59] $s7 = _ArrayToString($a7) Local $a8 = [12, 21, 31, 41, 47, 55, 56, 57, 58, 59] $s8 = _ArrayToString($a8) _PMT_Init() Local $aProcess[UBound($a1)] For $i = 0 To UBound($a1) - 1 $aProcess[$i] = _PMT_Start("Check", $a1[$i], $s2, $s3, $s4, $s5, $s6, $s7, $s8, "Files\" & $i & ".txt") Next While Sleep(100) For $i = 0 To UBound($aProcess) - 1 If ProcessExists($aProcess[$i]) Then ContinueLoop 2 Next ExitLoop WEnd # todo merge the 8 files with DOS command Func Check($a1, $s2, $s3, $s4, $s5, $s6, $s7, $s8, $sFile) Local $a2 = StringSplit($s2, "|", $STR_NOCOUNT) For $i = 0 to UBound($a2) - 1 $a2[$i] = Number($a2[$i]) Next Local $a3 = StringSplit($s3, "|", $STR_NOCOUNT) For $i = 0 to UBound($a3) - 1 $a3[$i] = Number($a3[$i]) Next Local $a4 = StringSplit($s4, "|", $STR_NOCOUNT) For $i = 0 to UBound($a4) - 1 $a4[$i] = Number($a4[$i]) Next Local $a5 = StringSplit($s5, "|", $STR_NOCOUNT) For $i = 0 to UBound($a5) - 1 $a5[$i] = Number($a5[$i]) Next Local $a6 = StringSplit($s6, "|", $STR_NOCOUNT) For $i = 0 to UBound($a6) - 1 $a6[$i] = Number($a6[$i]) Next Local $a7 = StringSplit($s7, "|", $STR_NOCOUNT) For $i = 0 to UBound($a7) - 1 $a7[$i] = Number($a7[$i]) Next Local $a8 = StringSplit($s8, "|", $STR_NOCOUNT) For $i = 0 to UBound($a8) - 1 $a8[$i] = Number($a8[$i]) Next Local $hFile = FileOpen($sFile, $FO_OVERWRITE) Local $resArr[8] = [$a1], $outStr, $sorArr For $b = 0 To UBound($a2) - 1 If $a2[$b] = $a1 Then ContinueLoop $resArr[1] = $a2[$b] For $c = 0 To UBound($a3) - 1 If $a3[$c] = $a1 Or $a3[$c] = $a2[$b] Then ContinueLoop $resArr[2] = $a3[$c] For $d = 0 To UBound($a4) - 1 If $a4[$d] = $a1 Or $a4[$d] = $a2[$b] Or $a4[$d] = $a3[$c] Then ContinueLoop $resArr[3] = $a4[$d] For $e = 0 To UBound($a5) - 1 If $a5[$e] = $a1 Or $a5[$e] = $a2[$b] Or $a5[$e] = $a3[$c] Or $a5[$e] = $a4[$d] Then ContinueLoop $resArr[4] = $a5[$e] For $f = 0 To UBound($a6) - 1 If $a6[$f] = $a1 Or $a6[$f] = $a2[$b] Or $a6[$f] = $a3[$c] Or $a6[$f] = $a4[$d] Or $a6[$f] = $a5[$e] Then ContinueLoop $resArr[5] = $a6[$f] For $g = 0 To UBound($a7) - 1 If $a7[$g] = $a1 Or $a7[$g] = $a2[$b] Or $a7[$g] = $a3[$c] Or $a7[$g] = $a4[$d] Or $a7[$g] = $a5[$e] Or $a7[$g] = $a6[$f] Then ContinueLoop $resArr[6] = $a7[$g] For $h = 0 To UBound($a8) - 1 If $a8[$h] = $a1 Or $a8[$h] = $a2[$b] Or $a8[$h] = $a3[$c] Or $a8[$h] = $a4[$d] Or $a8[$h] = $a5[$e] Or $a8[$h] = $a6[$f] Or $a8[$h] = $a7[$g] Then ContinueLoop $resArr[7] = $a8[$h] $sorArr = $resArr _ArraySort($sorArr) $outStr &= $sorArr[0] & "," & $sorArr[1] & "," & $sorArr[2] & "," & $sorArr[3] & "," & $sorArr[4] & "," & $sorArr[5] & "," & $sorArr[6] & "," & $sorArr[7] & @CRLF Next Next Next Next Next Next FileWrite($hFile, $outStr) $outStr = "" Next FileClose($hFile) EndFunc ;==>Check You can find my multi-threading UDF in my signature. ps. I was able to reduce it to 12 secs but rewriting the _ArraySort to fit the situation (not included)...
  14. You should read forum rules especially the part about game automation. But since M23 moved you without closing your thread, I suppose it is alright. Try something along those lines : #include <WinAPISysWin.au3> Local $aList = WinList() Local $hWnd = WinGetHandle("[CLASS:Notepad]") For $i = 1 To $aList[0][0] If _WinAPI_GetParent($aList[$i][1]) = $hWnd Then ConsoleWrite($aList[$i][0] & @CRLF) Next There is also _WinAPI_EnumChildWindows but it may not work as you want...
  15. It is because the code is using int to call the callback while, in your case, it should be ptr. DllCallAddress("none", $lParam, "ptr", $wParam, "int", 1) After some readings, it became quite clear what is the issue when an APC is executed inside AutoIt. We have to remember that AutoIt (I tend to forget about it) is interpreted. Which means that it is the AutoIt3.exe engine that executes our script lines. So when an APC is launched, Windows expect that it will be using its own stack. But since the callback address is referring to one managed by the interpreter which has a different stack, corruption is doomed to happen. By using ASM code, the interpreter is not involved in any way in the callback. We then communicate thru a message, which is perfectly handled by AutoIt. So bottom line, it is very safe to use the ASM code and I do not see anyway it could break.
×
×
  • Create New...