Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/11/2015 in all areas

  1. I'm writing some build scripts for a Windows 10 build. One thing I want to do is optimise the build for a business desktop. And that means removing all the "toy" Windows Store apps that are reinstalled every time a new user is logged on. Zune Music - I'm looking at you. AppX packages are staged or provisioned in the Windows 10 image, and also installed per user as required. The PowerShell CmdLets are named Get-AppXProvisionedPackage and Get-AppXPackage respectively. To get a list of packages installed for the current user we run: Get-AppxPackage | Format-Wide -Property NameHere is the list returned by Windows 10 Enterprise: Microsoft.VCLibs.140.00 Microsoft.VCLibs.140.00 Microsoft.NET.Native.Framework.1.0 Microsoft.NET.Native.Framework.1.0 Microsoft.NET.Native.Runtime.1.0 Microsoft.NET.Native.Runtime.1.0 Microsoft.Windows.CloudExperienceHost Microsoft.AAD.BrokerPlugin Microsoft.Windows.ShellExperienceHost windows.immersivecontrolpanel Microsoft.Windows.Cortana Microsoft.AccountsControl Microsoft.BioEnrollment Microsoft.LockApp Microsoft.MicrosoftEdge Microsoft.Windows.AssignedAccessLockApp Microsoft.Windows.ContentDeliveryManager Microsoft.Windows.ParentalControls Microsoft.WindowsFeedback Microsoft.XboxGameCallableUI Microsoft.XboxIdentityProvider Windows.ContactSupport Windows.MiracastView Windows.PrintDialog Windows.PurchaseDialog microsoft.windowscommunicationsapps Microsoft.BingFinance Microsoft.BingWeather Microsoft.BingNews Microsoft.Getstarted Microsoft.Windows.Photos Microsoft.WindowsStore Microsoft.XboxApp Microsoft.WindowsCamera Microsoft.ZuneMusic windows.devicesflow Microsoft.WindowsAlarms Microsoft.SkypeApp Microsoft.ZuneVideo Microsoft.WindowsSoundRecorder Microsoft.WindowsPhone Microsoft.WindowsMaps Microsoft.WindowsCalculator Microsoft.People Microsoft.Office.OneNote Microsoft.MicrosoftSolitaireCollection Microsoft.MicrosoftOfficeHub Microsoft.BingSports Microsoft.Appconnector Microsoft.3DBuilderIt's interesting that some of the old desktop applications have been replaced by Universal AppX packages. For example, Windows Calculator. The list above just includes the AppX package name, there are more properties available: Get-AppXPackage Microsoft.WindowsCalculatorName : Microsoft.WindowsCalculator Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US Architecture : X64 ResourceId : Version : 10.1507.15010.0 PackageFullName : Microsoft.WindowsCalculator_10.1507.15010.0_x64__8wekyb3d8bbwe InstallLocation : C:\Program Files\WindowsApps\Microsoft.WindowsCalculator_10.1507.15010.0_x64__8wekyb3d8bbwe IsFramework : False PackageFamilyName : Microsoft.WindowsCalculator_8wekyb3d8bbwe PublisherId : 8wekyb3d8bbwe IsResourcePackage : False IsBundle : False IsDevelopmentMode : False Dependencies : {Microsoft.VCLibs.140.00_14.0.22929.0_x64__8wekyb3d8bbwe} Once you have package names you can use Remove-AppXPackage to uninstall for the user, and Remove-AppXProvisionedPackage to remove from the image, then you run SysPrep and the applications will not be installed for new users of that image. Most of the package names are fairly self explanatory, but each package can contain multiple applications. It's not obvious that the "toy" Windows Mail application is included in the microsoft.windowscommunicationsapps package. Here is a PowerShell script that cycles through all the packages and shows the applications inside: $packages = Get-AppxPackage foreach ( $package in $packages ) { Write-host "Package: $($package.Name)" $manifests = Get-AppxPackageManifest -Package $package foreach ($manifest in $manifests) { foreach($app in $manifest.Package.Applications.Application) { Write-Host " Id: $($app.Id)" Write-Host " Executable: $($app.Executable)" } } Write-Host }Example output for microsoft.windowscommunicationsapps: Package: microsoft.windowscommunicationsapps Id: microsoft.windowslive.mail Executable: HxMail.exe Id: microsoft.windowslive.calendar Executable: HxCalendarAppImm.exe The Id gives you a good idea of the individual applications, but I imagine there is a way to get the proper Start Menu display name. Need to do a little more digging though.
    2 points
  2. A simple example of listing installed applications using ObjCreateInterface. Update. 10/09/2014 ;Danyfirex 06/09/2014 #include <Array.au3> Opt("MustDeclareVars", 1) Global Const $sTagAppInfoData = "UINT cbSize;UINT dwMask;ptr pszDisplayName;ptr pszVersion;ptr pszPublisher;ptr pszProductID;" & _ "ptr pszRegisteredOwner;ptr pszRegisteredCompany;ptr pszLanguage;ptr pszSupportUrl;ptr pszSupportTelephone;" & _ "ptr pszHelpLink;ptr pszInstallLocation;ptr pszInstallSource;ptr pszInstallDate;ptr pszContact;ptr pszComments;" & _ "ptr pszImage;ptr pszReadmeUrl;ptr pszUpdateInfoUrl" Global Const $sCLSID_EnumInstalledApps = "{0B124F8F-91F0-11D1-B8B5-006008059382}" Global Const $sIID_IEnumInstalledApps = "{1BC752E1-9046-11D1-B8B3-006008059382}" Global Const $sTagIEnumInstalledApps = "Next hresult(ptr*);Reset hresult();" Global Const $sIID_IShellApp = "{A3E14960-935F-11D1-B8B8-006008059382}" Global Const $sShellApp = "GetAppInfoData hresult(ptr);" Global Const $AIM_DISPLAYNAME = 0x00000001 Global Const $AIM_VERSION = 0x00000002 Global Const $AIM_PUBLISHER = 0x00000004 Global Const $AIM_PRODUCTID = 0x00000008 Global Const $AIM_REGISTEREDOWNER = 0x00000010 Global Const $AIM_REGISTEREDCOMPANY = 0x00000020 Global Const $AIM_LANGUAGE = 0x00000040 Global Const $AIM_SUPPORTURL = 0x00000080 Global Const $AIM_SUPPORTTELEPHONE = 0x00000100 Global Const $AIM_HELPLINK = 0x00000200 Global Const $AIM_INSTALLLOCATION = 0x00000400 Global Const $AIM_INSTALLSOURCE = 0x00000800 Global Const $AIM_INSTALLDATE = 0x00001000 Global Const $AIM_CONTACT = 0x00004000 Global Const $AIM_COMMENTS = 0x00008000 Global Const $AIM_IMAGE = 0x00020000 Global Const $AIM_READMEURL = 0x00040000 Global Const $AIM_UPDATEINFOURL = 0x00080000 Local $aArray = GetInstalledApps(BitOR($AIM_DISPLAYNAME, $AIM_INSTALLDATE)) _ArrayDisplay($aArray, "GetInstalledApps", Default, Default, Default, "NAME|INSTALLDATE") $aArray = GetInstalledApps(BitOR($AIM_DISPLAYNAME, $AIM_UPDATEINFOURL)) _ArrayDisplay($aArray, "GetInstalledApps", Default, Default, Default, "DISPLAYNAME|UPDATEINFOURL") $aArray = GetInstalledApps(BitOR($AIM_DISPLAYNAME, $AIM_INSTALLDATE, $AIM_INSTALLLOCATION)) _ArrayDisplay($aArray, "GetInstalledApps", Default, Default, Default, "DISPLAYNAME|INSTALLLOCATION|INSTALLDATE") Func GetInstalledApps($iMask = $AIM_DISPLAYNAME) Local $oEnumInstalledApps = ObjCreateInterface($sCLSID_EnumInstalledApps, $sIID_IEnumInstalledApps, $sTagIEnumInstalledApps) If @error Then Return 0 Local $pShellApp = 0 Local $oShellApp = 0 Local $AppInfoData = DllStructCreate($sTagAppInfoData) Local $pAppInfoData = DllStructGetPtr($AppInfoData) Local $i = 0 Local $aArray[0][0] Local $iF = 1 Local $tData = 0 Local $sData = "" Local $aMax = nCol($iMask) While $oEnumInstalledApps.Next($pShellApp) = 0 And $pShellApp <> 0 $oShellApp = ObjCreateInterface($pShellApp, $sIID_IShellApp, $sShellApp) If @error Then Return 0 DllStructSetData($AppInfoData, "cbSize", DllStructGetSize($AppInfoData)) DllStructSetData($AppInfoData, "dwMask", $iMask) $oShellApp.GetAppInfoData($pAppInfoData) ReDim $aArray[$iF][UBound($aMax)] For $i = 0 To UBound($aMax) - 1 $tData = DllStructCreate("wchar[260]", DllStructGetData($AppInfoData, $aMax[$i] + 2)) $sData = DllStructGetData($tData, 1) If $aMax[$i] = 13 Then $sData = StringMid($sData, 7, 2) & "/" & StringMid($sData, 5, 2) & "/" & StringMid($sData, 1, 4) $aArray[$iF - 1][$i] = ($sData = "0") ? "" : $sData DllStructSetData($tData, 1, "") Next $oShellApp = Null $iF += 1 WEnd $oEnumInstalledApps = Null Return $aArray EndFunc ;==>GetInstalledApps Func nCol($iMask) Local $aFlag[18] = [$AIM_DISPLAYNAME, $AIM_VERSION, $AIM_PUBLISHER, $AIM_PRODUCTID, $AIM_REGISTEREDOWNER, $AIM_REGISTEREDCOMPANY, _ $AIM_LANGUAGE, $AIM_SUPPORTURL, $AIM_SUPPORTTELEPHONE, $AIM_HELPLINK, $AIM_INSTALLLOCATION, $AIM_INSTALLSOURCE, _ $AIM_INSTALLDATE, $AIM_CONTACT, $AIM_COMMENTS, $AIM_IMAGE, $AIM_READMEURL, $AIM_UPDATEINFOURL] Local $iCol = 0 Local $x = 0 Local $aCol[18] For $i = 0 To UBound($aFlag) - 1 If BitAND($iMask, $aFlag[$i]) Then $aCol[$x] = $i + 1 $x += 1 EndIf Next ReDim $aCol[$x] Return $aCol EndFunc ;==>nCol Saludos
    1 point
  3. Just came across this library on GitHub and just thought how awesome it was that I had to tell the community. PHPJS: https://github.com/kvz/phpjs
    1 point
  4. For the concept, try this Case $hFinddAllButton If Not FileExists($file) Then MsgBox(48, "Error", "test.ini not found!") EndIf $sections = IniReadSectionNames($file) $test = GuiCtrlRead($hSearchInput) ; read the search input For $i = 1 to $sections[0] ; loop through sections $tmp = IniRead($file, $sections[$i], "1", "not found") ; read key named "1" If StringInStr($tmp, $test) Then GUICtrlSetData($hList, "[" & $sections[$i] & "] " & $tmp) Next You will have to add some error checking ... and look again in the helpfile for all the Ini* functions
    1 point
  5. ExitLoop exits the current loop, if its a Function you can use Return, and there is alwasy Exit to exit the entire script. I used Exitloop in that first loop to take you into a second loop that stops the function if your still holding the hotkey. Not until you release the hotkey is the second loop exited, and upon exit it reasigns the hotkey so that you can launch the function again.
    1 point
  6. @KaFu work correctly (Toggle option was tested just with recording devices, because I have just one Playback device) Saludos
    1 point
  7. Melba23

    error

    samtan117, Unfortunately you appear not to have read the Forum rules since your arrival. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. M23 P.S. To post code use Code tags - see here how to do it.
    1 point
  8. of course yes. $Calculation = InputBox( "Calculator", "Enter Your Calculation Here:", "", " M") MsgBox(0,"",Execute($Calculation)) Saludos
    1 point
  9. That's it. And where do you find this information (except for user written UDFs)? In the Help File
    1 point
  10. Make your own version of the UDF. Problem solved.
    1 point
  11. uncompiled & compiled without compatibility: both return 0x0A00 compiled with compatibility: __WINVER_GetVersionExW returns 0x0603 __WINVER_RtlGetVersion returns 0x0A00
    1 point
  12. Windows 10 Pro, build 10240 (running as VM, of course). AutoIt v3.3.14.1 all results +0x0A00 tested: (1) uncompiled, (2) compiled without pragma compatilbility Win10, (3) compiled with pragma compatilbility Win10 EDIT: same tests indicate 0x0601 on Windows 7. EDIT: 0x0604 (=6.4) is the "Technical Preview". 0x0A00 (=10.0) is the RTM (build 10240 or later) EDIT: the registry still insists on 6.3 - Boo! WTF MS couldn't just put things right?! what's wrong with them?!
    1 point
  13. Glad I could help (© M23) BTW FormTitles.txt looks the same but is not exactly the same Example : there was a missing space in "Drawing Title : (Match Drawing Title)" and as regex require a perfect accuracy such a typo is enough to make the whole thing fail...
    1 point
  14. Melba23

    Column Format

    Hobbyist, I did something very similar in _ArrayDisplay, so not too difficult to recreate it in this simpler form: #include <GUIConstantsEx.au3> #include <GuiListView.au3> $hGUI = GUICreate("Test", 500, 500) $cLV = GUICtrlCreateListView("", 10, 10, 400, 200) _GUICtrlListView_AddColumn($cLV, "Column 0", 90) _GUICtrlListView_AddColumn($cLV, "Column 1", 90) _GUICtrlListView_AddColumn($cLV, "Column 2", 90) _GUICtrlListView_AddColumn($cLV, "Column 3", 0) _GUICtrlListView_AddColumn($cLV, "Column 4", 90) For $i = 0 To 9 GUICtrlCreateListViewItem("Item " & $i & "-0|Item " & $i & "-1|Item " & $i & "-2||Item " & $i & "-4", $cLV) Next $cFormat = GUICtrlCreateButton("Format", 10, 450, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cFormat ; Final result $sFormatted = "" ; Loop through lines For $i = 0 To _GUICtrlListView_GetItemCount($cLv) - 1 ; Get line content $aLine = _GUICtrlListView_GetItemTextArray($cLV, $i) ; Loop through columns For $j = 1 To $aLine[0] ; For each column $sText = $aLine[$j] ; set default width $iWidth = 10 ; Adjust according to column number - remember to use 1-based element, not 0-based column Switch $j Case 1 ; Column 0 - increase width $iWidth = 30 Case 4 ; Column 3 - ignore ContinueLoop EndSwitch ; Check how many spaces to add $iAdd = $iWidth - StringLen($sText) For $k = 1 To $iAdd $sText &= " " Next ; Add result to final result $sFormatted &= $sText Next ; Create new line $sFormatted &= @CRLF Next ; Display result ConsoleWrite($sFormatted & @CRLF) EndSwitch WEndPlease ask if you have any questions. M23
    1 point
  15. The AutoIt installer registers some cmdlets for AutoItX. https://www.autoitconsulting.com/site/scripting/autoit-cmdlets-for-windows-powershell/
    1 point
  16. AndyG

    Reading assembly Code

    Now i am pretty sure that you have no idea of what you are talking about.... Do you have ever written some lines "Assembly"? And how could that solve your problem even if you would use the fasm.dll? Makes all no sense to me. Btw. If you want to try Assembly in combination with an AutoIt-Script, try AssembleIt. You will find it in the german forum. Debugger included.
    1 point
  17. ? #Include <Array.au3> $source = BinaryToString(InetRead("http://www.hearthhead.com/card=374/ragnaros-the-firelord")) $res = StringRegExp($source, '(?s)(?:cardsoundlink.*?<i>([^<]+))+', 3) _ArrayDisplay($res)
    1 point
  18. I imagine it may because you have multiple processes with the same name and just using the process name will not close each different PID. To work around that you can do something like this. Local $sString = "name" Local $list = ProcessList() For $i = 1 To $list[0][0] If StringRegExp($list[$i][0], "^" & $sString & "\d+\.exe$") Then ProcessClose($list[$i][1]) NextOr if you suck at RegEx like me StringinStr() works as well. Local $list = ProcessList() For $i = 1 To $list[0][0] If StringinStr($list[$i][0], "notepad") Then ProcessClose($list[$i][1]) NextYou can test what I am talking about by changing the last "1" in the ProcessClose() to 0 and then it closes the process by name instead of PID, open more than one notepad and you will see it close one instead of all of them.
    1 point
  19. horphi, Use GUICtrlRead to get the content of the edit and then use StringSplit to break that into lines. You can then access the second line easily: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> $sData = "Line 1" & @CRLF & "Line 2" & @CRLF & "Line 3" $hGUI = GUICreate("Test", 500, 500) $cEdit = GUICtrlCreateEdit($sData, 10, 10, 200, 200) $cGo = GUICtrlCreateButton("Extract", 10, 300, 80, 30) GUICtrlSetState($cGo, $GUI_FOCUS) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cGo $sText = GUICtrlRead($cEdit) $aLines = StringSplit($sText, @CRLF, $STR_ENTIRESPLIT) ; Look in help file to see why you need the constant MsgBox($MB_SYSTEMMODAL, "Extracted", $aLines[2]) EndSwitch WEndPlease ask if you have any questions. M23
    1 point
  20. If I got what you meant I edit your code and Got this: #include <WindowsConstants.au3> #include <GUIConstants.au3> #include <APISysConstants.au3> #include <WinAPI.au3> #include <GUIMenu.au3> #include <WinAPIProc.au3> #include <WinAPISys.au3> #include <GDIPlus.au3> #include <WinAPIShellEx.au3> Global Const $hOLEACC = DllOpen("oleacc.dll") Global Const $hOleAut = DllOpen("oleaut.dll") Global Const $stagVARIANT = "ushort vt;ushort r1;ushort r2;ushort r3;ptr data; ptr" Global $tVar = DllStructCreate($stagVARIANT) Global $pvarChild = DllStructGetPtr($tVar) Global Const $sIID_IAccessible = "{618736e0-3c3d-11cf-810c-00aa00389b71}" ; https://www.autoitscript.com/forum/topic/164271-detect-when-any-and-all-windows-have-moved/?do=findComment&comment=1198129 Global $hEventProc = DllCallbackRegister(_EventProc, "none", "ptr;dword;hwnd;long;long;dword;dword") Global $hEventHook = _WinAPI_SetWinEventHook($EVENT_MIN, $EVENT_MAX, DllCallbackGetPtr($hEventProc)) OnAutoItExitRegister(OnAutoItExit) ; clear the hook on exit Global $oMyError = ObjEvent("AutoIt.Error", "_ErrFunc") Global $hMainWin = GUICreate('My main GUI', 400, 250, 50, 50) GUISetState(@SW_SHOW) _GDIPlus_Startup() $hGUI_Child0 = GUICreate('Notepad', 100, 100, 10, 0, $WS_POPUPWINDOW, BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE)) $aHostDim = WinGetClientSize($hGUI_Child0) ; a 2-element array containing Width and Height of window's client area (inner area excluding borders). $hIcon0 = _WinAPI_ShellExtractIcon('notepad.exe', 0, $aHostDim[0], $aHostDim[1]) $hBitmap0 = _GDIPlus_BitmapCreateFromHICON($hIcon0) Global $g_hGraphic0 = _GDIPlus_GraphicsCreateFromHWND($hGUI_Child0) GUISetState(@SW_SHOW, $hGUI_Child0) _WinAPI_SetParent($hGUI_Child0, $hMainWin) ; trap this child gui within the main gui ; $hGUI_Child1 = GUICreate('Folder', 100, 100, 25, 15, $WS_POPUPWINDOW, BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE)) $aHostDim = WinGetClientSize($hGUI_Child1) $hIcon1 = _WinAPI_ShellExtractIcon('explorer.exe', 0, $aHostDim[0], $aHostDim[1]) $hBitmap1 = _GDIPlus_BitmapCreateFromHICON($hIcon1) Global $g_hGraphic1 = _GDIPlus_GraphicsCreateFromHWND($hGUI_Child1) GUISetState(@SW_SHOW, $hGUI_Child1) _WinAPI_SetParent($hGUI_Child1, $hMainWin) $hGUI_Child2 = GUICreate('Calc', 100, 100, 40, 30, $WS_POPUPWINDOW, BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE)) $hIcon2 = _WinAPI_ShellExtractIcon('Calc.exe', 0, $aHostDim[0], $aHostDim[1]) $hBitmap2 = _GDIPlus_BitmapCreateFromHICON($hIcon2) Global $g_hGraphic2 = _GDIPlus_GraphicsCreateFromHWND($hGUI_Child2) GUISetState(@SW_SHOW, $hGUI_Child2) _WinAPI_SetParent($hGUI_Child2, $hMainWin) GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove") ;~ Paint first _GDIPlus_GraphicsDrawImage($g_hGraphic0, $hBitmap0, 0, 0) _GDIPlus_GraphicsDrawImage($g_hGraphic1, $hBitmap1, 0, 0) _GDIPlus_GraphicsDrawImage($g_hGraphic2, $hBitmap2, 0, 0) VariantInit($pvarChild) MsgBox(0, "Pause", "Drag images on the Main GUI" & @CRLF & "Click OK to end") _GDIPlus_GraphicsDispose($g_hGraphic0) _GDIPlus_GraphicsDispose($g_hGraphic1) _GDIPlus_GraphicsDispose($g_hGraphic2) _GDIPlus_BitmapDispose($hBitmap0) _GDIPlus_BitmapDispose($hBitmap1) _GDIPlus_BitmapDispose($hBitmap2) _GDIPlus_Shutdown() DllClose($hOleAut) DllClose($hOLEACC) ;~ Just for Move Func _WinMove($HWnd, $Command, $wParam, $lParam) If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0) EndFunc ;==>_WinMove ; Draw PNG image Func MY_WM_PAINT($HWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _WinAPI_RedrawWindow($hMainWin, 0, 0, $RDW_UPDATENOW) _GDIPlus_GraphicsDrawImage($g_hGraphic0, $hBitmap0, 0, 0) _GDIPlus_GraphicsDrawImage($g_hGraphic1, $hBitmap1, 0, 0) _GDIPlus_GraphicsDrawImage($g_hGraphic2, $hBitmap2, 0, 0) _WinAPI_RedrawWindow($hMainWin, 0, 0, $RDW_VALIDATE) Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_PAINT Func _EventProc($hEventHook, $iEvent, $HWnd, $iObjectID, $iChildID, $iThreadId, $iEventTime) #forceref $hEventHook, $iObjectID, $iChildID, $iThreadId, $iEventTime ; Static $lastevent ; https://msdn.microsoft.com/en-us/library/windows/desktop/dd318066%28v=vs.85%29.aspx Local $aWin = 0 Switch $iEvent Case $EVENT_SYSTEM_MOVESIZESTART ; ConsoleWrite("Start:" & @TAB & $iEvent & @TAB & $hWnd & @TAB & $iObjectID & @TAB & $iChildID & @CRLF) Case $EVENT_SYSTEM_MOVESIZEEND ; to be used as drop If _WinAPI_GetAncestor($HWnd) = $hMainWin Then $aWin = WinGetPos($HWnd) If IsArray($aWin) Then ConsoleWrite(WinGetTitle($HWnd) & " dropped on " & _GetWindows($aWin) & @CRLF) EndIf EndIf Case Else #cs If $iEvent <> $lastevent Then ConsoleWrite("event:" & @TAB & $iEvent & @CRLF) $lastevent = $iEvent #ce EndIf EndSwitch EndFunc ;==>_EventProc Func OnAutoItExit() _WinAPI_UnhookWinEvent($hEventHook) DllCallbackFree($hEventProc) EndFunc ;==>OnAutoItExit Func _GetWindows($aArray) Local $pIAccesible = 0 Local $oIAccesible = 0 Local $aRet = 0 Local $x = 0, $y = 0 Local $sWindows = "" Local $aMain = WinGetPos($hMainWin) Local $iBarheight = 0 For $i = 0 To 4 - 1 ;check 4 object(Child window) corners Switch $i Case 0 $x = $aArray[0] - 1 $y = $aArray[1] - 1 Case 1 $x = $aArray[0] + $aArray[2] + 1 $y = $aArray[1] - 1 Case 2 $x = $aArray[0] + $aArray[2] + 1 $y = $aArray[1] + $aArray[3] + 1 Case 3 $x = $aArray[0] - 1 $y = $aArray[1] + $aArray[3] + 1 Case Else EndSwitch $iBarheight = _WinAPI_GetSystemMetrics($SM_CYCAPTION) If $x < $aMain[0] Or $y < ($aMain[1] + $iBarheight) Then ContinueLoop If $x > ($aMain[0] + $aMain[2]) Or $y > ($aMain[1] + $aMain[3]) Then ContinueLoop $aRet = DllCall($hOLEACC, "int", "AccessibleObjectFromPoint", _ "int", $x, _ "int", $y, _ "ptr*", 0, _ "ptr", $pvarChild) If @error Or $aRet[0] <> 0 Then ContinueLoop $pIAccesible = $aRet[3] $oIAccesible = ObjCreateInterface($pIAccesible, $sIID_IAccessible) If (WinGetTitle($hMainWin) <> $oIAccesible.accName) Then $sWindows &= (($sWindows <> "") ? " and " : "") & $oIAccesible.accName EndIf If $aRet[0] = 0 Then VariantClear($pvarChild) $oIAccesible = 0 $aRet=0 Next If $sWindows = "" Then $sWindows = WinGetTitle($hMainWin) Return $sWindows EndFunc ;==>_GetWindows Func VariantClear($pvariant) Local $aRet = DllCall($hOleAut, "long", "VariantClear", "ptr", $pvariant) If @error Then Return SetError(1, 0, 1) Return $aRet[0] EndFunc ;==>VariantClear Func VariantInit($pvariant) Local $aRet = DllCall($hOleAut, "long", "VariantInit", "ptr", $pvariant) If @error Then Return SetError(1, 0, 1) Return $aRet[0] EndFunc ;==>VariantInit 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 Saludos
    1 point
  21. OMG I dreaded something like this Where does this text come from ? a web page ? if so there is certainly a better / easier / more reliable way to go Edit OK the problem was in the file "FormTitles.txt" with some titles containing either special characters or typos Please use the one below, as is, and this code #include <Array.au3> #include <File.au3> Local $formTitlesPath = @ScriptDir & "\FormTitles.txt" Local $formTitles If NOT (_FileReadToArray($formTitlesPath, $formTitles)) Then MsgBox(@error, "FormTitles.txt") Terminate() EndIf Local $titles For $i = 1 to $formTitles[0] $titles &= "\Q" & $formTitles[$i] & "\E|" Next $titles = StringTrimRight($titles, 1) ; Msgbox(0,"1", $titles) Local $testFile = FileOpen(@ScriptDir & "\test.txt") If ($testFile == -1) Then MsgBox(0, "Oops, there's an error", "Can't open test file") Terminate() EndIf $all = FileRead($testFile) $all = StringReplace(StringStripWS($all, 3), @crlf, @TAB) $fAll = StringRegExpReplace($all, '(?i)(?<!^|\w)(?=' & $titles & ')|(?<=' & $titles & ')\h*:?', @crlf) ; MsgBox(0,"1", $fAll) $res = StringSplit($fAll, @crlf, 3) ; _ArrayDisplay($res) Local $array[UBound($res)/2][2] For $i = 0 to UBound($res)-1 step 2 $array[$i/2][0] = $res[$i] $array[$i/2][1] = StringStripWS($res[$i+1], 3) Next _ArrayDisplay($array) Func Terminate() Exit EndFunc ;==>TerminateFormTitles.txt
    1 point
  22. VerteXslaPPy, What you want is very simple - detect the key being pressed, get a random number, and then wait until the key is no longer pressed. The _IsPressed example shows how to do this. M23
    1 point
  23. An alternative to select default device could be written using OjectCreateInterface starting with IMMDeviceEnumerator::EnumAudioEndpoints... Minimum supported OS: Windows Vista. Saludos
    1 point
  24. I test Create simple and work correctly. Create shortcut to toggle with recording devices does Not. I have three device but I always select the last. Saludos
    1 point
  25. jchd

    Software Ads

    Ads are cancer.
    1 point
  26. guinness

    AutoIt3 Portable

    Those files should work with the new version. Just give it time to do its thing. One thing do you have 7-Zip? You don't need it as I include 7z.exe but if there is a version on the system I use that instead of FileInstalling.
    1 point
×
×
  • Create New...