UI Event Trigger: Source_Class_Name

Post your questions and help other users.

Moderator: Martin

Post Reply
JC.INTERNET.STUFF
Posts: 27
Joined: 13 Jul 2017 08:47

UI Event Trigger: Source_Class_Name

Post by JC.INTERNET.STUFF » 17 Aug 2020 01:48

Hi,

I have some code here that doesn't seem to work. Does anyone have an idea why and how to correct it?

The source_class_name variable becomes available after the UI Event trigger. The value is "android_widget_Button" (text).

Examples Inside Script Trigger:
If source_class_name == "android_widget_Button"
{
true
}
else
{
false
}


Example 2 - Inside Expression Condition:
source_class_name == "android_widget_Button"

Thanks.

Julian

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: UI Event Trigger: Source_Class_Name

Post by Desmanto » 17 Aug 2020 07:19

UI Event is the trigger. After trigger add condition as your second example

Code: Select all

source_class_name == "android_widget_Button"
True continue to your main branch of the flow. False do nothing (or something else if you need to).

If that still doesn't work, you need to explain first what you need achieve. Maybe there is another way to do it.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

JC.INTERNET.STUFF
Posts: 27
Joined: 13 Jul 2017 08:47

Re: UI Event Trigger: Source_Class_Name

Post by JC.INTERNET.STUFF » 20 Aug 2020 08:02

Hi,

The provided if and expression exampled oes not work. The result is always false.

I don't know what else I can tell you.

Julian

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: UI Event Trigger: Source_Class_Name

Post by Desmanto » 20 Aug 2020 08:10

Which mean the event triggered the flow doesn't have "android_widget_Button". Add a condition debug dialog in the false branch and check the variable source_class_name value. Maybe there is different value at every trigger. In that case, you might want to use variable logger to log all the possible value : viewtopic.php?f=3&t=7285
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

JC.INTERNET.STUFF
Posts: 27
Joined: 13 Jul 2017 08:47

Re: UI Event Trigger: Source_Class_Name

Post by JC.INTERNET.STUFF » 20 Aug 2020 08:24

The ....Button does exist.

This is why I have contacted support because the result is always false.

Is the syntax correct?

Julian.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: UI Event Trigger: Source_Class_Name

Post by Desmanto » 20 Aug 2020 08:46

The syntax is correct already, with double equal sign

Code: Select all

source_class_name == "android_widget_Button"
Use the debug dialog when the false is returned, scroll to find the source_class_name and copy the value from there, paste it back to the expression. You might have upper/lower case problem here.

BTW, what is the button/UI that trigger this flow?
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

JC.INTERNET.STUFF
Posts: 27
Joined: 13 Jul 2017 08:47

Re: UI Event Trigger: Source_Class_Name

Post by JC.INTERNET.STUFF » 20 Aug 2020 09:04

Hi, fixed. There was a space at the end of the ....Button which I couldn't see.

There is now no issue.

Thanks for your help.

Julian

Post Reply