Stop running macro (...)

If you have a question or need help, this is the place to be.
Post Reply
Eden
Posts: 2
Joined: Thu Nov 23, 2017 10:38 pm

Stop running macro (...)

Post by Eden » Thu Nov 23, 2017 10:42 pm

Hello,

i am making a macro that is shutting down my computer, what i am trying to do is a messagebox, that will prevent the shutdown to happen when i press the OK button.
I am still fairly new to the programm, and couldn't find anything in this regard in the forums or the web..

Is that possible? If so, how do i include it in the macro?

Thanks a bunch

Eden

User avatar
Neytrino-OnLine
Experienced User
Posts: 97
Joined: Tue Aug 20, 2013 7:14 pm
Location: Moscow, Russia

Re: Stop running macro (...)

Post by Neytrino-OnLine » Fri Nov 24, 2017 7:17 am

Configuration/Add macro...
Image
Then configure item settings (as You like), then execute macro with new item - ut shows message box, click "Ok" and go to the log, to find this event ...
Image
So You could use this event, to trigger execution of ShutDown...
Sin©erely yours, Neytrino.

Eden
Posts: 2
Joined: Thu Nov 23, 2017 10:38 pm

Re: Stop running macro (...)

Post by Eden » Sun Dec 03, 2017 11:28 am

Thanks, i've also come this far though..

My idea was the Shutdown is executing itself, but the OK messagebox would Stop the shutdown.

Is that possible?

User avatar
kgschlosser
Site Admin
Posts: 5120
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Stop running macro (...)

Post by kgschlosser » Sun Dec 03, 2017 5:16 pm

OK so what you are trying to do is create a macro to shutdown the PC. and you want a message box to show that will ask you if you want to continue.

Do you also want a timeout on that message box? so for example you are not at the computer and say after 30 seconds if you have not pressed the button then it will shutdown anyway?
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5120
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Stop running macro (...)

Post by kgschlosser » Sun Dec 03, 2017 5:29 pm

well here is some code. you can copy this and paste it right into the config tree you see in EG. it will create a folder with a couple of macros.

The "Display Shutdown Message" macro is the one that you will want to add whatever it is that you want to start the shutdown sequence.

I set this to have a defaulted timer to 30 seconds. so if you do not respond in 30 seconds it will go ahead and perform the shutdown.

The only thing with this is you will always have to hit to NO if you do not want to shutdown. You cannot click on the X at the top right of the box.

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="WIP-2017.10.31-06.09.51">
    <Folder Name="Shutdown" XML_Guid="{B069440F-88BF-44B1-B745-3C8026E7F0EB}" Expanded="True">
        <Macro Name="Show Shutdown Message" XML_Guid="{6BF3D63C-1D3B-4889-8CD6-DBC97B3971E7}" Expanded="True">
            <Action XML_Guid="{AA75BB68-BC7D-415C-96FB-07B8028FAD10}">
                EventGhost.ShowMessageBox(u'Shutdown', u'Do you want to shutdown the computer?', u'', u'', True, 28708, 1, 30)
            </Action>
        </Macro>
        <Macro Name="Shut Down" XML_Guid="{A1405212-BA6C-462D-90AA-FE8CCB39CACF}" Expanded="True">
            <Event Name="MessageBox.Shutdown.YES" XML_Guid="{DFD8A250-189A-4986-8397-63AC4544E77B}" />
            <Event Name="MessageBox.Shutdown.CANCEL" XML_Guid="{25163DC2-BDE2-4B03-9434-31CDB96DABDE}" />
            <Action XML_Guid="{598544E9-005C-48E1-A890-5B36B34A14FA}">
                System.PowerDown(False)
            </Action>
        </Macro>
    </Folder>
</EventGhost>
If you like the work I have been doing then feel free to Image

Post Reply