"Component menu already exists" error
Moderators: JRL, Dorian (MJT support)
"Component menu already exists" error
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.
Another scripting tool offers a "single instance directive". Just to explain what I'm talking about, check its syntax here:

If something similar isn't available within Macro Scheduler - feel free to request it#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.

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
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]
[email protected]
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.
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]
[email protected]
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact: