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.
That's odd. Have you tried using the noxwait and noxsync options see if they make a difference?
That's odd. Have you tried using the noxwait and noxsync options see if they make a difference?
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"';
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.
@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.
Why would you expect Windows File Explorer to shift to the foreground?
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
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.
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.
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.
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.
What does your code look like? Perhaps there's a mistake in your X command.
What version of Windows are you using?
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.
There's no use of DDE in this example.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.