Hi all,
I have written a macro to switch between 2 different probes (touchplate & sensor).
Touchplate is on Pin 10 Port 1 ActiveLow (NO)
Probe is on Pin 11 Port 1 ActiveHigh (NC)
The following macro gets called to toggle Probe 1 between the 2 probes.
All works fine with the fields, but I cannot get the Checkbox to change state...
After running the macro, the checkbox for ActiveLow gets toggled in the screen (2017).. but it doesn't change the state.
Hitting "Apply Settings" doesn't apply the change in ActiveLow/High .. unless I go and use the GUI to toggle the checkbox twice with my mouse.
Appreciate any advice . Thanks !
---
//Function: string Getfield(int fieldnumber)
//Function: void Setfield(double value, int fieldnumber)
//Function: void Validatefield(int fieldnumber)
//Function: void Setfieldtext(string value, int fieldnumber)
//Function: bool Getbuttonstate(int buttonumber)
//Function: void Switchbutton(bool Ison, int Buttonnumber)
//string fieldvalue = AS3.Getfield(100);
//AS3.Setfield(15.23, 100);
exec.AddStatusmessage("Toggle Probe Script");
string CurrentProbePin = AS3.Getfield(92);
string CurrentProbePort = AS3.Getfield(272);
bool CurrentProbeActiveLow = AS3.Getcheckboxstate(56);
string ProbeName = "";
exec.AddStatusmessage("Current Probe Status = Pin " + CurrentProbePin + " Port " + CurrentProbePort + " ActiveLow = " + CurrentProbeActiveLow);
// Flip Variables
if (CurrentProbePort != "1")
{
CurrentProbePort = "1";
}
if (CurrentProbePin == "11")
{
CurrentProbePin = "10";
CurrentProbeActiveLow = true;
ProbeName = "Touchplate";
}
else
{
CurrentProbePin = "11";
CurrentProbeActiveLow = false;
ProbeName = "Probe";
}
AS3.Setfieldtext( CurrentProbePin, 92);
AS3.Validatefield( 92 );
AS3.Setfieldtext( CurrentProbePort, 272);
AS3.Validatefield( 272 );
AS3.Switchbutton( false, 20417);
exec.Wait(50);
AS3.Switchbutton( CurrentProbeActiveLow, 20417); // This command works in the screenset but doesn't affect the UCCNC system.. are checkboxes really readonly via macro ?
AS3.Setfieldtext( ProbeName, 20001);
exec.Callbutton(168); // apply all settings
exec.Wait(50);
//exec.Callbutton(167); // save all settings
exec.AddStatusmessage("New Probe Status = Pin " + CurrentProbePin + " Port " + CurrentProbePort + " ActiveLow = " + CurrentProbeActiveLow);