Leaderboard
Popular Content
Showing content with the highest reputation on 09/11/2019 in all areas
-
GetOpt.au3 v1.3 If you've ever dabbled in C (or Python, Perl etc) then you might have heard of getopt() (Wiki entry). Well, I wrote this UDF to get that functionality into AutoIt. Some searching around here on the forum did turn up some other UDFs in this direction, but I decided to write my own port anyway and parallel the implementation in the C library. It's still missing a few things but on a whole it does the job really well. It's now pretty much complete. And I want to share it with you all. So here it is. If you want to handle the command line options passed to your script or program like a master, then this is the UDF for you! Main features: Parses DOS style options as well as GNU style options alike.Handles both short and long options.Define options that must have arguments when used.Define and handle suboptions (-s=foo,bar=quux,baz).Supports + and /- option modifiers.Casts string arguments to AutoIt variants, e.g. -a=yes becomes True.Easy access to any passed operand that's not an option.Some examples of invoking scripts: Script.au3 -a -b=10 --long-option file.txt Script.au3 /A /B:10 /Long-Option file.txtAs you see you can use both styles on the command line (as a matter of fact, at this moment you could even mix them but that wouldn't be good practice). In your script you just set the options you want to detect with _GetOpt_Set() and then iterate through each option with _GetOpt(). The 'file.txt' is available through _GetOpt_Oper(). See GetOpt-Example.au3 below for a step-by-step walkthrough of using GetOpt.au3. The UDF: GetOpt.au3 (+43) GetOpt-Example.au3: A demo of GetOpt.au3 #include <GetOpt.au3> #include <Array.au3> ; For demo purposes only. If 0 = $CmdLine[0] Then ; Create our own example command line. Run(FileGetShortName(@AutoItExe) & ' ' & FileGetShortName(@ScriptFullPath) & ' -a=no -b=42 -c=0.5 /Windows:' & @OSVersion & ' -z --required -s=foo,bar=quux,baz +p /-M -- -w=ignored Hello World!') Exit EndIf _GetOpt_Demo() Func _GetOpt_Demo() Local $sMsg = @ScriptName & ' for GetOpt v' & $GETOPT_VERSION & '.' & @CRLF & 'Parsing: ' & _ArrayToString($CmdLine, ' ', 1) & @CRLF & @CRLF; Message. Local $sOpt, $sSubOpt, $sOper ; Options array, entries have the format [short, long, default value] Local $aOpts[9][3] = [ _ ['-a', '--a-option', True], _ ['-b', '--b-option', False], _ ['-c', '--c-option', 'c option argument'], _ ['/W', '/Windows', 'windows style argument'], _ ; For demo purposes styles are mixed. ['-r', '--required', $GETOPT_REQUIRED_ARGUMENT], _ ; This option requires an argument. ['-s', '--suboption', $GETOPT_REQUIRED_ARGUMENT], _ ; option with suboptions. ['-p', '--plus', Default], _ ['/M', '/Minus', Default], _ ['-h', '--help', True] _ ] ; Suboptions array, entries have the format [suboption, default value] Local $aSubOpts[2][2] = [ _ ['foo', 47], _ ['bar', True] _ ] _GetOpt_Set($aOpts) ; Set options. If 0 < $GetOpt_Opts[0] Then ; If there are any options... While 1 ; ...loop through them one by one. ; Get the next option passing a string with valid options. $sOpt = _GetOpt('abcwr:s:pmh') ; r: means -r option requires an argument. If Not $sOpt Then ExitLoop ; No options or end of loop. ; Check @extended above if you want better error handling. ; The current option is stored in $GetOpt_Opt, it's index (in $GetOpt_Opts) ; in $GetOpt_Ind and it's value in $GetOpt_Arg. Switch $sOpt ; What is the current option? Case '?' ; Unknown options come here. @extended is set to $E_GETOPT_UNKNOWN_OPTION $sMsg &= 'Unknown option: ' & $GetOpt_Ind & ': ' & $GetOpt_Opt $sMsg &= ' with value "' & $GetOpt_Arg & '" (' & VarGetType($GetOpt_Arg) & ').' & @CRLF Case ':' ; Options with missing required arguments come here. @extended is set to $E_GETOPT_MISSING_ARGUMENT $sMsg &= 'Missing required argument for option: ' & $GetOpt_Ind & ': ' & $GetOpt_Opt & @CRLF Case 'a', 'b', 'c', 'w', 'p', 'm' $sMsg &= 'Option ' & $GetOpt_Ind & ': ' & $GetOpt_Opt $sMsg &= ' with value "' & $GetOpt_Arg & '" (' & VarGetType($GetOpt_Arg) & ')' If $GETOPT_MOD_PLUS = $GetOpt_Mod Then $sMsg &= ' and invoked with plus modifier (+' & $GetOpt_Opt & ')' ElseIf $GETOPT_MOD_MINUS = $GetOpt_Mod Then $sMsg &= ' and invoked with minus modifier (/-' & $GetOpt_Opt & ')' EndIf $sMsg &= '.' & @CRLF Case 'r' $sMsg &= 'Option ' & $GetOpt_Ind & ': ' & $GetOpt_Opt $sMsg &= ' with required value "' & $GetOpt_Arg & '" (' & VarGetType($GetOpt_Arg) & ')' If $GETOPT_MOD_PLUS = $GetOpt_Mod Then $sMsg &= ' and invoked with plus modifier (+' & $GetOpt_Opt & ')' ElseIf $GETOPT_MOD_MINUS = $GetOpt_Mod Then $sMsg &= ' and invoked with minus modifier (/-' & $GetOpt_Opt & ')' EndIf $sMsg &= '.' & @CRLF Case 's' $sMsg &= 'Option ' & $GetOpt_Ind & ': ' & $GetOpt_Opt $sMsg &= ' with required suboptions:' & @CRLF While 1 ; Loop through suboptions. $sSubOpt = _GetOpt_Sub($GetOpt_Arg, $aSubOpts) If Not $sSubOpt Then ExitLoop ; No suboptions or end of loop. ; Check @extended above if you want better error handling. ; The current suboption is stored in $GetOpt_SubOpt, it's index (in $GetOpt_SubOpts) ; in $GetOpt_SubInd and it's value in $GetOpt_SubArg. Switch $sSubOpt ; What is the current suboption? Case '?' $sMsg &= ' Unknown suboption ' & $GetOpt_SubInd & ': ' & $GetOpt_SubOpt $sMsg &= ' with value "' & $GetOpt_SubArg & '" (' & VarGetType($GetOpt_SubArg) & ').' & @CRLF Case 'foo', 'bar' $sMsg &= ' Suboption ' & $GetOpt_SubInd & ': ' & $GetOpt_SubOpt $sMsg &= ' with value "' & $GetOpt_SubArg & '" (' & VarGetType($GetOpt_SubArg) & ').' & @CRLF EndSwitch WEnd If $GETOPT_MOD_PLUS = $GetOpt_Mod Then $sMsg &= 'And invoked with plus modifier (+' & $GetOpt_Opt & ').' ElseIf $GETOPT_MOD_MINUS = $GetOpt_Mod Then $sMsg &= ' and invoked with minus modifier (/-' & $GetOpt_Opt & ')' EndIf Case 'h' MsgBox(0, 'GetOpt.au3', 'GetOpt.au3 example.' & @CRLF & _ 'Just try out some options and find out what happens!') Exit EndSwitch WEnd Else $sMsg &= 'No options passed.' & @CRLF EndIf $sMsg &= @CRLF If 0 < $GetOpt_Opers[0] Then ; If there are any operands... While 1 ; ...loop through them one by one. $sOper = _GetOpt_Oper() ; Get the next operand. If Not $sOper Then ExitLoop ; no operands or end of loop. ; Check @extended above if you want better error handling. $sMsg &= 'Operand ' & $GetOpt_OperInd & ': ' & $sOper & @CRLF WEnd Else $sMsg &= 'No operands passed.' & @CRLF EndIf MsgBox(0, @ScriptName, $sMsg) ; Let's see what we've got. _ArrayDisplay($GetOpt_Opts, '$GetOpt_Opts') _ArrayDisplay($GetOpt_Opers, '$GetOpt_Opers') _ArrayDisplay($GetOpt_ArgV, '$GetOpt_ArgV') Exit EndFunc Version 1.3: + Added support for -- (marks end of options). + Added support for + option modifiers e.g. +x. + Added support for /- option modifiers e.g. /-X. + Added _GetOpt_Sub to iterate through comma-separated suboptions like -s=a=foo,b=bar. * Changed $GETOPT_REQUIRED_ARGUMENT from keyword Default to Chr(127), keyword can now be used as an option argument. * Standardized comments and function headers. * Tidy-ed up source code. Version 1.2: + Support for required arguments with options, e.g. _GetOpt('ab:c') where -b=foo is valid and -b will return an error. + Added support for /C:foo (colon) when using DOS style. + Added optional auto-casting of arguments from Strings to AutoIt variants, e.g. -a=yes on the CLI would set the $GetOpt_Arg to True and not 'yes'. See __GetOpt_Cast. * Private __GetOpt_DOSToGNU to simplify code. Version 1.1: * Initial public release. If you encounter any bugs or have any suggestions, requests or improvements, then please let me know. Happy coding!2 points
-
[UDF] Gmail API - Emails automation with AutoIt!
coffeeturtle reacted to Ascer for a topic
1. Description. Automate communication with Gmail API using oAuth 2.0 security. 2. Requirements. Google Gmail account. Finished Authorization process. Look here 3. Possibilities. ;======================================================================================================================== ; Date: 2018-02-12, 11:46 ; ; Bug Fixs: 2018-02-17, 7:31 -> Fixed problems with adding items to array and minor bugs. ; ; Description: UDF for using Gmail API interface. This UDF requires oAuth.au3 and Gmail account. ; ; Function(s): ; gmailUsersGetProfile() -> Information about your account. ; gmailUsersLabelsList() -> Get all available labels ids. ex. "INBOX", "UNREAD" ; gmailUsersLabelsGet() -> Get information about specific label id. ; gmailUsersMessagesBatchDelete() -> Delete many messages emails by id. ; gmailUsersMessagesBatchModify() -> Set status for many messages ex. "INBOX", "UNREAD" ; gmailUsersMessagesDelete() -> Totaly delete email from ur account. ; gmailUsersMessagesGet() -> Get all information about specific email. ; gmailUsersMessagesList() -> Get list of last ~100 emails. ; gmailUsersMessagesModify() -> Modify single message. ; gmailUsersMessagesTrash() -> Put email in trash. ; gmailUsersMessagesUntrash() -> Restore email from trash. ; gmailUsersMessagesSend() -> Send email to single or group recipients. ; gmailUsersMessagesAttachmentsGet() -> Download attachment by id. ; ; Author(s): Ascer ;======================================================================================================================== 4. Downloads. oAuth.au3 Gmail API.au3 5. Examples. Sending emails1 point -
CallByName on COM Objects
Letraindusoir reacted to Bilgus for a topic
Trying to figure out how to do CallByName on AutoIt COM objects due to the lack of being able to set properties within an Execute() statement Several Ideas were Tried https://www.autoitscript.com/forum/topic/200129-set-object-properties-with-propertyname-and-value-taken-from-an-array/ I think this is the best; Patching the vtable of IDispatch so we can intercept a Fake function call ($obj.Au3_CallByName) use it like this Local $oDictionary = ObjCreate("Scripting.Dictionary") ; EXAMPLE Au3_CallByname_Init() ; (you can optionally provide a classname here but we patch the main Idispatch interface so really no need) $Au3_CallByName = "Add" ; Method we want to call $oDictionary.Au3_CallByName("Test", "Value") Au3_CallByname_Init(False) ; (Not Strictly Needed unhooked on exit) NOTE: Au3_CallByname_Init() doesn't have to be called at the top of the script, just call it before you need to call by name... Code + Example #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;Au3CallByName, Bilgus Global $Au3_CallByName = 0 Local $hKernel32 = DllOpen("Kernel32.dll") OnAutoItExitRegister(__CallByNameCleanup) Func __CallByNameCleanup() Au3_CallByName_Init(False) ;Unload DllClose($hKernel32) EndFunc ;==>__CallByNameCleanup ; Takes a pointer to the v-table in a class and replaces specified member Id in it to a new one. Func __HookVTableEntry($pVtable, $iVtableOffset, $pHook, ByRef $pOldRet) ;;https://www.autoitscript.com/forum/topic/107678-hooking-into-the-idispatch-interface/ Local Const $PAGE_READWRITE = 0x04 Local $tpVtable = DllStructCreate("ptr", $pVtable) Local $szPtr = DllStructGetSize($tpVtable) Local $pFirstEntry, $pEntry, $tEntry, $aCall, $flOldProtect, $bStatus ; Dereference the vtable pointer $pFirstEntry = DllStructGetData($tpVtable, 1) $pEntry = $pFirstEntry + ($iVtableOffset * $szPtr) ; Make the memory free for all. Yay! $aCall = DllCall($hKernel32, "int", "VirtualProtect", "ptr", $pEntry, "long", $szPtr, "dword", $PAGE_READWRITE, "dword*", 0) If @error Or Not $aCall[0] Then ConsoleWriteError("Error: Failed To hook vTable" & @CRLF) Return False EndIf $flOldProtect = $aCall[4] $tEntry = DllStructCreate("ptr", $pEntry) $pOldRet = DllStructGetData($tEntry, 1) If $pOldRet <> $pHook Then DllStructSetData($tEntry, 1, $pHook) $bStatus = True Else ;Already Hooked ConsoleWriteError("Error: vTable is already hooked" & @CRLF) $bStatus = False EndIf ;put the memory protect back how we found it DllCall($hKernel32, "int", "VirtualProtect", "ptr", $pEntry, "long", $szPtr, "dword", $flOldProtect, "dword*", 0) Return $bStatus EndFunc ;==>__HookVTableEntry ; Everytime autoit wants to call a method, get or set a property in a object it needs to go to ; IDispatch::GetIDsFromNames. This is our version of that function, note that by defining this ourselves ; we can fool autoit to believe that the object supports a lot of different properties/methods. Func __IDispatch_GetIDsFromNames($pSelf, $riid, $rgszNames, $cNames, $lcid, $rgDispId) Local Const $CSTR_EQUAL = 0x02 Local Const $LOCALE_SYSTEM_DEFAULT = 0x800 Local Const $DISP_E_UNKNOWNNAME = 0x80020006 Local Static $pGIFN = __Pointer_GetIDsFromNames() Local Static $tpMember = DllStructCreate("ptr") If $Au3_CallByName Then Local $hRes, $aCall, $tMember ;autoit only asks for one member $aCall = DllCall($hKernel32, 'int', 'CompareStringW', 'dword', $LOCALE_SYSTEM_DEFAULT, 'dword', 0, 'wstr', "Au3_CallByName", 'int', -1, _ 'struct*', DllStructGetData(DllStructCreate("ptr[" & $cNames & "]", $rgszNames), 1, 1), 'int', -1) If Not @error And $aCall[0] = $CSTR_EQUAL Then ;ConsoleWrite("CallByName: " & $Au3_CallByName & @CRLF) $tMember = DllStructCreate("wchar[" & StringLen($Au3_CallByName) + 1 & "]") DllStructSetData($tMember, 1, $Au3_CallByName) DllStructSetData($tpMember, 1, DllStructGetPtr($tMember)) $rgszNames = $tpMember $Au3_CallByName = 0 EndIf EndIf ;Call the original GetIDsFromNames $hRes = DllCallAddress("LRESULT", $pGIFN, "ptr", $pSelf, "ptr", $riid, _ "struct*", $rgszNames, "dword", $cNames, "dword", $lcid, "ptr", $rgDispId) If @error Then ConsoleWrite("Error: GetIDsFromNames: " & @error & @CRLF) Return $DISP_E_UNKNOWNNAME EndIf Return $hRes[0] EndFunc ;==>__IDispatch_GetIDsFromNames Func __Pointer_GetIDsFromNames($ptr = 0) Local Static $pOldGIFN = $ptr If $ptr <> 0 Then $pOldGIFN = $ptr Return $pOldGIFN EndFunc ;==>__Pointer_GetIDsFromNames Func Au3_CallByName_Init($bHook = True, $classname = "shell.application") Local Const $iOffset_GetIDsFromNames = 5 Local Static $IDispatch_GetIDsFromNames_Callback = 0 Local $oObject, $pObject, $pHook, $pOldGIFN If $bHook Then If $IDispatch_GetIDsFromNames_Callback = 0 Then $IDispatch_GetIDsFromNames_Callback = DllCallbackRegister("__IDispatch_GetIDsFromNames", "LRESULT", "ptr;ptr;ptr;dword;dword;ptr") EndIf $pHook = DllCallbackGetPtr($IDispatch_GetIDsFromNames_Callback) Else $pHook = __Pointer_GetIDsFromNames() If $pHook <= 0 Then Return ;Already Unloaded EndIf $oObject = ObjCreate($classname) $pObject = DllStructSetData(DllStructCreate("ptr"), 1, $oObject) If __HookVTableEntry($pObject, $iOffset_GetIDsFromNames, $pHook, $pOldGIFN) Then __Pointer_GetIDsFromNames($pOldGIFN) ;Save the original pointer to GetIDsFromNames If Not $bHook Then DllCallbackFree($IDispatch_GetIDsFromNames_Callback) $IDispatch_GetIDsFromNames_Callback = 0 EndIf Else ;Error EndIf $oObject = 0 EndFunc ;==>Au3_CallByName_Init ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;TESTS; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Au3_CallByName_Init() #include <ie.au3> Global $oRegistrationInfo = _IECreate() Global $aRegistrationInfo[] = ['Left=10', 'Top= 10', 'Width=450', 'Height=600'] Global $oObject = $oRegistrationInfo Local $oDictionary = ObjCreate("Scripting.Dictionary") Local $oDictionary2 = ObjCreate("Scripting.Dictionary") ;Au3_CallByName_Init($oObject) __TS_TaskPropertiesSet($oObject, $aRegistrationInfo) MsgBox(0, "Info", "Press OK to exit") $oRegistrationInfo.quit $oRegistrationInfo = 0 $oObject = 0 Sleep(1000) For $i = 1 To 10 $Au3_CallByName = "Add" $oDictionary.Au3_CallByName("test1:" & $i, "Dictionary Item: " & $i) Next $Au3_CallByName = "keys" For $sKey In $oDictionary.Au3_CallByName() For $j = 0 To 1 $Au3_CallByName = ($j = 0) ? "Item" : "Exists" ConsoleWrite($sKey & " -> " & $oDictionary.Au3_CallByName($sKey) & @CRLF) Next Next Au3_CallByName_Init(False) ;Unload Au3_CallByName_Init() Local $aRegistrationInfo[] = ['Left=1000', 'Width=450'] ConsoleWrite(@CRLF & "NEW IE" & @CRLF & @CRLF) $oRegistrationInfo = _IECreate() __TS_TaskPropertiesSet($oRegistrationInfo, $aRegistrationInfo) MsgBox(0, "Info", "Press OK to exit") $oRegistrationInfo.quit For $i = 1 To 10 $Au3_CallByName = "Add" $oDictionary2.Au3_CallByName("test2:" & $i, "Dictionary Item: " & $i) Next $Au3_CallByName = "keys" For $sKey In $oDictionary2.Au3_CallByName() For $j = 0 To 1 $Au3_CallByName = ($j = 0) ? "Item" : "Exists" ConsoleWrite($sKey & " -> " & $oDictionary2.Au3_CallByName($sKey) & @CRLF) Next Next Au3_CallByName_Init(False) ;Unload (Not Strictly Needed, Done on Script Close) Func __TS_TaskPropertiesSet(ByRef $oObject, $aProperties) Local $aTemp If IsArray($aProperties) Then For $i = 0 To UBound($aProperties) - 1 $aTemp = StringSplit($aProperties[$i], "=", 2) ; 2 -> $STR_NOCOUNT) If @error Then ContinueLoop ConsoleWrite("Command: $oObject." & $aTemp[0] & " = " & $aTemp[1] & @CRLF) $Au3_CallByName = $aTemp[0] $oObject.Au3_CallByName = $aTemp[1] ConsoleWrite("Result : " & Hex(@error) & @CRLF) ; If @error Then Return SetError(1, @error, 0) Next EndIf EndFunc ;==>__TS_TaskPropertiesSet1 point -
Try using FileFlush.1 point
-
Collecting data from rid
FrancescoDiMuro reacted to Mitya for a topic
Dear Melba23, I created a video, that might help to understand what is this app... What AutoIT info does with it is also included... https://youtu.be/SJAJONpYB1A1 point -
Introduction Since the introduction of ObjCreateInterface, AutoIt is able to create native, real objects. However, this is quite difficult for non-experienced users. This UDF here enables a "classic" syntax for declaring classes and instantiating objects from them. Before you ask: No, it is not just another preprocessor that's "faking" OOP syntax - this is the real deal. While it assists users with a more familiar syntax, objects are created at runtime. Care has been put into this UDF and it is in the authors interest to fix all bugs remaining and implement features as long as the result works in the Stable release of AutoIt. Features Define an unlimited number of classes.Create unlimited instances of objects.Create arrays of objects.Mix and match different data types in arrays (one or more elements can be objects).Define custom constructors and destructors.Pass an unlimited number of arguments to the constructor (even to all objects in one array at the same time).Automatic garbage collection.Compatible with Object-enabled AutoIt keywords (With etc.), optional parentheses on parameterless functions.Fully AU3Check enabled.IntelliSense catches class-names for auto-completion.Automatically generates a compilable version of the script.Non-instantated classes get optimzed away.Create C-style macros.Download Read the Tutorials - Download - Download (forum mirror) Please use the github issue tracker to report bugs or request features. Please read the tutorial before asking a question. Thanks!1 point
-
Reading a specific attribute of an IE element.
ComradVlad reacted to Danp2 for a topic
Take a look at _IEFormElementCheckBoxSelect in the help file. Have you tried with _IEGetObjByName? These fields are oddly named (probably because of some javascript framework), but I would try like this -- $oElement = _IEGetObjByName($oIE, "value(hhapc_ShowerPerform_Chk)")1 point -
Powershell and autoit command line - (Moved)
antonioj84 reacted to Melba23 for a topic
Moved to the appropriate forum. Moderation Team1 point -
No of course not, and you asking this question means you really do not understand what fileinstall does. Jos1 point
-
Collecting data from rid
FrancescoDiMuro reacted to Melba23 for a topic
Mitya, Thanks for the clarification - the Mod team will discuss the legality of the thread as it falls in a pretty grey area. We will get back to you ASAP. In the meantime, could you run the AutoIt3 Window Info tool on the GUI and post what information it gives you about the controls within - that will help us offer advice later if possible. Thanks for your understanding. Everyone else still keep out please. M231 point -
Setting Desktop Resolutions With Autoit?
Earthshine reacted to KaFu for a topic
Seems like your searching for the necromancers crown here☠️👑. #include <WinAPIGdiDC.au3> Global Const $_tag_POINTL = "long x;long y" Global Const $_tag_DEVMODE = "char dmDeviceName[32];ushort dmSpecVersion;ushort dmDriverVersion;short dmSize;" & _ "ushort dmDriverExtra;dword dmFields;" & $_tag_POINTL & ";dword dmDisplayOrientation;dword dmDisplayFixedOutput;" & _ "short dmColor;short dmDuplex;short dmYResolution;short dmTTOption;short dmCollate;" & _ "byte dmFormName[32];ushort LogPixels;dword dmBitsPerPel;int dmPelsWidth;dword dmPelsHeight;" & _ "dword dmDisplayFlags;dword dmDisplayFrequency" Local Const $DM_DISPLAYFREQUENCY = 0x00400000 Local Const $DM_PELSWIDTH = 0x00080000 Local Const $DM_PELSHEIGHT = 0x00100000 Local Const $DM_BITSPERPEL = 0x00040000 Local $DEVMODE = DllStructCreate($_tag_DEVMODE) DllStructSetData($DEVMODE, "dmSize", DllStructGetSize($DEVMODE)) DllStructSetData($DEVMODE, "dmPelsWidth", 1366) DllStructSetData($DEVMODE, "dmPelsHeight", 768) DllStructSetData($DEVMODE, "dmDisplayFrequency", 60) DllStructSetData($DEVMODE, "dmBitsPerPel", 8) DllStructSetData($DEVMODE, "dmFields", BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_DISPLAYFREQUENCY, $DM_BITSPERPEL)) Local Const $CDS_TEST = 0x00000002 Local Const $DISP_CHANGE_SUCCESSFUL = 0 Local $sDisplay = "\\.\DISPLAY1" Local $i_Res = DllCall("user32.dll", "int", "ChangeDisplaySettingsEx", "str", $sDisplay, "ptr", DllStructGetPtr($DEVMODE), "hwnd", 0, "int", $CDS_TEST, "ptr", 0) ConsoleWrite($i_Res[0] & @CRLF) If $i_Res[0] = $DISP_CHANGE_SUCCESSFUL Then #cs DISP_CHANGE_SUCCESSFUL = 0 DISP_CHANGE_RESTART = 1 DISP_CHANGE_FAILED = -1 DISP_CHANGE_BADMODE = -2 DISP_CHANGE_NOTUPDATED = -3 DISP_CHANGE_BADFLAGS = -4 DISP_CHANGE_BADPARAM = -5 DISP_CHANGE_BADDUALVIEW = -6 #ce $i_Res = DllCall("user32.dll", "int", "ChangeDisplaySettingsEx", "str", $sDisplay, "ptr", DllStructGetPtr($DEVMODE), "hwnd", 0, "int", 0, "ptr", 0) ; dwflags = 0 > The graphics mode for the current screen will be changed dynamically. EndIf1 point -
WebDriver UDF (W3C compliant version) - 2024/09/21
Danp2 reacted to DStraathof for a topic
Hi @Danp2, Works like a charm! Thanks.🙂1 point -
Collecting data from rid
FrancescoDiMuro reacted to Subz for a topic
@FrancescoDiMuro It appeared to be for a game rfactor2 @Mitya Forum doesn't support discussing game automation so you probably won't get any assistance with this, see Forum Rules for more info1 point -
FileInstall is a complex function, no way standard C++ would have support for something like it. The most portable way that I can think of is to use a small preprocessor tool/script which generates a C/C++ source file which contains your file (which needs to be embedded) in binary form in an array maybe... then you can manually use that array directly in your program to use it, or "extract" it by using one of the standard file writing functions1 point
-
I suspect since aut2exe is what performs the file embedding, and only compiled autoit script do the extraction, AutoItX will only do a file copy operation similar to an un-compiled script, if in fact the fileinstall is supported at all.1 point
-
AutoIt Windows Screenshooter v1.84 Build 2019-08-18
coffeeturtle reacted to UEZ for a topic
@coffeeturtle your examples runs properly on my Win10 machine with x86/x64. Both images are captured and opened without any issue. Which version of AutoIt are you using?1 point -
I assume the question is about FileInstall(), not FileDelete(). FileInstall is not a simple function and is handled in both aut2exe.exe and AutoIt3.exe: aut2exe will add the file to the PE header at compilation time. autoit3.exe will extract the file from the PE Header to the specified filename. Jos1 point
-
GetOpt: UDF to parse the command line
LukeSavefrogs reacted to dany for a topic
New version 1.3, see first post for download and a changelog.1 point -
MS Logparser SQL Engine In Autoit For those who remember Episode 1 , SQLite semi Embedded database functionality in AutIT. I want to introduce to you the next level of SQL integrated, on your Files System, using the MS LogParser. Let me first give you a small introduction of what the LogParser SQL engine is about. "Log parser is a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows® operating system such as the Event Log, the Registry, the file system, and Active Directory®. You tell Log Parser what information you need and how you want it processed. The results of your query can be custom-formatted in text based output, or they can be persisted to more specialty targets like SQL, SYSLOG, or a chart. The world is your database with Log Parser." This is a next step to the LINQ (Language Integrated Query) Concept . LINQ Concept MS LogParSer is a standalone command line tool, as well as a fully scriptable COM API. To get started you need to download it here : MS LogParser 2.2 The LogParser has a standard SQL syntax, extended with Expression and Functions. It is even possible to extend the functionalities with Custom PlugIns. Concept overview After installing, you need to register the "regsvr32 LogParser.dll", in order to run the examples from my next post. It has a small footprint and for this reason, it is a perfect marriage for AutoIT. "SQL is the name and AutoIT is the game."1 point