menu to access public routine and stop macro
Hi,
i'm looking for two things.
1) Is there a way to customize the ribbon, or the quick access toolbar to add a call of some public procedures from my project ?
2) At the beginning of a procedure I need to show popup a message, that will be always visible on the somewhere on the screen while the procedure execution, and from which if the user press "OK" the macro execution will stop. My procedure will show other popups, so this popup must be "non-modal" and it shouldn't block any other popups.
Thanks in advance for your time.
Martin
i'm looking for two things.
1) Is there a way to customize the ribbon, or the quick access toolbar to add a call of some public procedures from my project ?
2) At the beginning of a procedure I need to show popup a message, that will be always visible on the somewhere on the screen while the procedure execution, and from which if the user press "OK" the macro execution will stop. My procedure will show other popups, so this popup must be "non-modal" and it shouldn't block any other popups.
Thanks in advance for your time.
Martin
0
Answers
Yes, it is possible.
1) You can activate "Quick access" property of the macro to add the macro to quick access toolbar. (you can do in tin the properties page of the macro)
2) It can be done by activating Interactive mode of any command. You can do it by clicking the "Prompt user in imaging workspace" menu item in the context menu of the command over the properties page. You can find more details in this link http://forums.mediacy.com/discussion/comment/659/#Comment_659 or check "Automate" section of Image-Pro Premier Online help.
Regards,
Yuri
Question 1), thanks, it works great.
Question 2), can you help further with that one please ?
I found a command "Automate.ScriptingCommandes.Interaction".
I found the command to "pause" the macro.
But I'm not sure how to integrate all of this to do what I need.
Here's my main Sub of my macro.
I don't quite understand your workflow. It looks like you want to have a combination of modal and mod-less prompts. Mod-less prompts show an interaction prompt (balloon) and allow user to do some interactive operations, the programs stays on that macro command untill user clicks Ok or Cancel.
There is also a possibility to show modal dialog with explicit Yes/No questions.(user cannot do anything else).
You should try to arrange your workflow using the given possibilities.
Yuri
well, maybe I should re-words what my automation do.
My script is looping all images in a specific folder.
For each image I do these steps :
- Open image
- Apply spacial calibration read from an excel file
- Ask user to draw one kind of measure
- Ask user to draw an other kind of measure
- Ask user to draw an other kind of measure
- Save trace data
- Export measurements information to Excel
- Close image
Here's what i'm using to prompt the user to draw an object :
Is it more clear ? Can you give me a hint ? Thanks, Martin
Now I understand what you want, you just want to break the processing loop if it takes too long.
There are 3 different solutions proposed in this comment: http://forums.mediacy.com/discussion/comment/548/#Comment_548
It will work for you too, though there the macro doesn't show any prompts.
If you show a prompt (balloon), it has 2 buttons Ok and Cancel. You can use Cancel to stop the loop.
Below is the macro that demonstrates it. You put the interactive command into try/catch block and exit the macro from Catch, which is called when user clicks Cancel:
Regards,
Yuri
cool, I have an option, thanks !
I allow myself to ask you another way to stop everything.
My macro shows prompt (balloon) to tell user what he needs to draw.
I would like to use the form I tried in my tests, my form with 2 buttons (Run and Stop).
On the click of "Run", my macro start to loop all images and prompt user (balloon) to draw different object, and etc. etc.
Yes, now, I will add the Try Catch to stop everything, at this point, if the user click cancel but I would like, if the user click on "Stop" button on the form, to "Exit all"... stop everything ... and obviously, at this moment, the chance that a prompt is shown is high.
I took a look of the other thread that you post me and I don't think it's suitable for my case.
Is it possible to do something like I want ?
Thanks,
Martin
There's actually a way to stop the current interaction but it's a bit more involved. Here is the code, I am also attaching the project.
Private Sub btnRun_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles btnRun.Click Try InteractiveMacro() Catch ' Macro cancelled Finally End Try End Sub Private Sub btnStop_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles btnStop.Click If Interaction.ThisInteraction.DialogResult=System.Windows.Forms.DialogResult.None Then Interaction.ThisInteraction.Close() ' This will stop the interaction and stop the InteractiveMacro Interaction.ThisInteraction.DialogResult=System.Windows.Forms.DialogResult.Cancel ' This would stop the interaction and continue the InteractiveMacro 'Interaction.ThisInteraction.DialogResult=System.Windows.Forms.DialogResult.OK Else Automate.ScriptingCommands.PauseMacro(Nothing).Run() End If End Sub
Pierre
PIerre
I'll give a try as soon as I get back to home.
Regards,