Jump to content

Speichern unterbrechen/interrupt saving


---
 Share

Recommended Posts

Hallo zusammen,

da bei uns zum ändern der Prüfpläne der Master Benutzer verwendet wird, wird auch öfters vergessen sich nach der Änderung wieder umzumelden und es kann theoretisch jeder etwas ändern und abspeichern.

Jetzt würde ich gerne nach anklicken des speichern Buttons mithilfe der "pre_save_pcm.txt" vor dem Speichern abfragen ob wirklich gespeichert werden soll und wenn das nicht der Fall ist das Abspeichern abbrechen, hierzu fehlt mir jedoch eine PCM Funktion die das Speichern wirklich abbricht.
Habe schon endInspection(), cncBreak() und halt() probiert, das Abspeichern wird aber trotzdem ausgeführt.
Vielleicht ist es aber auch möglich den Benutzer per PCM Funktion automatisch zu wechseln?

Würde mich freuen wenn da jemand eine Lösung dafür hätte oder eventuell einen Vorschlag wie das anders abgesichert werden könnte.

Danke Euch!

Mit freundlichen Grüßen,
Florian Leitner

----------------------------------------------------------------

Hello everybody,

since we use the master user to change the test plans, we often forget to log back in after the change and theoretically everyone can change and save something.

Now, after clicking the save button, I would like to use the "pre_save_pcm.txt" to ask before saving whether I really want to save and if this is not the case, I would like to cancel the save, but I do not have a PCM Syntax that really cancels the save.
Have already tried endInspection (), cncBreak () and halt (), but saving is still carried out.
Maybe it is also possible to change the user automatically using a PCM Syntax?

I would be happy if someone had a solution for it or maybe a proposal how that could be secured otherwise.

Thank you!
Link to comment
Share on other sites

Hello Florian,

I tried those syntaxes you already used,they can't stop Calypso to save my plan even though I use " wait(10) " to delay and click red light within 10s, it doesn't work.I think it's a bug in Calypso PCM.

But I've found another way to solve it.In Calypso if you right click your "inspection" file in your current plan dictionary,left click "Properties" and activate "Read-only",Calypso can't save your plan when you click "save" button.

According to this way,we can make a PCM file as you said,"inspection_pre_save_pcm.txt" in your current plan path, to generate a batch file.So you can use it to change the property of your "inspection" file to decide whether you save your plan.

I hope it will help you.


BAT_FILE=getActualInspectionDir() + "\Confirm.bat"
Inspection_FILE=getActualInspectionDir() + "\inspection"
if fileExists(BAT_FILE)==true then
	deleteFile(BAT_FILE)
endif
addToFile(BAT_FILE,"attrib"+ chr(32) + "-r" + chr(32) + chr(34) + Inspection_FILE + chr(34))
systemCallWithWait(BAT_FILE)
Z=confirm("Save the plan?")
if Z==false then
	deleteFile(BAT_FILE)
	addToFile(BAT_FILE,"attrib"+ chr(32) + "+r" + chr(32) + chr(34) + Inspection_FILE + chr(34))
	systemCallWithWait(BAT_FILE)
endif

inspection_pre_save_pcm.txt

Link to comment
Share on other sites

Hi Jonas,

thank you so much, this is exactly what i was looking for!!
I added a password request and now it works just as i imagined.

Do you also use this? The only qestion i now have: is it possible that if the "inspection" file status is left on "read only" that it causes any erros during the normal run of the inspection plan? Until now i didn't had this case, just wondering.

So, thank you for your time, you have solved my problem!

sincerly, Florian
Link to comment
Share on other sites

Clever approach.

But you have made it unnecessarily complex.
if confirm("Sure you like to save?")
	attribute="cmd.exe /c attrib -r "
else
	attribute="cmd.exe /c attrib +r "
endif
systemCall(attribute+qm()+getActualInspectionDir()+"\inspection"+qm())
Depending on changes made, you might wish to change file attribute of the inspset file to.

Btw, it's not a bug, you have started a method by clicking "save", even if you delay the execution, it will proceed after the delay.

Its like:
Press save
-do some thing
-do more stuff
-read the pcm file be fore save
- -oh let's wait a second.
-continue do something since we are in memory, even if other processes is stoped, we have higher priority...

Calypso isn't "multi threaded" per to days standard. But it's utilizing fork, to jump from process to process based on priority.

To actually cancel the save, you need to terminate the execution of the method. And by doing that you need the process id, create a forked process with higher priority that terminates the execution of the first method. So your solution, not stoping the save process, just prevent it to write new stuff is much simpler. And as said earlier, clever 😃
Link to comment
Share on other sites

@ Eric
Hi Eric,

You're totally right,cncBreak(),endInsoection() just interrupt a runing plan,saving process is not CNC running 🤣
And your approach is amazingly brief! 😮
But a little issue : systemCallWithWait() is more appropriate. I find saving process is always executed faster than CMD.I have to click save button twice 🙂

@Florian
Hi Florian,

Actually we only use Master user and I've never used this kind of function.But your idea is what I want,sometimes I really regret clicking the "save" 😭
Activating "Read only" option would never cause any errors when you run your plan normally,error message pops up only when you click "save".
Link to comment
Share on other sites

Put this in your Presettings, it SHOULD check at the start of a run if you are in master and alert the operator.

Use=getRecordHead("operid")
if Use == "Master" then
message("Hey yo, i think youre still in Master"+cr()+"You know thats not cool!"+cr()+"Change it NOW!!!!!")
endif

I guess if you wanted you could add an end run option into the mix, but i don't have time to test that out, but it would look something like this, where if you want to keep running the program then pcm will do nothing, if you want to stop then pcm will execute the endrun command (i cant remember what that is)

Use=getRecordHead("operid")
if Use == "Master" then
message("Hey yo, i think youre still in Master"+cr()+"You know thats not cool!"+cr()+"Change it NOW!!!!!")
itemSelected = inquireList("What do you want to do?","Keep running program","Stop Program")
if itemSelected=="Keep running program" then
endif
if itemSelected=="Stop Program" then
END PROGRAM PCM COMMAND
endif
endif

fgdfghghjhkjkl.JPG

Link to comment
Share on other sites

 Share

×
×
  • Create New...