Use dialog "Find accessible object".
Drag and drop the Drag image. Drop on the switch button. Click Test. Click OK. It should add 2 lines of code. Then add code to click the button.
Full code:
Change some strings if need, for example "Settings" maybe depends on language.
Drag and drop the Drag image. Drop on the switch button. Click Test. Click OK. It should add 2 lines of code. Then add code to click the button.
Full code:
int w=win("Settings" "ApplicationFrameWindow")
Acc a.Find(w "PUSHBUTTON" "copyq.exe" "class=Windows.UI.Core.CoreWindow" 0x1005)
if a.State&STATE_SYSTEM_CHECKED=0
,a.Mouse(1) ;;click
Change some strings if need, for example "Settings" maybe depends on language.