"Component menu already exists" error

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
EaP

"Component menu already exists" error

Post by EaP » Tue Dec 07, 2004 5:32 am

We have a macro that is used a lot and is run from a hot key, the problem is that sometimes people forget that they have already pressed the hot key and it causes an error "Component menu already exists" and MS has to be closed and restarted. My question is there a way of telling if the dialog has already been loaded or the hot key has already been pressed, I'm very new to this and any help would be greatly appreciated.

Lumumba

Post by Lumumba » Tue Dec 07, 2004 7:29 am

Another scripting tool offers a "single instance directive". Just to explain what I'm talking about, check its syntax here:
#SingleInstance
--------------------------------------------------------------------------------

Prevents more than one instance of a script from existing simultaneously.

#SingleInstance [force|ignore|off]

If #SingleInstance is in effect without the force or ignore option, attempts to launch the script while it is already running will display a dialog box that prompts for whether to keep the original (old) instance or replace it with the new instance.
If something similar isn't available within Macro Scheduler - feel free to request it 8)

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Dec 07, 2004 8:03 am

Like this:


IfWindowOpen>Dialog1
else
Dialog>Dialog1
Caption=Dialog1
Top=239
Width=449
Left=163
Height=250
Button=msButton1,136,56,75,25,0
EndDialog>Dialog1

Show>Dialog1,res
endif
MJT Net Support
[email protected]

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Dec 07, 2004 8:11 am

Or this:


ReadIniFile>inifile,settings,running,val
If>val=FALSE
EditIniFile>inifile,settings,running,TRUE
..
.. macro code here
..
EditIniFile>inifile,settings,running,FALSE
EndIf>


Or use a registry key and use the registry functions.
MJT Net Support
[email protected]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Dec 07, 2004 10:51 pm

I find setting and reading INI files to be very flexible for triggering and/or monitoring many events.. Can also include a MSG box with timeout indicating already running.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

EaP

Thanks

Post by EaP » Tue Dec 14, 2004 7:32 am

Thanks Guys, both great ideas! You have solved my problem.
Thanks Again.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts