Leaderboard
Popular Content
Showing content with the highest reputation on 01/31/2019 in all areas
-
The snippets in this thread require the free tool osquery Hopefully I get better as this goes and the thread turns out useful. Lets begin.3 points
-
Using UI Automation Code in AutoIt
GicuPiticu and one other reacted to LarsJ for a topic
How to topics, 1 - 7 How to topics is a guide to use UIASpy to identify windows and controls and to create sample code to obtain information and perform actions. Topics 1 - 7: Introductory topics Top of next post (bottom of this post) Topics 8 - 15: Sample code creation Topics 16 - 17: Other How to topics How to perform UI Automation tasks How to use UIASpy to detect elements How to use UIASpy to create sample code How to create sample code through Detail info page How to create sample code through Sample code menu How to create sample code by copying listview rows How to create objects with ObjCreateInterface How to create UI Automation main objects How to identify and find application top window How to identify and find UI elements (controls) How to get UI element property values How to create element action objects How to get pattern property values How to perform element actions How to create executable code How to perform a mouse click in middle of bounding rectangle How to perform a control click via PostMessage and $UIA_AutomationIdPropertyId 1. How to perform UI Automation tasks UI Automation tasks are almost always performed in a top-down and step-by-step procedure. The task is divided into smaller sub-tasks that cannot be further divided. Each sub-task is performed in 2-4 steps. Clicking a button in a window is divided into 2 sub-tasks: Identify the window Identify and click the button The window that's identified in the first sub-task is used to identify the button in the second sub-task. Identifying the window is done in 2 steps: Create condition to identify the window Find the window based on the condition Identifying and clicking the button is done in 4 steps: Create condition to identify the button Find the button based on the condition Create an action to click the button Perform the action and click the button Here, the procedure is illustrated schematically: UIASpy can provide information to identify windows and controls and can generate sample code to implement the 2-4 steps. 2. How to use UIASpy to detect elements Open UIASpy. Click Left pane | Delete top windows to delete all treeview top windows. To detect a window, place the mouse cursor over the window title bar and press F2. To detect a control, place the mouse cursor over the control and press F1. Switch back to UIASpy window. 3. How to use UIASpy to create Sample code Through Sample code creation, you can more or less create all code in a simple automation task: Create UI Automation initial code Create condition and find application window Create condition and find control in window Get information about windows and controls Create pattern objects to perform actions Get information related to pattern objects Perform actions with pattern object methods Add a Sleep() statement if necessary In short, there are 3 ways to create sample code with UIASpy: Use the UIASpy Sample code main menu Right click a selected row in the Detail info listview page and Click Create sample code to create code based on selected row(s) Right click a selected row in the Detail info listview page or in a Sample code listview page and Click Copy to sample code to copy variable names and values to sample code (preferred) or Click Copy selected items to copy variable names and values to clipboard Then paste the code into an editor. 4. How to create sample code through Detail info page The Detail info listview page is also the default listview page. This makes sample code creation easy and fast. You can find a brief description with pictures and code snippets in the UIASpy thread. But not all code can be created this way. In many cases, there is a need to use the Sample code main menu. 5. How to create sample code through Sample code menu Much more code can be created through the Sample code menu than through the Detail info page. In addition, the menu can be used to set Sample code options and for Sample code maintenance. You can find a brief description with a picture in the UIASpy thread. 6. How to create sample code by copying listview rows To copy information from the Detail info listview page or a Sample code listview page into the editor right-click a selected row and click Copy to sample code: Paste the code into the editor: ; --- Copy element info --- ; $UIA_NativeWindowHandlePropertyId 0x00090244 7. How to create objects with ObjCreateInterface All objects needed in most automation tasks can be created using UIASpy sample code features. This is by far the easiest way to create the objects. There is really no need to create the objects in other ways. Top of post2 points -
Note: This is the continuation thread from the original one of 2012. The old one growed over 50 pages...so to make the overview better i created a new main thread for the ISN AutoIt Studio. You can find the old original thread here. The ISN AutoIt Studio is a complete IDE made with AutoIt, for AutoIt! It includes a GUI designer, a code editor (with syntax highlighting, auto complete & intelisense), a file viewer, a backup system and a lot more features!! Here are some screenshots: Here are some higlights: Easy to create/manage/public your AutoIt projects! Integrated GUI-Editor (ISN Form Studio 2) Integrated file & projectmanager Auto backupfunction for your Projects Extendable with plugins! Available in several languages Trophies Syntax highlighting /Autocomplete / Intelisense Macros Changelog manager for your project Detailed overview of the project (total working hours, total size...) Am integrated To-Do List for your project Open Source (You can download the source code from my website) And much much more!!! -> -> Click here to download ISN AutoIt Studio <- <- Here is the link to the german autoit forum where I posted ISN AutoIt Studio the first time: Link For more information visit my Homepage: https://www.isnetwork.at So, have fun with the ISN AutoIt Studio! And feel free to post your feedback, bugreports or ideas for this project here in this thread!1 point
-
settings and fonts (solved)
Verssuss reacted to JLogan3o13 for a topic
Just change the title in your first post...1 point -
Can't be that hard to click on the link in my Signature ...... but ok ...here you go for the correct link: https://www.autoitscript.com/site/autoit-script-editor/downloads/?new First download and install the full version and then try that again. Jos1 point
-
How to? AU3 --> C++
Xandy reacted to JLogan3o13 for a topic
There is no straight migration path from AutoIt to C++, they are two different languages with different syntax and capabilities. No magic button to convert; you have to understand both well enough to select the C++ equivalent for your AutoIt code.1 point -
the FlashCook.rar file attached to the above pointed post (https://www.autoitscript.com/forum/topic/83481-bass-function-library-sound-and-music-functions/?do=findComment&comment=1145132) contains a nice ready to be used example.1 point
-
Its a 2d array, so you need to use something like: Local $SourceEntry = _Excel_RangeRead($oWorkbook,Default,"A"&$SourceRow&":E"&$SourceRow) _ArrayDisplay($SourceEntry, "2D Display") ;--Displays array values correctly MsgBox(0,"Test","Test",$SourceEntry[0][1]) ;~ [0] equals row number [1] = column 1 Rather than copying one row at a time you can capture the all used A:E columns in an array and then perform actions on that array, example: Local $aSourceEntry = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("A:E")) _ArrayDisplay($aSourceEntry) For $i = 0 To UBound($aSourceEntry) - 1 MsgBox(4096, "", "Row: " & $i & @CRLF & _ "Column A: " & $aSourceEntry[$i][0] & @CRLF & _ "Column B: " & $aSourceEntry[$i][1] & @CRLF & _ "Column C: " & $aSourceEntry[$i][2] & @CRLF & _ "Column D: " & $aSourceEntry[$i][3] & @CRLF & _ "Column E: " & $aSourceEntry[$i][4]) Next1 point
-
Windows won't allow this as long as there is a program with a open handle to a file... Option C is probably your best bet if you force the operation.1 point
-
Interesting. I don't know, I'd have to start testing it. I'd start by testing: a; If I ever had the time and wanted to know.1 point
-
osquery
argumentum reacted to iamtheky for a topic
I'm about to resurrect this topic and dive this rabbit hole (not this thread specifically, I'll make my own). For those who want to play along: It looks like wmic but it got glasses and has a new haircut. https://osquery.io/downloads/official/3.3.0 documentation for the shell (sending some basic commands and getting data back is where i am starting) https://osquery.readthedocs.io/en/latest/introduction/using-osqueryi/1 point -
mmm I see. Check this example: #include <WinAPICom.au3> #include <Process.au3> #include <Array.au3> Opt("MustDeclareVars", 1) Global Const $CLSCTX_INPROC_SERVER = 0x01 + 0x02 + 0x04 + 0x10 Global Enum $eRender, $eCapture, $eAll, $EDataFlow_enum_count Global Enum $AudioSessionStateInactive, $AudioSessionStateActive, $AudioSessionStateExpired Global Const $eMultimedia = 1 Global Const $sCLSID_MMDeviceEnumerator = "{BCDE0395-E52F-467C-8E3D-C4579291692E}" Global Const $sIID_IMMDeviceEnumerator = "{A95664D2-9614-4F35-A746-DE8DB63617E6}" Global Const $sTagIMMDeviceEnumerator = _ "EnumAudioEndpoints hresult(int;dword;ptr*);" & _ "GetDefaultAudioEndpoint hresult(int;int;ptr*);" & _ "GetDevice hresult(wstr;ptr*);" & _ "RegisterEndpointNotificationCallback hresult(ptr);" & _ "UnregisterEndpointNotificationCallback hresult(ptr)" Global Const $sIID_IAudioMeterInformation = "{C02216F6-8C67-4B5B-9D00-D008E73E0064}" Global Const $sTagIAudioMeterInformation = "GetPeakValue hresult(float*);" & _ "GetMeteringChannelCount hresult(dword*);" & _ "GetChannelsPeakValues hresult(dword;float*);" & _ "QueryHardwareSupport hresult(dword*);" Global Const $sIID_IMMDevice = "{D666063F-1587-4E43-81F1-B948E807363F}" Global Const $sTagIMMDevice = _ "Activate hresult(clsid;dword;ptr;ptr*);" & _ "OpenPropertyStore hresult(dword;ptr*);" & _ "GetId hresult(wstr*);" & _ "GetState hresult(dword*)" Global Const $sIID_IAudioSessionManager2 = "{77aa99a0-1bd6-484f-8bc7-2c654c9a9b6f}" Global Const $sTagIAudioSessionManager = "GetAudioSessionControl hresult(ptr;dword;ptr*);" & _ "GetSimpleAudioVolume hresult(ptr;dword;ptr*);" Global Const $sTagIAudioSessionManager2 = $sTagIAudioSessionManager & "GetSessionEnumerator hresult(ptr*);" & _ "RegisterSessionNotification hresult(ptr);" & _ "UnregisterSessionNotification hresult(ptr);" & _ "RegisterDuckNotification hresult(wstr;ptr);" & _ "UnregisterDuckNotification hresult(ptr)" Global Const $sIID_IAudioSessionEnumerator = "{e2f5bb11-0570-40ca-acdd-3aa01277dee8}" Global Const $sTagIAudioSessionEnumerator = "GetCount hresult(int*);GetSession hresult(int;ptr*)" Global Const $sIID_IAudioSessionControl = "{f4b1a599-7266-4319-a8ca-e70acb11e8cd}" Global Const $sTagIAudioSessionControl = "GetState hresult(int*);GetDisplayName hresult(wstr*);" & _ "SetDisplayName hresult(wstr);GetIconPath hresult(wstr*);" & _ "SetIconPath hresult(wstr;ptr);GetGroupingParam hresult(ptr*);" & _ "SetGroupingParam hresult(ptr;ptr);RegisterAudioSessionNotification hresult(ptr);" & _ "UnregisterAudioSessionNotification hresult(ptr);" Global Const $sIID_IAudioSessionControl2 = "{bfb7ff88-7239-4fc9-8fa2-07c950be9c6d}" Global Const $sTagIAudioSessionControl2 = $sTagIAudioSessionControl & "GetSessionIdentifier hresult(wstr*);" & _ "GetSessionInstanceIdentifier hresult(wstr*);" & _ "GetProcessId hresult(dword*);IsSystemSoundsSession hresult();" & _ "SetDuckingPreferences hresult(bool);" Global $g_bExit = Not False Global $g_bIsRunning = False ;Program To start and Program to Close Global $_gAppToRun = "notepad.exe" Global $g_AppToFinish = "notepad.exe" HotKeySet("{ESC}", "_Exit") _WinAPI_CoInitialize() Local $aApp = 0 While $g_bExit $aApp = _GetAppsPlayingSound() _RunCloseAppIfSoundPlayingByProcessName("chrome.exe",$aApp) Sleep(100) WEnd _WinAPI_CoUninitialize() Func _RunCloseAppIfSoundPlayingByProcessName($sProcessName, $aApp) If Not $g_bIsRunning Then If _ArraySearch($aApp, $sProcessName)>-1 Then ShellExecute($_gAppToRun) $g_bIsRunning = True EndIf EndIf If $g_bIsRunning Then If _ArraySearch($aApp, $sProcessName)=-1 Then ProcessClose($g_AppToFinish) $g_bIsRunning = False EndIf EndIf EndFunc ;==>_RunCloseAppIfSoundPlayingByProcessName Func _Exit() $g_bExit = False EndFunc ;==>_Exit Func _GetAppsPlayingSound() Local $pIMMDevice = 0 Local $oMMDevice = 0 Local $pIAudioSessionManager2 = 0 Local $oIAudioSessionManager2 = 0 Local $pIAudioSessionEnumerator = 0 Local $oIAudioSessionEnumerator = 0 Local $nSessions = 0 Local $oMMDeviceEnumerator = 0 Local $aApp[0] Local $pIAudioSessionControl2 = 0 Local $oIAudioSessionControl2 = 0 Local $oIAudioMeterInformation = 0 Local $ProcessID = 0 Local $fPeakValue = 0 Local $iState = 0 Local $iVolume = 0 Local $oErrorHandler = 0 $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") $oMMDeviceEnumerator = ObjCreateInterface($sCLSID_MMDeviceEnumerator, $sIID_IMMDeviceEnumerator, $sTagIMMDeviceEnumerator) If @error Then Return $aApp If SUCCEEDED($oMMDeviceEnumerator.GetDefaultAudioEndpoint($eRender, $eMultimedia, $pIMMDevice)) Then ;eRender $oMMDevice = ObjCreateInterface($pIMMDevice, $sIID_IMMDevice, $sTagIMMDevice) $oMMDevice.Activate($sIID_IAudioSessionManager2, $CLSCTX_INPROC_SERVER, 0, $pIAudioSessionManager2) $oIAudioSessionManager2 = ObjCreateInterface($pIAudioSessionManager2, $sIID_IAudioSessionManager2, $sTagIAudioSessionManager2) $oIAudioSessionManager2.GetSessionEnumerator($pIAudioSessionEnumerator) $oIAudioSessionEnumerator = ObjCreateInterface($pIAudioSessionEnumerator, $sIID_IAudioSessionEnumerator, $sTagIAudioSessionEnumerator) $oIAudioSessionEnumerator.GetCount($nSessions) For $i = 0 To $nSessions - 1 $oIAudioSessionEnumerator.GetSession($i, $pIAudioSessionControl2) $oIAudioSessionControl2 = ObjCreateInterface($pIAudioSessionControl2, $sIID_IAudioSessionControl2, $sTagIAudioSessionControl2) $oIAudioSessionControl2.GetState($iState) If $iState = $AudioSessionStateActive Then $oIAudioSessionControl2.GetProcessId($ProcessID) $oIAudioMeterInformation = ObjCreateInterface($pIAudioSessionControl2, $sIID_IAudioMeterInformation, $sTagIAudioMeterInformation) $oIAudioSessionControl2.AddRef $oIAudioMeterInformation.GetPeakValue($fPeakValue) If $fPeakValue > 0 Then ReDim $aApp[UBound($aApp) + 1][2] $aApp[UBound($aApp) - 1][0] = _ProcessGetName($ProcessID) $aApp[UBound($aApp) - 1][1] = $fPeakValue EndIf EndIf $fPeakValue = 0 $iState = 0 $ProcessID = 0 $oIAudioMeterInformation = 0 $oIAudioSessionControl2 = 0 Next $oIAudioSessionEnumerator = 0 $oIAudioSessionManager2 = 0 $oMMDevice = 0 $oMMDeviceEnumerator = 0 If UBound($aApp) = 0 Then $aApp = 0 Return $aApp Else Return $aApp EndIf EndFunc ;==>_GetAppsPlayingSound Func SUCCEEDED($hr) Return ($hr >= 0) EndFunc ;==>SUCCEEDED ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc Saludos1 point
-
You can add multiple lines using _ArrayAdd Local $DataName[0] _ArrayAdd($DataName, "2|" & $sBaseFileName & "|" & $sUpdatedFileName)1 point
-
Return multiple data through a function
AndrewSchultz reacted to jchd for a topic
In this particular case, yes, technically, the caller may get them. But you can't pass back anything else than integers and doing so precludes using specific values for indicating error conditions in the callee function, restricting even more what you can "pass" back, not withstanding that you may have to introduce more error codes during the life of the function. So all in all, this isn't a generic enough way of returning user values. And it's dirty, hugly, bad practice.1 point -
Return multiple data through a function
AndrewSchultz reacted to JohnOne for a topic
How so James? If I return SetError(2664,2274,77592) am I not returning 3 values?1 point -
Return multiple data through a function
AndrewSchultz reacted to James for a topic
There is a hole in your logic.1 point -
Papyrus, You can remove the button from the taskbar by using the "parent" parameter when you create your GUI. If you do not have a parent, then you can use the ever-present, but hidden, AutoIt window: #include <GUIConstantsEx.au3> ; Create parent $hGUI = GUICreate("Parent", 500, 500) GUISetState() ; Use parent handle when creating child $hGUI_No_TaskBar_1 = GUICreate("Child", 200, 200, 100, 100, Default, Default, $hGUI) GUISetState() ; Or use the Autoit window $hGUI_No_TaskBar_2 = GUICreate("AutoIt Child", 200, 200, 200, 200, Default, Default, WinGetHandle(AutoItWinGetTitle())) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndI hope that helps. M231 point