X Command Causes Windows Explorer Window to Come Forward

Accepted Solution Solved
Reply
Contributor
Posts: 25
Accepted Solution

X Command Causes Windows Explorer Window to Come Forward

When running a X command in SAS Interactive 9.4 1M3, if I have a windows explorer window open and not minimized it will cause the explorer window to come forward and shift SAS Interactive to the background, as though I ALT-TAB'd to Explorer. Is there a way to prevent this from occuring?

 

If I minimize the Windows Explorer window, or don't have one open at all, then no focus shift occurs.


Accepted Solutions
Solution
‎09-20-2017 05:34 PM
PROC Star
Posts: 1,935

Re: X Command Causes Windows Explorer Window to Come Forward

That's odd. Have you tried using the noxwait and noxsync options see if they make a difference?

View solution in original post


All Replies
Solution
‎09-20-2017 05:34 PM
PROC Star
Posts: 1,935

Re: X Command Causes Windows Explorer Window to Come Forward

That's odd. Have you tried using the noxwait and noxsync options see if they make a difference?

Contributor
Posts: 25

Re: X Command Causes Windows Explorer Window to Come Forward

[ Edited ]

This is on Windows 7 Professional.

 

The issue can be modulated with XSYNC/NOXSYNC.

 

Causes focus shift to Windows File Explorer and SAS Interactive to go to background focus:

options noxwait xsync;

x '"C:\Program Files\Microsoft Office\Office15\EXCEL.EXE"';

 

SAS Interactive stays in foreground:

options noxwait noxsync;

x '"C:\Program Files\Microsoft Office\Office15\EXCEL.EXE"';

Super User
Posts: 12,148

Re: X Command Causes Windows Explorer Window to Come Forward

Does Excel open as well? I no longer have Office 15 installed but the equivalent code for my version opens Excel and shifts the focus to Excel, which is what I would expect to happen.
Contributor
Posts: 25

Re: X Command Causes Windows Explorer Window to Come Forward

The focus shift happens when I issue any X command with option XSYNC.  Opening Excel is an example I can provide publically. Excel does indeed open but prior to Excel opening, SAS is shifted to the background, File Explorer shifts to the foreground, then Excel opens in the foreground.

Super User
Posts: 21,572

Re: X Command Causes Windows Explorer Window to Come Forward


asumsie wrote:

The focus shift happens when I issue any X command with option XSYNC.  Opening Excel is an example I can provide publically. Excel does indeed open but prior to Excel opening, SAS is shifted to the background, File Explorer shifts to the foreground, then Excel opens in the foreground.


That's what I would expect to happen.

Contributor
Posts: 25

Re: X Command Causes Windows Explorer Window to Come Forward

Why would you expect Windows File Explorer to shift to the foreground?

Super User
Posts: 21,572

Re: X Command Causes Windows Explorer Window to Come Forward

Sorry, just tested. No, it doesn't switch to Windows File Explorer, it switches off of SAS to the Microsoft Command interface which isn't shown, but is being used to execute the command. It's the black command line screen.

 

X command are really just any command you type into the Run interface and it switches to 'that'. 

 

If you close (not minimize) all windows explorer windows, it actually opens a windows explorer instance?

 

I tested this on Windows 7 Enterprise

 

 

 

 

Contributor
Posts: 25

Re: X Command Causes Windows Explorer Window to Come Forward

Thanks, Chris - there's nothing in the documentation nor would I naturally anticipate a synchronization option to cause Windows File Explorer window to shift to foreground. I'll consider this a bug.

Super User
Posts: 21,572

Re: X Command Causes Windows Explorer Window to Come Forward

I re-read your initial question, and that matches what I see. 

 

I'm going to guess the Windows command line tool and Windows Explorer are 'linked' and that this is actually on Windows side. Since you can execute a command from windows explorer by typing in cmd + Command. 

 

 

PROC Star
Posts: 1,935

Re: X Command Causes Windows Explorer Window to Come Forward

@asumsie

I am guessing that since you call the CLI window, SAS goes to the background, and since you choose not to display the CLI window, Windows defaults to the default "shell", i.e. Explorer. 

I can't test since I am stuck with EG, but this looks more like a Windows "feature" than a bug. 

I must admit I never paid attention to the sequence of what's displayed when I used SAS Desktop and the X command, and it also may well be different for different versions of Windows.

Super User
Posts: 12,148

Re: X Command Causes Windows Explorer Window to Come Forward

Are you sure that the window isn't a command window?

Or perhaps you should show the specific X command you are issuing.

With 9.4.4 a basic X command on my system opens a command window.

Super User
Posts: 21,572

Re: X Command Causes Windows Explorer Window to Come Forward

What does your code look like? Perhaps there's a mistake in your X command. 

 

What version of Windows are you using?

Super User
Posts: 21,572

Re: X Command Causes Windows Explorer Window to Come Forward

Just an FYI - if you're using DDE in your code, you CANNOT use your computer while it's running and need to wait for it to finish. You'll get weird behaviours if you do. 
I've seen it dump the data into Outlook instead if I switched the 'focus' there instead.

Contributor
Posts: 25

Re: X Command Causes Windows Explorer Window to Come Forward

There's no use of DDE in this example.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 15 replies
  • 202 views
  • 2 likes
  • 5 in conversation