|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Dec 31, 2006 6:26 pm
Detecting a loaded package? |
As an illustrative example, say I have a main package which contains most of my triggers and scripts, but I also have a supplementary windows package with windows for alerts, communication and things like that. I have a number of aliases I use for printing things to the screen. If the user has that window package loaded as well, I want the alias to print to those windows rather than the main one.
#alias print_alert {#if (%PackageIsLoaded(Windows)) {:Alerts:#echo {Alert: %-1} {#echo Alert: %-1}}
or perhaps
#alias print_alert {%if(%PackageisLoaded(Windows),:Alerts:)#echo {Alert: %-1}}
The PackageIsLoaded function doesn't exist, so anyone know a way to do this? |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Dec 31, 2006 7:00 pm |
As a work around you could always use %window to see if the window is open, but yeah a %package function would be nice to see if a package is enabled disabled or non existant
Code: |
#ALIAS print_alert {
#IF (%window(Alerts)) {#WIN Alerts {%-1}} {#ECHO {Alert: %-1}}
} |
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jan 17, 2007 10:26 pm |
I'll try to add something to detect if a package is loaded in the future. Of course, then you will probably also want some commands to load and unload packages, right? It's never ending :)
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Jan 17, 2007 10:32 pm |
Perhaps not, actually, since packages almost always contain modules that you can turn on and off instead of loading packages on the fly. Though a command like #T+ and #T- that controls modules would be nice. Or simply adding something like {||ModuleName|Class} or just {||Modulename} to it. That way you can control all or some of the settings in a package all at once.
|
|
|
|
|
|