Leaderboard
Popular Content
Showing content with the highest reputation on 04/16/2021 in all areas
-
[solved] StringFormat(), where is the StringFormatBuilder() ?
wolflake and 2 others reacted to argumentum for a topic
@seadoggie01, I can understand quantum entanglement, the reason for matter to exist, etc., but this darn Regular Expressions I have no clue. A string in a variable is just a string.3 points -
I'm creating a WebDriver tutorial
SkysLastChance and one other reacted to water for a topic
Internet Explorer is nearly dead, newer versions of Firefox can't any longer be automated using Stilgar's FF UDF. Hence more and more users (including me) need to look at automating Webbrowsers using WebDriver. That's why I have started to create a tutorial in the wiki. It should describe all necessary steps from intallation to usage. I'm still collecting ideas for the tutorial - that's where you come into play. What do you expect to see in such a tutorial? Which browsers should be covered (Firefox, Chrome and Edge are settled)? Any questions for the FAQ? Which (high level) coding examples do you expect (like "How to attach to a running browser instance") ... Like to see your comments ToDo-List: Add "Tools" section and add ChroPath plugin. Done. FAQ: "How to attach to a running browser instance". Done. Explain the difference between iuiautomation, iaccessible, autoit, webdriver. Done. The AutoIt FAQ 40 has been extended. Detailed description of each function. Done Example for "how to deal with downloading". Use function _WD_DownloadFile. Example for "how to deal with popups (alerts, print or save dialog). Use function_WD_AlertRespond to respond to a user prompt. Example for "how to deal with multiple tabs". Use functions _WD_NewTab (create a new tab), _WD_Window (close or switch to a tab) and _WD_Attach (attach to existing tab).2 points -
Prevent too fast clicks
Nine and one other reacted to JockoDundee for a topic
Because whether it is a GAME or not is irrelevant... My point being that the OP asks for help with a script to fix his double clicking mouse. The indefatigable @Nine delivers, as usual, a framework script, making use of direct OS calls, which appears to work in the general case. However, the OP is clearly nonplussed by this, and says: Thereby bringing up the revelation that this fix should work in full-screen applications for the first time. As you may know, “full-screen applications” often access I/O hardware directly for reasons of both performance and so that the I/O devices are harder to manipulate for unintended purposes. Such apps are not all the same in their access methods, even if you were to make it work in one, that’s not a guarantee it work in another. Given this, if the OP were to continue requesting help, he would have to at a minimum specify the full-screen apps that are in question. Yet instead of providing that, he bizarrely laments the “low level” of the fix, and actually asks for an approach even less likely to work.2 points -
nasty guy $str = "\\server\share" & @cr & @tab & "an%other" $s = StringRegExpReplace($str, '([\\%\r\t])', "$1$1") Msgbox(0,"", $str & @crlf & @crlf & $s)2 points
-
You may also want to try : _WinAPI_SetWindowPos ($hWnd, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_SHOWWINDOW, $SWP_NOMOVE, $SWP_NOSIZE))2 points
-
This is the AutoIt's version of Microsoft Scriptomatic tool. Which took me some hours to rewrite (yes, yes, I'm not such a fast script writer). If you don't know what Scriptomatic is, see: http://www.microsoft.com/technet/scriptcen...s/scripto2.mspx This version is written in AutoIt script AND it produces an AutoIt script ! Requirements: - AutoIt version 3.1.1.8 (or higher) - Some knowledge about WMI Download at: http://www.autoitscript.com/forum/index.ph...amp;showfile=29 Have fun! Regards, -Sven EDIT 17-APR-2005: Updated with suggestions from gafrost and some other bugfixes. Now REQUIRES AutoIt beta version 3.1.1.8 or higher ! EDIT 17-APR-2005 11PM: For the generated script you have now options for dialog, text or HTML output. EDIT 14-MAY-2005: Fixed a tiny bug: If the output contained an array-variable, I incorrectly used the index 1. But arrays start from index 0. Thanks gafrost ! Edit: Uploaded JdeB's fixed version for the latest beta release. - Jon.1 point
-
#include "GUICtrlMenuClick.au3" Example() Func Example() Local $hWnd = WinGetHandle("[CLASS:SciTEWindow]") Local $hMenu = _GUICtrlMenu_GetMenu($hWnd) Local $ooo_GetID = __GUICtrlMenu_GetID($hMenu, 'As HTML...') If $ooo_GetID <> -1 Then _ __GUICtrlMenu_ClickByID($hWnd, $ooo_GetID) If WinExists($hMenu) Then WinClose($hMenu) EndFunc example 2:- https://www.autoitscript.com/forum/topic/206886-problem-with-notepad/?do=findComment&comment=1491372 Modified udf as per @Nine suggestion GUICtrlMenuClick.au31 point
-
[solved] StringFormat(), where is the StringFormatBuilder() ?
argumentum reacted to jchd for a topic
My proposal above is terrible as was uselessly complicated, sorry. If you insist on converting actual CRs, LFs & TABs, then: ; converting these: ; \ to \\ ; % to %% ; newline to \n ; carriage return to \r ; tab to \t $sOut = "\\server\share\n\r\t" & @cr & @tab & "an%other" $sIn = Execute("'" & StringRegExpReplace($sOut, "([\\%]|\n|\r|\t)", "' & ('$1' = '\\' ? '\\\\' : '') & ('$1' = '%' ? '%%' : '') & ('$1' = @LF ? '\\n' : '') & ('$1' = @CR ? '\\r' : '') & ('$1' = @TAB ? '\\t' : '') & '") & "'") ConsoleWrite($sIn & @LF & @LF) ConsoleWrite(StringFormat($sIn) & @LF) and the result is a one-liner.1 point -
I remember the good old days of "Lucy in the Sky with Diamond". Seems like a flash back1 point
-
Need Help Running Batch File with Multiple Prompts - (Moved)
argumentum reacted to ERPDude for a topic
Thanks argumentum. No offence taken.1 point -
Prevent too fast clicks
seadoggie01 reacted to mikell for a topic
Here is an example of the best way for sure1 point -
Prevent too fast clicks
seadoggie01 reacted to Melba23 for a topic
Hi all, Can I just remind everyone that there is a Moderation Team on this forum who decide what is legal and what is not. So if you have any doubts just report the thread and move on - please do not get involved in pointless arguments between members. Although I feel I should point out that Werty is quite wrong in his assumption: That most certainly is game automation and/or "botting" - and so against the Forum rules. But for what it is worth I have seen nothing so far in this thread which would warrant closing it. M231 point -
@Chuckero It should already work that way if you call it with $lForce parameter equal True.1 point
-
Prevent too fast clicks
FrancescoDiMuro reacted to Nine for a topic
I believe it is useless to prevent up, that is why I did not manage it. But you are free to apply the same approach if need be. No, only down once. It is not like a keyboard that repeats on holding down Yes, some applications (like full screen games) manage the mouse in their own way, so it may interfere all together. As for another way to program this, I will let you experiment different alternatives. But like others told you before, the best approach to your problem is to have a decent working mouse device... Good luck.1 point -
Alright, I'll give you a hand on this : #include <WinAPIConstants.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", True) HotKeySet("!{ESC}", _Exit) ; Alt-Esc Global $hMouseProc, $hMouseHook OnAutoItExitRegister(_Cleanup) _Main() Func _Main() $hMouseProc = DllCallbackRegister(_MouseProc, "long", "int;wparam;lparam") $hMouseHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($hMouseProc), _WinAPI_GetModuleHandle(0)) While True Sleep(30) WEnd EndFunc ;==>_Main Func _MouseProc($nCode, $wParam, $lParam) Local Static $hTimerLeft Local $bFault If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hMouseHook, $nCode, $wParam, $lParam) Switch $wParam Case $WM_LBUTTONDOWN If Not $hTimerLeft Then $hTimerLeft = TimerInit() Else $bFault = TimerDiff($hTimerLeft) < 100 ; <<-<-<-<-<-<-<-<-<-<-<-<-<- pick the speep you want here $hTimerLeft = Null If $bFault Then Return 1 ; blocking EndIf Case $WM_RBUTTONDOWN ; complete this section if needed EndSwitch Return _WinAPI_CallNextHookEx($hMouseHook, $nCode, $wParam, $lParam) EndFunc ;==>_MouseProc Func _Cleanup() _WinAPI_UnhookWindowsHookEx($hMouseHook) DllCallbackFree($hMouseProc) EndFunc ;==>_Cleanup Func _Exit() Exit EndFunc ;==>_Exit1 point
-
Make Sure String Is Not In String
Musashi reacted to FrancescoDiMuro for a topic
@rm4453 When you need to set various filters on a data set, then you need to use the proper tools. In this case, StringInStr() needs to be very specific, since it is a good tool, but not the best for what you need. Then, as I told you above, if you don't define what you have and tell us what you want, we can't assist you.1 point -
Sure, but maybe you could first share the goals you have for these none working options? Jos1 point
-
Improving _ArrayDisplay speed
FrancescoDiMuro reacted to pixelsearch for a topic
Hi jpm I'm really glad to see you have the energy to rework the function and introduce Virtual views in it. It sure will be helpful for users who need to manage many thousands/millions of elements. Concerning the array range, it's not that easy to avoid fatal errors (which happen for example as soon as the user indicates a start row > array last row) but imho this array range checking can wait, so you can totally stay focused on integration of Virtual views in ArrayDisplay. If you're curious and look at the attachment in my previous post, I took away from main script all the array range checking code and placed it in a separate function, so it looks neater now and this is what's left in main code : ; Declare variables & flag to determine if range set Local $iItem_Start, $iItem_End, $iSubItem_Start, $iSubItem_End, $bRange_Flag = False ; Check for range settings $sMsg = __ArrayDisplay_CheckRange($sArrayRange, $iDimension, $iRowCount, $iColCount, _ $iItem_Start, $iItem_End, $iSubItem_Start, $iSubItem_End, $bRange_Flag) ; last 5 ByRef If $sMsg Then MsgBox($MB_TOPMOST, "Array Range >>> " & $sArrayRange & " <<< out of limits", $sMsg) Return SetError(10, 0, 0) EndIf ($sMsg had already been used and declared Local by M23/you before these lines) I hope that several users will test your final work, especially when you'll tell us you're finished and test time has come. Fingers crossed and good luck.1 point -
@pixelsearch & @Tick #include <GuiMenu.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Example() MsgBox(0, "", 'the end') Func Example() WinWait("[CLASS:Notepad]", "", 10) If Not WinExists("[CLASS:Notepad]") Then Return Local $hWnd = WinGetHandle("[CLASS:Notepad]") ControlFocus($hWnd, "", "Edit1") Send("{APPSKEY}") Local $0_PopUPhwnd = WinGetHandle("[CLASS:#32768]") Local $0_PopUPMenu = _SendMessage($0_PopUPhwnd, 0x01E1) Local $0_FindItem = _GUICtrlMenu_FindItem($0_PopUPMenu, 'Paste') _WinAPI_PostMessage( $hWnd, $WM_COMMAND, _GUICtrlMenu_GetItemID($0_PopUPMenu, $0_FindItem), 0 ) ;_WinAPI_PostMessage($0_PopUPhwnd, $WM_LBUTTONDBLCLK, 0, _WinAPI_MakeLong($x, $Y)) ;~ same as controlclick EndFunc ;==>Example1 point
-
Try replace to ControlClick ;~ _MouseLeftClick($hWnd, $aRect[0] + 3, $aRect[1] + 3) ControlClick($hWnd, "", "", "left", 1, $aRect[0] + 3, $aRect[1] + 3) Will anything change?1 point
-
Retrieve file list based on file modified time
seadoggie01 reacted to JockoDundee for a topic
ok, fair enough. totally understand. ngl, I also have accumulated many biases based on good or bad experiences, many without a rigorous examination. in this particular case, I’m wondering if your experience was related to last modified date of folders, or just files like the OP. there are many reports of frustration over the apparent lack of update to the LMD when a file is changed within a folder. however a folder LMD is updated only when it’s contents (meaning the list of files it contains), is altered.1 point -
I was bored. 😉 Here the shorter version using GDI/GDI+ #include <GDIPlus.au3> #include <winapi.au3> #include <windowsconstants.au3> Opt("GuiOnEventMode", 1) If Not FileExists(@ScriptDir&"\smiley.png") Then InetGet("http://msp5.photobucket.com/albums/y196/dannydude182/smiley-300x300.png", @ScriptDir&"\smiley.png") _GDIPlus_Startup() $image = _GDIPlus_ImageLoadFromFile(@ScriptDir&"\smiley.png") $w = _GDIPlus_ImageGetWidth($image) $h = _GDIPlus_ImageGetHeight($image) $hwnd = GUICreate("Test", $w, $h) Guisetbkcolor(0) GUISetState() GUISetOnEvent(-3, "close") $t = TimerInit() $hDC = _WinAPI_GetDC($hWnd) $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $w, $h) $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_ImageRotateFlip($image, 6) ; <<<<<==== needed function _GDIPlus_GraphicsDrawImageRect($hCanvas, $image , 0, 0, $w, $h) _WinAPI_BitBlt($hDC, 0, 0, $w, $h, $hDC_backbuffer, 0, 0, $SRCCOPY) ConsoleWrite(TimerDiff($t) & @CRLF) While 1 Sleep(20) WEnd Func close() _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hwnd, $hDC) _GDIPlus_ImageDispose($image) _GDIPlus_GraphicsDispose($hCanvas) _GDIPlus_Shutdown() Exit EndFunc ;==>close1 point
-
closing a MSgBox
seadoggie01 reacted to Nine for a topic
You can use the Run command with the parameter /AutoIt3ExecuteLine (see help file there is an exact example of what you could do). You can then close it whenever you want to since it is another process that you have launched. ps. cat beat me, where is @seadoggie01 when we need him1 point -
Here another way that is closer to your initial attempt : #include <GDIPlus.au3> #include <winapi.au3> #include <windowsconstants.au3> Opt("GuiOnEventMode", 1) If Not FileExists(@ScriptDir & "\smiley.png") Then InetGet("http://msp5.photobucket.com/albums/y196/dannydude182/smiley-300x300.png", @ScriptDir & "\smiley.png") _GDIPlus_Startup() $image = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\smiley.png") $w = _GDIPlus_ImageGetWidth($image) $h = _GDIPlus_ImageGetHeight($image) $hwnd = GUICreate("Test", $w, $h) GUISetBkColor(0) GUISetState() GUISetOnEvent(-3, "close") _GDIPlus_ImageRotateFlip($image, 6) ; <<<<==== needed function $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($image) _GDIPlus_ImageDispose($image) _GDIPlus_Shutdown() Local $hCompDC = _WinAPI_CreateCompatibleDC(0) _WinAPI_SelectObject($hCompDC, $hBitmap) $hGUI_DC = _WinAPI_GetDC($hwnd) $hGfxDC = _WinAPI_CreateCompatibleDC($hGUI_DC) Local $hDCbufferPtr, $hDCbufferHBmp $hDCbuffer = CreateBmp32($w, $h, $hDCbufferPtr, $hDCbufferHBmp) _WinAPI_BitBlt($hDCbuffer, 0, 0, $w, $h, $hCompDC, 0, 0, $SRCCOPY) ; draw image _WinAPI_BitBlt($hGUI_DC, 0, 0, $w, $h, $hDCbuffer, 0, 0, $SRCCOPY) ; show buffer on Canvas While 1 Sleep(20) WEnd Func close() _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteObject($hDCbufferHBmp) _WinAPI_DeleteDC($hCompDC) _WinAPI_ReleaseDC($hWND, $hGUI_DC) _WinAPI_DeleteDC($hGfxDC) _WinAPI_DeleteDC($hDCbuffer) Exit EndFunc ;==>close Func CreateBmp32($iWidth, $iHeight, ByRef $ptr, ByRef $hbmp) Local $tBIV5HDR = DllStructCreate($tagBITMAPV5HEADER) DllStructSetData($tBIV5HDR, 'bV5Size', DllStructGetSize($tBIV5HDR)) DllStructSetData($tBIV5HDR, 'bV5Width', $iWidth) DllStructSetData($tBIV5HDR, 'bV5Height', -$iHeight) DllStructSetData($tBIV5HDR, 'bV5Planes', 1) DllStructSetData($tBIV5HDR, 'bV5BitCount', 32) DllStructSetData($tBIV5HDR, 'biCompression', $BI_BITFIELDS) DllStructSetData($tBIV5HDR, 'bV5RedMask', 0x00FF0000) DllStructSetData($tBIV5HDR, 'bV5GreenMask', 0x0000FF00) DllStructSetData($tBIV5HDR, 'bV5BlueMask', 0x000000FF) DllStructSetData($tBIV5HDR, 'bV5AlphaMask', 0xFF000000) $hbmp = _WinAPI_CreateDIBSection(0, $tBIV5HDR, $DIB_RGB_COLORS, $ptr) Local $hCompDC = _WinAPI_CreateCompatibleDC(0) _WinAPI_SelectObject($hCompDC, $hbmp) Return $hCompDC EndFunc ;==>CreateBmp321 point
-
This is the GDI version to flip an image using _WinAPI_PlgBlt() #include <GDIPlus.au3> #include <winapi.au3> #include <windowsconstants.au3> Opt("GuiOnEventMode", 1) If Not FileExists(@ScriptDir&"\smiley.png") Then InetGet("http://msp5.photobucket.com/albums/y196/dannydude182/smiley-300x300.png", @ScriptDir&"\smiley.png") _GDIPlus_Startup() $image = _GDIPlus_ImageLoadFromFile(@ScriptDir&"\smiley.png") $w = _GDIPlus_ImageGetWidth($image) $h = _GDIPlus_ImageGetHeight($image) $hwnd = GUICreate("Test", $w, $h) Guisetbkcolor(0) GUISetState() GUISetOnEvent(-3, "close") $t = TimerInit() $hDC = _WinAPI_GetDC($hWnd) $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($image) $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) ;p1----p2 ;p3----| ;flip on horizotal axis Local $aPoint[3][2] ; 2 - A 180-degree rotation without flipping (No rotation, a horizontal flip followed by a vertical flip) ;~ $aPoint[0][0] = $w ;p1x ;~ $aPoint[0][1] = $h ;p1y ;~ $aPoint[1][0] = 0 ;p2x ;~ $aPoint[1][1] = $h ;p2y ;~ $aPoint[2][0] = $w ;p3x ;~ $aPoint[2][1] = 0 ;p3y ;6 - A 180-degree rotation followed by a horizontal flip (No rotation and a vertical flip) $aPoint[0][0] = 0 $aPoint[0][1] = $h $aPoint[1][0] = $w $aPoint[1][1] = $h $aPoint[2][0] = 0 $aPoint[2][1] = 0 _WinAPI_PlgBlt($hDC, $aPoint, $hDC_backbuffer, 0, 0, $w, $H) ConsoleWrite(TimerDiff($t) & @CRLF) While 1 Sleep(20) WEnd Func close() _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hwnd, $hDC) _GDIPlus_ImageDispose($image) _GDIPlus_Shutdown() Exit EndFunc ;==>close It should be faster than the GDIPlus version.1 point
-
Prevent too fast clicks
seadoggie01 reacted to water for a topic
I would replace the mouse. What makes you sure that your mouse still works tomorrow? Today it does double-clicks, tomorrow it could be dead 😒1 point -
Right! So just repair it by replacing the offending switch(es).1 point
-
Prevent too fast clicks
seadoggie01 reacted to Melba23 for a topic
sunToxx, Welcome to the AutoIt forums. Why not just buy a new mouse - they are pretty cheap in Germany: M231 point -
Thanks. I didn't realize that the JSON Arrays were "just arrays." Solution provided below for others. #Include "JSon.au3" Local $Json = '{"name":"John","cars":[ "Ford", "BMW", "Fiat", "Chevy" ]}' ;Correctly returns a count of 2 elements (name and cars) Local $Obj = JSon_Decode($Json) ConsoleWrite("count root: " & Json_ObjGetCount($Obj) & @CRLF) ;Returns error Variable must be of type "Object" ;Local $Cars = Json_ObjGet($Obj, '["cars"][0]') ;ConsoleWrite("count cars: " & Json_ObjGetCount($aCars) & @CRLF) ;Solution from TheDcoder Local $aCars = Json_Get($Obj, '["cars"]') ConsoleWrite("count cars: " & UBound($aCars) & @CRLF) ;Walking the array For $iCurrentCar = 0 To UBound($aCars) - 1 ;zero-based array ConsoleWrite("Car '" & $iCurrentCar & "' of '" & UBound($aCars) & "' is '" & _ Json_Get($Obj, '["cars"][' & $iCurrentCar & ']') & "'" & @CRLF) Next1 point