using System;
using System.Windows.Automation;
class Program
{
static void Main()
{
// Find the "Phone Link" window
AutomationElement phoneLinkApp = AutomationElement.RootElement.FindFirst(
TreeScope.Children,
new PropertyCondition(AutomationElement.NameProperty, "Phone Link")
);
if (phoneLinkApp != null)
{
Console.WriteLine("✅ Phone Link app found!");
// Find the "Messages" list
AutomationElement messagesList = phoneLinkApp.FindFirst(
TreeScope.Descendants,
new PropertyCondition(AutomationElement.ClassNameProperty, "Messages")
);
if (messagesList != null)
{
Console.WriteLine("✅ Messages list found!");
// Get all messages
AutomationElementCollection messages = messagesList.FindAll(TreeScope.Children, Condition.TrueCondition);
foreach (AutomationElement msg in messages)
{
Console.WriteLine("📩 Message: " + msg.Current.Name);
}
}
else
{
Console.WriteLine("❌ Messages list not found.");
}
}
else
{
Console.WriteLine("❌ Phone Link app not found.");
}
}
}
Sign up here with your email
ConversionConversion EmoticonEmoticon