Skip to content

listEl.Scroll("SmallIncrement") Error: (0x8000FFFF) 灾难性故障 #65

@ZJRui

Description

@ZJRui
#Requires AutoHotkey v2.0

#SingleInstance Force
;#include <UIA> ; Uncomment if you have moved UIA.ahk to your main Lib folder
#include ..\Lib\UIA.ahk


SetTitleMatchMode 2
Run "explorer D:\.pnpm-store\v10\files"
Sleep 1000

; Decrease window height so that folder "System32" is out of view
WinMove(, , 1000, 800, WinExist("A"))
explorerEl := UIA.ElementFromHandle("A")
if !explorerEl
    ExitApp
listEl := explorerEl.FindElement({ Type: "List", Name: "项目视图" })
MsgBox "List element found: " listEl.Name

if !listItem := explorerEl.ElementExist({ Name: "fe", Type: "ListItem", matchmode: 3 }) {
    MsgBox "Element 'fe' not found! Press OK to scroll until 'fe' is in view and then select it. VerticalScrollPercent:" listEl.VerticalScrollPercent

    Loop {
        if listItem := explorerEl.ElementExist({ Name: "fe", Type: "ListItem" }) {
            listItem.AddToSelection()
            break
        }
        Sleep 500
        listEl.Scroll("SmallIncrement")
    } Until Round(listEl.VerticalScrollPercent) = 100
} else {
    MsgBox "Element 'fe' already exists in the view."

}
ExitApp

F5:: ExitApp


Error: (0x8000FFFF) 灾难性故障

	027: }
	028: Sleep(500)
▶	029: listEl.Scroll("SmallIncrement")
	030: }
	030: Until Round(listEl.VerticalScrollPercent) = 100

The current thread will exit.

Call stack:
D:\tempFiles\UIA-v2-main\Lib\UIA.ahk (2039) : [UIA.IUIAutomationElement.Prototype.__Call] throw(%Type(err)%(err.Message, -1, err.Extra))
D:\tempFiles\UIA-v2-main\demos\demo3.ahk (29) : [] listEl.Scroll("SmallIncrement")
> Auto-execute

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions