Bringing Wonderware SMC to foreground

Retrieving the Application Title of a Running Application
In a script, you can find the application title or Windows task list name of a specified running application by using the InfoAppTitle() function. This information is, for example, required by InTouch scripting for checking if the specified application is currently running or for activating it.

Ive tried using that as well, though ill admit i dont know a lot about it. I just use the examples I find


IF InfoAppActive(InfoAppTitle("smc.msc"))==1 THEN
ActivateApp InfoAppTitle("smc.msc");
ELSE
StartApp("smc.msc");
ENDIF;

Ill try playing with it a bit more
 
Found it..
It is running n task manager as "Microsoft Management Console (32bit)" Probably may not need to add (32bit)
 
I have tried:

IF InfoAppActive(InfoAppTitle("Microsoft Management Console (32bit)"))==1 THEN
ActivateApp InfoAppTitle("Microsoft Management Console (32bit)");
ELSE
StartApp("smc.msc");
ENDIF;

Ive tried it without the 32 bit part.. I also tried

SMCISActive = InfoAppActive("MMC");
AppTitle = "MMC";

IF SMCISActive == 1 THEN
ActivateApp AppTitle;
ELSE
StartApp ("smc.msc")

Still not working. Strange, gotta be something simple thats missing.
 
After about 12 emails back and forth on how it is working and things to try..
It has now been passed from my local TS at Wonderware California (very knowledgeable guy who has helped me a bunch of times) to an actual Wonderware Support Engineer in Irvine, CA.

stay tuned...
 
Got this to work... sort of...
It don't initially work for SMC. Then I tried it with task scheduler which also uses MMC and that worked. Then SMC worked... then it didn't, then it did...

InfoAppActive and StartApp worked without trouble. The help file for 2014 R2 SP1 says ActivateApp does not work on 64 bit windows which I'm using for this.

IF InfoAppActive(InfoAppTitle("mmc"))==1
THEN
discreteValue = 1;
ActivateApp InfoAppTitle("mmc");
ELSE
discreteValue = 0;
StartApp("C:\Program Files (x86)\Common Files\ArchestrA\aaSMC.exe");
ENDIF;

edit: ignore the discreteValue tag - used that for a troubleshooting indicator


Prior to this, I tried something that didn’t work but maybe it’ll spark another idea. I tried to start SMC with an on demand task in task scheduler with "Do not start a new instance" if task is already running. That started a new instance.
 
Last edited:
This will onlhy work if you can embed an Archestra Graphic in your app.

I've had similar issues with the ActivateApp. My only workaround was to use the System.Diagnostics.StartInfo() function in an Archestra Graphic.

If so, create a new button in the graphic toolbox:

In the On Left/Key Up Action script:
dim StartInfo = new System.Diagnostics.ProcessStartInfo;
StartInfo.FileName = "aaSMC.exe";
StartInfo.WorkingDirectory = "C:\Program Files\Common Files\Archestra";
dim procs = System.Diagnostics.Process.GetProcessesByName(StartInfo.FileName.ToString().Replace(".exe",""));
if procs.Length > 0 then
proc = procs[1];
startInfo=proc.startInfo;
ActivateApp(proc.MainWindowTitle);
wwControl(proc.MainWindowTitle , "Restore");
else
proc = System.Diagnostics.Process.Start(StartInfo);
endif;

There is may be some superflous stuff in here, I've deleted some custom properties I use to declare when I embed in the window, etc, but that's the basic template I use. Credit to someone other than me that I found on the_tube explaining the System.Diagnostics.Process stuff.

I tested it on my bench and it works. You may not be able to use the Archestra Graphic, but if you can, it should do the trick.
 
May I ask why.?
There can be a lot of info in the .SMC, with almost always navigation to the desired category required.
You mention PLC addresses being reloaded.? Are you wanting the HMI user to be able to see this actual info.?

Does anyone know if Alt-tab can be scripted.?
 
Actually, that didn't work... but THIS did

In the On Left/Key Up Action script:
dim StartInfo = new System.Diagnostics.ProcessStartInfo;
StartInfo.FileName = "aaSMC";
StartInfo.WorkingDirectory = "C:\Program Files\Common Files\Archestra";
dim procs = System.Diagnostics.Process.GetProcessesByName("mmc");
if procs.Length > 0 then
proc = procs[1];
startInfo=proc.startInfo;
ActivateApp(proc.MainWindowTitle);
wwControl(proc.MainWindowTitle , "Restore");
else
proc = System.Diagnostics.Process.Start(StartInfo);
endif;

Seems like you want to be checking if the mmc.exe is active, not the SMC.exe?
Again, you'll need to use the Archestra Graphic for this, but maybe you can glean some ideas from the above.
 
May I ask why.?
There can be a lot of info in the .SMC, with almost always navigation to the desired category required.
You mention PLC addresses being reloaded.? Are you wanting the HMI user to be able to see this actual info.?

Does anyone know if Alt-tab can be scripted.?

The actual reason i need this functionality is because I am having what seems to be a corruption issue on the customers end where some of the addresses that are being loaded into the SMC.

I wanted to look into the SMC and verify, but my access to their system is via remote desktop into a VM and ALT Tab doesn't not work... and neither do a number of other combinations that are suggested on the internet.

So tried asking their IT person to look into this and get it fixed and he could not so here I am trying to figure out how to bring the SMC forward during run time to trouble shoot.
 
The actual reason i need this functionality is because I am having what seems to be a corruption issue on the customers end where some of the addresses that are being loaded into the SMC.

I wanted to look into the SMC and verify, but my access to their system is via remote desktop into a VM and ALT Tab doesn't not work... and neither do a number of other combinations that are suggested on the internet.

So tried asking their IT person to look into this and get it fixed and he could not so here I am trying to figure out how to bring the SMC forward during run time to trouble shoot.

In your RDP session, did you select the 'Apply Windows key combinations' setting for 'on the remote computer' or 'only when using the full screen'?
 
In your RDP session, did you select the 'Apply Windows key combinations' setting for 'on the remote computer' or 'only when using the full screen'?
It depends on the RDP method.. I have one site I access that does not apply the combos & does not allow the ability the change (that I can see anyway). I have not enquired with support on this yet though.

Its set to "Only When using Full Screen"
Are you connecting in full screen?


The actual reason i need this functionality is because I am having what seems to be a corruption issue on the customers end where some of the addresses that are being loaded into the SMC.
Why do you suspect this? The IO Server determines the tags to access via the application config.
Unless they are loading them manually via an alias list or similar?

Can IT give you access to another machine/VM on the same network? You could view the remote SMC that way perhaps?


lc
 
Regrettably.... Wonderware tech support bailed on it...

Nathan,
We can’t get the SMC to maximize consistency using server 2016.

We can sometimes get it to maximize and sometimes minimize but it seems to stall out and peg the computer resources more often than not.

I think you will need to find an alternate way of doing this. Maybe a button that is invisible that will open the SMC if the users permissions are good enough.
 
Last edited:

Similar Topics

Hi all, I have picked up a job where the previous automation guy selected some Freewave Radios (WC20i-485 into WC45i stick gateway) to transmit...
Replies
17
Views
5,659
I am not very experienced (2 yr) so this question is for people who know both what is going on with data science currently and have experience...
Replies
0
Views
1,095
Hi guys, While trying to upgrade a Siemens MP370, it hung somewhere in the process and gets about halfway through the creation of its disk...
Replies
4
Views
2,711
I'm fairly well-versed in programming GE 90-30 PLCs with Proficy ME, but I can't figure out how to open a project that was created on a different...
Replies
4
Views
9,811
Can you use an existing OPC over Industrial Ethernet connection to update code on a S7-300 PLC using Siemens Step 7? I found something somewhere...
Replies
1
Views
3,102
Back
Top Bottom