Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/11/2018 in all areas

  1. I'm new to autoit and need a little direction/help. For a game, I do not like pressing "Q" over and over again. I would rather just hold the Q down and release when I am done. Is it possible to distinguish between when I physically press the Q up/down on my keyboard AND when a Q up/down is sent/posted through autoit to a window? Thanks for the help NOTE: I realize that I could pick a different key, but I'm asking about the same key.
    2 points
  2. http://bfy.tw/IzjL Hope this helps.
    1 point
  3. E4A version 4.4 has arrived. The name of the game this time is bitmask support (see _Eigen_ConditMask*, now fully functional), notably: a new family of CwiseLogicalOp functions with which to perform BitAND, BitOR, BitXOR, and BitNot, with cell values internally (temporarily) converted to signed integers; masked-Set functions _Eigen_SetMaskedConstant*, for filling with a constant value only those cell/row/column contents for which a corresponding bitmask matrix cell contains unity; with new test script; masked-copy functions _Eigen_CopyMasked*, for copying only those cell/row/column contents for which a corresponding bitmask matrix cell contains unity; with new test script. Other new addenda include: conditional cellwise functions _Eigen_ConditAll_Block/Colwise/Diag/Rowwise and _Eigen_ConditAny_Block/Colwise/Diag/Rowwise; transformation functions _Eigen_Clamp*, to limit values to a specified range; with new test script; transformation functions _Eigen_Transpose_Vector/InPlace, for converting between RowVector and ColVector shapes (content unchanged); real and integer variants of _Eigen_CwiseScalarOp now also support quotient ("quot," specID 8) and modulo ("mod," specID 9); alias wrappers for quickly retrieving the sum and mean value for full matrix and all default parts: _Eigen_GetSumValue/Block/Col/Diag/Row and _Eigen_GetMeanValue/Block/Col/Diag/Row. More details in the ChangeLog (see Help file/online).
    1 point
  4. I am done with your moaning about the helpfile. It is not a learn but rather a reference/syntax document, but very complete for a freeware language with loads of examples. This topic is now closed and the next time you have any smart remark about the helpfile, you will get to know my 2x4 ( and no, I am not going to explain this) Jos
    1 point
  5. That tells us absolutely nothing. What are the things? Are they in a web browser, a desktop app, a game, etc.? What causes then to appear on screen (button click, page refresh, etc). Rather than expecting us to pull teeth, how about helping us help you by giving a decent description of what you are trying to accomplish?
    1 point
  6. 1 point
  7. Your post made no sense whatsoever, and added nothing to the discussion. Please think about what you're typing before you his Enter.
    1 point
  8. You can try these links for some ideas https://www.autoitscript.com/wiki/Moving_and_Resizing_PopUp_GUIs Or try some of the suggestions in this thread
    1 point
  9. A search of the forum yields 700+ results, and a search of Google many more. You went through all of those and found nothing at all?
    1 point
  10. This is what I use when working with JSON in AutoIt scripts.
    1 point
  11. InnI

    _XMLGetAttrib - SOLVED

    #include <XMLDomWrapper.au3> ; https://raw.githubusercontent.com/Silvernine0S/FolderMenu3EX/master/Include/_XMLDomWrapper_.au3 _XMLFileOpen("test.xml") If @error Then Exit MsgBox(0, "Error", $sXML_error) $sVal = _XMLGetAttrib("Panel", "STATUS") MsgBox(0, "Value", $sVal)
    1 point
  12. Little off topic story
    1 point
  13. This UDF was created because I found a simple approach to the currently available >_AppMon UDF. So please check out the example below and carefully read the headers on how to use the UDF. UDF: #include-once ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 ; #INDEX# ======================================================================================================================= ; Title .........: _AppMon ; AutoIt Version : v3.3.10.0 or higher ; Language ......: English ; Description ...: Monitor all open instances of your application(s). This includes PID, hWnd and start time of the application. ; Note ..........: ; Author(s) .....: guinness ; =============================================================================================================================== ; #INCLUDES# ==================================================================================================================== #include <StringConstants.au3> ; #GLOBAL VARIABLES# ============================================================================================================ Global Const $APPMON_GUID = 'F9A296EE-F58F-11E3-B354-006D0707A45E' Global Enum $APPMON_AUTOIT_TITLE, $APPMON_ID, $APPMON_TITLE, $APPMON_MAX ; #CURRENT# ===================================================================================================================== ; _AppMon_GetArray: Return an array of currently open applications, excluding the application calling this function. ; _AppMon_GetArrayAll: Return an array of currently open applications, including the application calling this function. ; _AppMon_Shutdown: Remove the current application from the AppMon list. This is to be called when the application exits. ; _AppMon_Start: Add the current application to the AppMon list. ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ; See below ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _AppMon_GetArray ; Description ...: Return an array of currently open applications, excluding the application calling this function. ; Syntax ........: _AppMon_GetArray(ByRef $aAppMon[, $fTimeString = Default]) ; Parameters ....: $aAppMon - [in/out] Handle created by _AppMon_Start(). ; $fTimeString - [optional] Convert the program start time to YYYY/MM/DD HH:MM:SS. Default is False (YYYYMMDDHHMMSS). ; Return values .: Success - An array containing a details about the running applications. ; Failure - Null & sets @error to non-zero. ; Author ........: guinness ; Remarks........: The array returned is two-dimensional and is made up as follows: ; $aArray[0][0] = PID ; $aArray[0][1] = hWnd of GUI (if previously set in _AppMon_Start().) ; $aArray[0][2] = Application start time string. ; ... ; $aArray[n][0] = PID ; $aArray[n][1] = hWnd of GUI (if previously set in _AppMon_Start().) ; $aArray[n][2] = Application start time string. ; Use UBound() to obtain the length of the array. ; Example .......: Yes ; =============================================================================================================================== Func _AppMon_GetArray(ByRef $aAppMon, $fTimeString = Default) Return __AppMon_Array($aAppMon, False, $fTimeString) EndFunc ;==>_AppMon_GetArray ; #FUNCTION# ==================================================================================================================== ; Name ..........: _AppMon_GetArrayAll ; Description ...: Return an array of currently open applications, including the application calling this function. ; Syntax ........: _AppMon_GetArrayAll(ByRef $aAppMon[, $fTimeString = Default]) ; Parameters ....: $aAppMon - [in/out] Handle created by _AppMon_Start(). ; $fTimeString - [optional] Convert the program start time to YYYY/MM/DD HH:MM:SS. Default is False (YYYYMMDDHHMMSS). ; Return values .: Success - An array containing a details about the running applications. ; Failure - Null & sets @error to non-zero. ; Author ........: guinness ; Remarks........: The array returned is two-dimensional and is made up as follows: ; $aArray[0][0] = PID ; $aArray[0][1] = hWnd of GUI (if previously set in _AppMon_Start()) ; $aArray[0][2] = Application start time string. ; ... ; $aArray[n][0] = PID ; $aArray[n][1] = hWnd of GUI (if previously set in _AppMon_Start()) ; $aArray[n][2] = Application start time string. ; Use UBound() to obtain the length of the array. ; Example .......: Yes ; =============================================================================================================================== Func _AppMon_GetArrayAll(ByRef $aAppMon, $fTimeString = Default) Return __AppMon_Array($aAppMon, True, $fTimeString) EndFunc ;==>_AppMon_GetArrayAll ; #FUNCTION# ==================================================================================================================== ; Name ..........: _AppMon_Shutdown ; Description ...: Remove the current application from the AppMon list. This is to be called when the application exits. ; Syntax ........: _AppMon_Shutdown(ByRef $aAppMon) ; Parameters ....: $aAppMon - [in/out and const] Handle created by _AppMon_Start(). ; Return values .: Success - True ; Failure - False ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _AppMon_Shutdown(ByRef $aAppMon) If UBound($aAppMon) = $APPMON_MAX And $aAppMon[$APPMON_ID] = $APPMON_GUID Then AutoItWinSetTitle($aAppMon[$APPMON_TITLE] & @AutoItPID) Local Const $hAutoItWnd = WinGetHandle($aAppMon[$APPMON_TITLE] & @AutoItPID) AutoItWinSetTitle($aAppMon[$APPMON_AUTOIT_TITLE]) Local Const $hControl = ControlGetHandle($hAutoItWnd, '', 'Edit1') ControlSetText($hAutoItWnd, '', $hControl, _ StringRegExpReplace(ControlGetText($hAutoItWnd, '', $hControl), _ '(?<=\n)\|APPMON_(?:HWND|PID|TIME):\V+\R', _ '')) For $i = 0 To $APPMON_MAX - 1 $aAppMon[$i] = Null Next EndIf Return True EndFunc ;==>_AppMon_Shutdown ; #FUNCTION# ==================================================================================================================== ; Name ..........: _AppMon_Start ; Description ...: Add the current application to the AppMon list. ; Syntax ........: _AppMon_Start([$sOccurenceName = Default[, $hGUI = Default]]) ; Parameters ....: $sOccurenceName - [optional] A string to identify the occurrence of the script with the unique id. Default is $APPMON_GUID. ; $hWnd - [optional] A valid GUI handle. Default is 0x0000000000000000 (no handle). ; Return values .: Handle to be passed to relevant functions. ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _AppMon_Start($sOccurenceName = Default, $hWnd = Default) Local $aAppMon[$APPMON_MAX] $aAppMon[$APPMON_ID] = $APPMON_GUID $aAppMon[$APPMON_TITLE] = $sOccurenceName If $aAppMon[$APPMON_TITLE] = Default Then $aAppMon[$APPMON_TITLE] = $APPMON_GUID Else $aAppMon[$APPMON_TITLE] = StringStripWS($aAppMon[$APPMON_TITLE], $STR_STRIPALL) EndIf $aAppMon[$APPMON_AUTOIT_TITLE] = AutoItWinGetTitle() AutoItWinSetTitle($aAppMon[$APPMON_TITLE] & @AutoItPID) Local Const $hAutoItWnd = WinGetHandle($aAppMon[$APPMON_TITLE] & @AutoItPID) AutoItWinSetTitle($aAppMon[$APPMON_TITLE]) Local Const $hControl = ControlGetHandle($hAutoItWnd, '', 'Edit1') ControlSetText($hAutoItWnd, '', $hControl, ControlGetText($hAutoItWnd, '', $hControl) & @CRLF & _ '|APPMON_PID:' & @AutoItPID & '|APPMON_HWND:' & (IsHWnd($hWnd) ? $hWnd : '0x0000000000000000') & '|APPMON_TIME:' & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & @CRLF) Return $aAppMon EndFunc ;==>_AppMon_Start ; #INTERNAL_USE_ONLY#============================================================================================================ Func __AppMon_Array(ByRef $aAppMon, $fIsIncludeCurrent, $fTimeString) Local $iError = 1, _ $vReturn = Null If UBound($aAppMon) = $APPMON_MAX And $aAppMon[$APPMON_ID] = $APPMON_GUID Then Local $aWinList = WinList('[TITLE:' & $aAppMon[$APPMON_TITLE] & ']') ; Don't include the current this process. If ($fIsIncludeCurrent And $aWinList[0][0] > 0) Or $aWinList[0][0] > 1 Then $iError = 0 Local Enum $eAPPMON_PID, $eAPPMON_WND, $eAPPMON_STARTTIME, $eAPPMON_MAX Local $aArray[$aWinList[0][0]][$eAPPMON_MAX], $aSRE = 0, _ $iIndex = 0 For $i = 1 To $aWinList[0][0] $aSRE = StringRegExp(ControlGetText($aWinList[$i][$eAPPMON_WND], '', ControlGetHandle($aWinList[$i][$eAPPMON_WND], '', 'Edit1')), _ '\|APPMON_PID:(\d+)\|APPMON_HWND:(0[xX][[:xdigit:]]+)\|APPMON_TIME:(\d{14})\R', $STR_REGEXPARRAYGLOBALMATCH) If UBound($aSRE) = $eAPPMON_MAX Then If Not $fIsIncludeCurrent And Number($aSRE[$eAPPMON_PID]) = @AutoItPID Then ContinueLoop $aArray[$iIndex][$eAPPMON_PID] = Int($aSRE[$eAPPMON_PID]) $aArray[$iIndex][$eAPPMON_WND] = HWnd($aSRE[$eAPPMON_WND]) $aArray[$iIndex][$eAPPMON_STARTTIME] = $aSRE[$eAPPMON_STARTTIME] If $fTimeString Then $aArray[$iIndex][$eAPPMON_STARTTIME] = StringRegExpReplace($aArray[$iIndex][$eAPPMON_STARTTIME], '(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})', '\1/\2/\3 \4:\5:\6') EndIf $iIndex += 1 EndIf Next ReDim $aArray[$iIndex][$eAPPMON_MAX] $vReturn = $aArray $aArray = 0 EndIf EndIf Return SetError($iError, 0, $vReturn) EndFunc ;==>__AppMon_Array Example 1: #include <Array.au3> #include <GUIConstantsEx.au3> #include '_AppMon.au3' Example() Func Example() Local $hGUI = GUICreate('', 400, 300, Random(0, @DesktopWidth - 400, 1), Random(0, @DesktopHeight - 350, 1)) Local $iCloseAll = GUICtrlCreateCheckbox('Close all instances.', 5, 272.5) GUICtrlSetState($iCloseAll, $GUI_CHECKED) Local $iAppMon = GUICtrlCreateButton('AppMon', 130, 270, 85, 25) Local $iRun = GUICtrlCreateButton('Run', 220, 270, 85, 25) Local $iClose = GUICtrlCreateButton('Close', 310, 270, 85, 25) GUISetState(@SW_SHOW, $hGUI) ; Add the current application to the AppMon list. Local $hAppMon = _AppMon_Start('SingletonExample', $hGUI) ; Get an array of the currently open applications not including this instance. Local $aAppMon = _AppMon_GetArray($hAppMon, True) WinSetTitle($hGUI, '', '[' & (UBound($aAppMon) + 1) & '] - PID: ' & @AutoItPID) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $iClose ExitLoop Case $iAppMon ; Get an array of the currently open applications including this instance. $aAppMon = _AppMon_GetArrayAll($hAppMon) _ArrayDisplay($aAppMon) Case $iRun If @Compiled Then Run(@ScriptFullPath, @WorkingDir) Else Run(@AutoItExe & ' "' & @ScriptFullPath & '"', @WorkingDir) EndIf EndSwitch WEnd ; Close all open applications if the checkbox is selected. If BitAND(GUICtrlRead($iCloseAll), $GUI_CHECKED) Then ; Get an array of the currently open applications not including this instance. $aAppMon = _AppMon_GetArray($hAppMon) For $i = 0 To UBound($aAppMon) - 1 ; Close the GUI handle. If WinExists($aAppMon[$i][1]) Then WinClose($aAppMon[$i][1]) Next EndIf ; Delete the GUI. GUIDelete($hGUI) ; Remove from the AppMon list. _AppMon_Shutdown($hAppMon) Return True EndFunc ;==>Example Example 2: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include '_AppMon.au3' Example() Func Example() Local $hGUI = GUICreate('', 400, 300, Random(0, @DesktopWidth - 400, 1), Random(0, @DesktopHeight - 350, 1)) Local $iCloseAll = GUICtrlCreateCheckbox('Close all instances.', 5, 272.5) GUICtrlSetState($iCloseAll, $GUI_CHECKED) Local $iRun = GUICtrlCreateButton('Run', 220, 270, 85, 25) Local $iClose = GUICtrlCreateButton('Close', 310, 270, 85, 25) GUISetState(@SW_SHOW, $hGUI) ; Array of the currently open applications. Local $aAppMon = 0 ; Add the current application to the AppMon list. Local $hAppMon = _AppMon_Start('SingletonExample', $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $iClose ExitLoop Case $iRun ; Get an array of the currently open applications not including this instance. $aAppMon = _AppMon_GetArrayAll($hAppMon) ; Allow only 2 concurrent instances of an application to be executed. If UBound($aAppMon) = 2 Then MsgBox($MB_SYSTEMMODAL, '', 'Total number of concurrent running applications has been reached.', 0, $hGUI) Else If @Compiled Then Run(@ScriptFullPath, @WorkingDir) Else Run(@AutoItExe & ' "' & @ScriptFullPath & '"', @WorkingDir) EndIf EndIf EndSwitch WEnd ; Close all open applications if the checkbox is selected. If BitAND(GUICtrlRead($iCloseAll), $GUI_CHECKED) Then ; Get an array of the currently open applications not including this instance. $aAppMon = _AppMon_GetArray($hAppMon) For $i = 0 To UBound($aAppMon) - 1 ; Close the GUI handle. If WinExists($aAppMon[$i][1]) Then WinClose($aAppMon[$i][1]) Next EndIf ; Delete the GUI. GUIDelete($hGUI) ; Remove from the AppMon list. _AppMon_Shutdown($hAppMon) Return True EndFunc ;==>Example All of the above has been included in a ZIP file. AppMonEx.zipPrevious download 260+.
    1 point
×
×
  • Create New...