Leaderboard
Popular Content
Showing content with the highest reputation on 05/28/2024 in Posts
-
Thanks a lot ioa747 i modified your code and this working fine! best regards1 point
-
take a test, how it works for you Run("Explorer " & @MyDocumentsDir) ConsoleWrite("@DocumentsCommonDir=" & @MyDocumentsDir & @CRLF) Local $hWnd = WinWaitActive("Documents") ConsoleWrite("$hWnd=" & $hWnd & @CRLF) WinMove($hWnd, "", -7, 0, @DesktopWidth / 2, @DesktopHeight - 40) Look at: WinAPI_GetWorkArea() 210826-moves-andor-resizes-and-arrange-windows-between-multi-monitors/1 point
-
Here is an adaptation based this code #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global Const $SC_DRAGMOVE = 0xF012 HotKeySet("{ESC}", _Exit) _GDIPlus_Startup() $myWidth = 800 $myHeight = 800 $hGUI = GUICreate('', $myWidth, $myHeight, -1, -1, $WS_POPUP, $WS_EX_LAYERED) GUISetState() $hBitmap = _GDIPlus_BitmapCreateFromScan0(300, 300) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap) $hBrush = _GDIPlus_BrushCreateSolid(0xFF0000FF) _GDIPlus_GraphicsFillPie($hGraphic, 150, 80, 100, 100, 45, 90, $hBrush) _GDIPlus_GraphicsDispose($hGraphic) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _WinAPI_BitmapDisplayTransparentInGUI($hHBitmap, $hGUI, 255) GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _Exit() EndSwitch WEnd Func _WinAPI_BitmapDisplayTransparentInGUI(ByRef $hHBitmap, ByRef $hGUI, $iOpacity = 0xFF, $bReleaseGDI = True) If Not BitAND(GUIGetStyle($hGUI)[1], $WS_EX_LAYERED) = $WS_EX_LAYERED Then Return SetError(1, 0, 0) Local $tDim = DllStructCreate($tagBITMAP) If Not _WinAPI_GetObject($hHBitmap, DllStructGetSize($tDim), DllStructGetPtr($tDim)) Then Return SetError(2, 0, 0) Local $tSize = DllStructCreate($tagSIZE), $tSource = DllStructCreate($tagPOINT), $tBlend = DllStructCreate($tagBLENDFUNCTION) Local Const $hScrDC = _WinAPI_GetDC(0), $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC), $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) $tSize.X = $tDim.bmWidth $tSize.Y = $tDim.bmHeight $tBlend.Alpha = $iOpacity $tBlend.Format = 1 _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteDC($hMemDC) If $bReleaseGDI Then _WinAPI_DeleteObject($hHBitmap) Return True EndFunc Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam) _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;==>_WM_LBUTTONDOWN Func _Exit() _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() Exit EndFunc1 point
-
Until somebody actually experienced in this chimes in, I will add my minor comment. I don't think you can choose which monitor the window opens in, however, as a suggestion you could quickly move the program to the other monitor, once the program opens. For dual monitors, you could look at forum topics such as the below to help in moving the program to the desired monitor using WinMove. https://www.autoitscript.com/forum/topic/113584-winmove-second-screen/ https://www.autoitscript.com/forum/topic/204441-multiple-monitors-how-to-modify-script-to-keep-app-on-current-monitor-instead-of-defaulting-back-to-first-monitor/1 point
-
Trying a WebDriver clean start but I could not
MarcoMonte reacted to Nine for a topic
@MarcoMonte The example in the Wiki attaching to an existing Chrome session is kind of complex for nothing. What you need to do is to follow those 2 easy steps : 1. add the following parameter to your Chrome shortcut : --remote-debugging-port=9222 2. use these capabilities in your script to create a session : '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "debuggerAddress": "localhost:9222"}}}}' That will attach to your single current Chrome session. Rest of the script should remain the same.1 point -
Thanks bud, and all on my own, though your comment about qhash being a custom function helped, and a number of other things falling into place giving me some insight. I went the Python script route because the conversion aspect had me stumped. I hate to think of how much time I wasted on trying different things getting it to work. Clearly the Python code works, but there is something missing in the conversion to AutoIt code, and I cannot determine what, and really can't waste any more time on it. I have a solution now, if not the best one for a couple of reasons, but it will do. I've taken a break and not done the ultimate test yet, which will probably happen tomorrow now. I suspect it will work though, cannot see why it wouldn't. But then, that's using normal thinking, and the Kobo coder(s) have already shown they like to be convoluted and complex ... so much so, that my Kobo device has perpetual issues, as does my wife's, a different model. Both of which discourage me from buying a new one, especially a color one. But in any case, I want my next e-ink device to be both color and a larger one. There's not much value in color for the current standard size, beyond seeing covers in color while browsing, and the occasional small color image. Where color and size come into their own, is with graphic novels, comics, magazines, textbooks and biographies with color images or photos on a large 10" screen. While I have a good number of such ebooks, I don't read such very often, and my 10" Samsung Tablet has proved to be acceptable enough. At some point I will need another Kobo e-ink device though, and like many right now, I do feel the pull and attraction of getting a color one. But at the same time, I already have three e-ink devices and the good 10" tablet. I also have a 7" cheap brand tablet, that worked well enough and I haven't used in years. The only two I use with any regularity are the Kobo and the Kindle Paperwhite. Every now and then I use the Samsung tablet, usually to read a biography. My Keyboard Kindle, my first E-ink purchase that got me invested in such, is a great device, and on a rare occasion I force myself to use it, but as it is not great to use in poor lighting or the dark, due to no inbuilt light, only a pullout light built into the cover, which is only passable at best, I prefer to not use it. I do however prefer buttons for page turning, which it has and the Paperwhite doesn't. It is also the only device, aside from my tablets, with support for audio, not that I currently use that facility, only having a small handful of audio books, which I am not really into.1 point
-
I managed to compile the Python script to an EXE. And my memory said I only needed that Testing.exe file, but clearly not, so I now have heaps of required files, all adding up to 12.2 Mb. So much for a nice small script. Anyway .... That done, the next thing was passing the ImageId value on the command-line. That took a bit of research, but I got there, and was reminded just how horrible it is to program with Python. So I have added and also replaced with the following in my Python script. import sys ImageId = sys.argv[1] hash1 = qhash(ImageId) And now before I go any further, I need to check if this has all been worth the trouble. In other words, I need to find an ebook on my Kobo device that doesn't have any cover images assigned, grab its ImageId value via the SQL database file, and then run that through my Python script, to get the two numbered folder names. Then create those folders on my Kobo device, and then add the three correctly named cover image files to that path. Then fire up my device and see if the covers are now displaying where they should be. If that works, then we will be cooking with gas, and all the hassle would have finally been worth it ... and I will feel back in control of my device. And of course that means I can finally finish my Kobo Cover Fixer program, and call it a full success. Meanwhile, I am sure that TheDcoder will come up with the AutoIt code solution, and I can ditch my Python script. But if not, then I can certainly make do ... and always have something to tease TheDcoder about.1 point
-
Okay, I managed to check that a Python script would work and produce the results I want. Testing.py def qhash (inputstr): instr = "" if isinstance (inputstr, str): instr = inputstr elif isinstance (inputstr, unicode): instr = inputstr.encode ("utf8") else: return -1 h = 0x00000000 for i in range (0, len (instr)): h = (h << 4) + ord(instr[i]) h ^= (h & 0xf0000000) >> 23 h &= 0x0fffffff return h hash1 = qhash("ff0a942a-2f28-4aa2-ba97-318fce090264") print("_test_covers - hash1='%s'" % (hash1)) xff = 0xff dir1 = hash1 & xff dir1 &= 0xff print("_test_covers - dir1='%s', xff='%s'" % (dir1, xff)) xff00 = 0xff00 dir2 = (hash1 & xff00) >> 8 print("_test_covers - hash1='%s', dir1='%s', dir2='%s'" % (hash1, dir1, dir2)) That returns the following when run via a BAT file. _test_covers - hash1='12448788' _test_covers - dir1='20', xff='255' _test_covers - hash1='12448788', dir1='20', dir2='244' Press any key to continue . . . Testing.bat @echo off python Testing.py pause cls exit Then I added a print to file statement at the end of the script. with open("output.ini", "a") as f: print("[Sub Folders]", file=f) print(f"dir1={dir1}", file=f) print(f"dir2={dir2}", file=f) And got an easily accessible result in an INI file. [Sub Folders] dir1=20 dir2=244 Now I just have to see if I can compile that script into an EXE, so that a Python install is not required.1 point
-
WinHttp.au3: #include-once Global Const $HTTP_STATUS_OK = 200 Func HttpPost($sURL, $sData = "") Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("POST", $sURL, False) If (@error) Then Return SetError(1, 0, 0) $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.Send($sData) If (@error) Then Return SetError(2, 0, 0) If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0) Return SetError(0, 0, $oHTTP.ResponseText) EndFunc Func HttpGet($sURL, $sData = "") Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("GET", $sURL & "?" & $sData, False) If (@error) Then Return SetError(1, 0, 0) $oHTTP.Send() If (@error) Then Return SetError(2, 0, 0) If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0) Return SetError(0, 0, $oHTTP.ResponseText) EndFunc Example 1: #include "WinHttp.au3" Global $MD5 = HttpPost("http://www.afk-manager.ir/test/post.php", "password=WeWantThisAsMd5") MsgBox(64, "MD5", $MD5) Example 2: #include "WinHttp.au3" Global $sGet = HttpGet("http://www.google.com/") FileWrite("Google.txt", $sGet) Speed compare: [WinHttp.WinHttpRequest.5.1 GET] 1 = 422.961162765649 2 = 455.738280639636 3 = 441.821516504421 4 = 390.538648365335 Total = 1711.059608275041 Average = 427.7649020687603 [WinHttp.WinHttpRequest.5.1 POST] 1 = 826.436200956633 2 = 872.366642546045 3 = 871.266802895081 4 = 875.792832686324 Total = 3445.862479084083 Average = 861.4656197710208 [HTTP UDF GET] 1 = 984.282912132673 2 = 813.896511915435 3 = 781.158836566862 4 = 791.901235916364 Total = 3371.239496531334 Average = 842.8098741328335 [HTTP UDF POST] 1 = 788.734835486743 2 = 975.688234142967 3 = 785.810779035388 4 = 847.537193542955 Total = 3397.771042208053 Average = 849.4427605520133 [InetRead GET] 1 = 672.120733570292 2 = 595.221462195098 3 = 561.122261209642 4 = 738.180516302658 Total = 2566.64497327769 Average = 641.6612433194225 Tests result: Server 2003 32bit OK Server 2003 64bit Not Tested Server 2008 32bit Not Tested Server 2008 64bit OK XP 32bit OK XP 64bit Not Tested Vista 32bit Not Tested Vista 64bit Not Tested 7 32bit OK 7 64bit OK 8 32bit OK 8 64bit OK Are you interested? Check this out: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384106(v=vs.85).aspx1 point
-
Well, the @DektopWidth and @DesktopHeight Macros will return the resolution of your primary monitor. For me though, because both of my monitors are the same resolution, I could move a window to the center of the 2nd monitor like this: $size = WinGetPos("Title", "Text") $Width = $size[2] $Height = $size[3] WinMove("Title","Text", @DesktopWidth+(@DesktopWidth/2) - ($Width/2), (@DestopHeight/2)-($Height/2)) You could try this. If both of your monitors are the same resolution it should work1 point
-
Trying a WebDriver clean start but I could not
SOLVE-SMART reacted to MarcoMonte for a topic
Thx, I am pretty disheartened, I really miss native I.E. functions/instructions, I am not a programmer and this is hard enough for me, I just hate my job and I am trying to automate some tedious procedures.0 points -
Gawd, ChatGPT let me down. It started out well enough, then it kept pretending it had modified its presented code, when it was returning identical code to the last reply. So I then tried to lead it to the variations if gave last night, and it just got silly and repeated my own code, and at one point hard coded (assigned) the values I wanted returned. Then just as I was going to massage it in teh direction I wanted, it gave teh following message. Clearly while it is a new day for me, it must be including all the replies from last night as well, which were a lot more. You'd think they would have some reasonable leeway with different time zones. I had more than a 10 hour break, in which I slept. P.S. And gawd, what an idiot. I just discovered that I mistakenly grabbed the ShiftBit lines from my code and used them in my first example with ChatGPT today. What a horrible mistake, and I thought I took all care not to do that ... bloody brain, can't trust it.0 points