--delay load this script to deal with the autosizing at start function autoNextInit(sender) --find the main form mf=getMainForm() --find "Panel5" (the panel with the first scan/ next scan buttons) p5=component_findComponentByName(mf,"Panel5") --find the "NextScanButton" nsb=component_findComponentByName(mf,"NextScanButton") --create a checkbox cb=createCheckBox(Panel5) --place the checkbox right of the next scan button x,y=control_getPosition(nsb) width, height=control_getSize(nsb) control_setCaption(cb, "Autonext") control_setParent(cb, p5) setProperty(cb, "Anchors", getProperty(nsb,"Anchors")) --center selfwidth,selfheight=control_getSize(cb) control_setPosition(cb, x+width+5,y+((height / 2)-(selfheight / 2))) function DoRescan(sender) local nsb=component_findComponentByName(getMainForm(),"NextScanButton") if control_getEnabled(nsb) then control_doClick(nsb) end end function OptionChange(sender) --using sender since cb is such a simple varname 100% something else will redefine it. (which is why this parameter is there) local checked=checkbox_getState(sender)==cbChecked if checked then RescanTimer=createTimer(nil) timer_onTimer(RescanTimer, DoRescan) timer_setInterval(RescanTimer, 500) --check every 500ms if the next scan button is enabled timer_setEnabled(RescanTimer, true) else object_destroy(RescanTimer) end end setMethodProperty(cb, "OnChange", OptionChange) --onclick should work too, but just in case this got changed object_destroy(sender) end autoNextInitTimer=createTimer(nil) timer_onTimer(autoNextInitTimer, autoNextInit) timer_setInterval(autoNextInitTimer, 1) timer_setEnabled(autoNextInitTimer,true)