Disable / Enable password inside a macro

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Disable / Enable password inside a macro

Postby fdeporte » Thu Jul 25, 2024 10:15 am

Hi,
I am still working at ATC and probing macro and I would like to disable / enable the password inside the macro.

I have tested the following code but UCCNC still ask for password.

Code: Select all
string Password = DisablePassword();
DisableSoftLimits();
MessageBox.Show("Softlimits disabled.");
EnableSoftLimits();
MessageBox.Show("Softlimits enabled.");
EnablePassword(Password);

#Events

private void EnableSoftLimits(){
  AS3.Setcheckboxstate(true, 75);
  exec.Callbutton(168);
}

private void DisableSoftLimits(){
  AS3.Setcheckboxstate(false, 75);
  exec.Callbutton(168);
}

private string DisablePassword(){
  string Password = exec.Readkey("Operatorlock","Password","");
  if(Password!=""){
    exec.Writekey("Operatorlock","Password","");   
  }
  return Password;
}

private void EnablePassword(string Password){
    exec.Writekey("Operatorlock","Password",Password);
}



It's like UCCNC remember a password has been set without checking the key Password during macro.
Do you know how can I fix it ?

Thanks a lot,
fdeporte
 
Posts: 22
Joined: Tue Dec 08, 2020 12:01 pm

Re: Disable / Enable password inside a macro

Postby cncdrive » Thu Jul 25, 2024 9:39 pm

Try to call the Applysettings button after changing the key in the profile file.
I'm not 100% sure if it will work, but try it please.
cncdrive
Site Admin
 
Posts: 4840
Joined: Tue Aug 12, 2014 11:17 pm

Re: Disable / Enable password inside a macro

Postby fdeporte » Fri Jul 26, 2024 6:22 am

I have tried by pressing Apply after Writekey function and I obtain the same result.
I would like to set password to afford my customers editing settings but I need macro with full rights for disable softlimits for example.
Do you know another way to disable password inside of macro ?
fdeporte
 
Posts: 22
Joined: Tue Dec 08, 2020 12:01 pm

Re: Disable / Enable password inside a macro

Postby Battwell » Sun Aug 04, 2024 11:28 am

it would be nice to lock out customers from changing all settings (grey out all check boxes )
but still be able to save offsets, save settings etc from macros.
at the moment i cannot lock customers out of settings due to this.
Uc300eth on router and mill.
UK uccnc powered machine sales. https://cncrouter.uk/atc-cnc-routers.htm
Automateanything/duzzit cnc/mercury cnc
Battwell
 
Posts: 855
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk


Return to Macros

Who is online

Users browsing this forum: No registered users and 5 guests

cron