Managing windows when local SAS session starts - session

When a SAS session starts, there are 5 windows. (Result Viewer, Explorer, Log, Editor, Output).
My desired state is when the session starts:
No result viewer
No output window
No default explorer window
The useable explorer window default open(to clarify this i attached a picture)
Good/Bad explorer window
Enchanced editor open
Log window open
So there will be 3 windows opened at session start, and i would like to resize them into 3 columns.
What i got so far:
I know the task can be done, because i was able to do this on my working computer. Unfortunately they reinstalled my windows without a word, and i lost my setup. And i did not have my autoexec/sasv9cfg file backuped. :(
I can close the output window with dm listing off command in my autoexec.
I can resize the 3 windows if i have them, with dm wdef command as well.
My biggest issue is i cant find again a DM/ODS or any kind of command, which closes the Result Viewer, and the original Explorer, and opens the normal/usable Explorer. In my faded memories i needed only 1 DM/ODS/sth command to achieve these 3 steps at once. Of course, if we can find a solution in more steps, thats also completely fine.
Big thx for any kind of help

You do not want the DMSEXP docked windows (which includes ODS Results tab) at session start up. The only way to do this programmatically is to specify the SAS system option -nodmsexp in the sas.exe command line or config.sys.
So, on my system, I set the target command on my SAS icon to be:
"C:\Program Files\SASHome\SASFoundation\9.4\sas.exe"
-CONFIG "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg"
-NODMSEXP
Tweak the SAS DM session window states by placing this code in your autoexec.sas
dm 'dmsexp;tree on;next;listing off;tile vert' ;
You can also fiddle around with your session start up using the system options:
initstmt=
initcmd

Related

setx Causes Windows Explorer to Scroll to Top

I have a folder that contains a lot of batch files -- more than can be displayed onscreen at one time in Windows Explorer. Some of these are clustered together, and need to be executed in sequence (but not in the same batch, as intermediate steps are necessary outside that which can be handled by batch files).
One of my files works as expected, but when I run that file, it causes the Explorer window to scroll to the top of the list. This isn't crippling -- but it's a mild irritant, as it distracts me from which file I ran last. (Also, it's just weird, and I'd like to understand what's going on.)
I've isolated the problem to a setx call: If I comment out this line, the batch file executes with no effect on the Explorer window that displays the directory in which it resides. If I uncomment the line and double-click the file, the batch file executes and its Explorer window scrolls to the top.
For diagnostics, I slimmed this down to a single line: I created a file named Test.bat, with only the following line of content:
setx TestValue abc
I put in it a folder with enough files in it that they were not all visible at once -- and, because it starts with a T, Test.bat displayed near the bottom. When I double-clicked it, the window scrolled to the top.
I'm using Windows 10. And tried this on another computer (with the same result) just to be certain it wasn't a quirk of my original machine.
Is this behavior something that can be negated with a command switch or a change to the Windows configuration?
Why?
setx command sends an WM_SETTINGCHANGE message to all top-level windows to notify the changes to the environment (lParam is Environment).
This causes the explorer windows to reprocess their environment and in this process the file list is repositioned.
How to solve?
There is not any way in setx to disable the message sending, and I don't know a way (using only the OS) to indicate to the explorer windows to not process the received message (that needs to be processed so new started processes could see the new variable).
The only way I see to deal with this "problem" is to directly write the variables into the registry and only call setx when you need to inform the rest of the windows of the environment changes.

Reuse window / tab when file is already open

I want to set a global shortcut that will open a certain file. When there already is a gvim window that has that file open, I want it to focus on that window, and select the tab with that file. If there isn't, I want it to be opened in a new gvim window, regardless of whether there already are other gvim windows.
I can do part of this with --remote and --servername, but I can't find a way to detect whether there already is a remote server running with the name I use, so I can't quite get everything to work together to come to what I described above.
OK, turns out most can be done using the default behavior of --remote-silent. The whole setup is a matter of making an AutoHotkey script like this:
#!^+1::
Run "c:\Program Files (x86)\vim\vim74\gvim.exe" --servername org --remote-silent %DROPBOX%\org\TODO.org
WinActivate, TODO.org
Return
AHK is needed for the global hotkey as well as activating the window; vim (using --servername and --remote-silent) will start a new session called 'org' if there isn't one yet, and start it otherwise. It even gets the tab activation right when there already is a server called 'org' but if that server has another tab active.

Windows: Open program in specific screen location

At work, I have a set of batch files and scripts which I use to automate all the programs I need to open in the morning (and others to close them all down at night) in order to save time and effort. The problem is, the windows all open in whatever location they so choose, since most of the information is cleared out overnight on the Virtual Desktop.
I have seen people talking of desktop managers and additional programs that make such tasks easier, but due to the restrictions at play, I do not have the ability to install programs like that. I also do not have access to edit registry files, and I can never be sure if the registry files will stay the same or be wiped and reimaged at night. So re-opening at the stored previous location seems to be out. This means that AutoHotKey , cmdow , and most .exe program options are out of the running.
Essentially what I am looking for is a way to reposition open windows, or open windows in a specific position, using either batch files or vbs. Preferably with a location relative to the screen rather than other windows, as I use multiple monitors.
I'm open to using powershell or potentially other options, but those would likely fall outside my experience. It seems like what I'm asking is either nonexistent or impossible, but I'm hoping maybe someone has an idea. I don't mind complicated code, but I have no idea where to begin on this one guys, any suggestions?
It look like someone as already answer that kind of question here :
Other post on set many programs window size and position
You can also use C# and map powershell on it using cmdlet in powershell and c# as backend. Here is an exemple in c# and just google how to make cmdlet in powershell.
Example in c#
Batch files can't do this. A VBScript can sort of do this using Windows Script Host Object Model.
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run(strCommand, [intWindowStyle: See below], [bWaitOnReturn: TRUE/FALSE])
Set WshShell = Nothing
intWindowStyle values:
0 - Hides the window and activates another window.
1 - Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
2 - Activates the window and displays it as a minimized window.
3 - Activates the window and displays it as a maximized window.
4 - Displays a window in its most recent size and position. The active window remains active.
5 - Activates the window and displays it in its current size and position.
6 - Minimizes the specified window and activates the next top-level window in the Z order.
7 - Displays the window as a minimized window. The active window remains active.
8 - Displays the window in its current state. The active window remains active.
9 - Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
10 - Sets the show-state based on the state of the program that started the application.
Not sure about PowerShell. :/

How to print something to command window in Visual FoxPro 9?

I am trying to write simple program in Visual FoxPro, I am using built in Help, but cannot find an answer there. There are dozens of samples but they all work with forms, and I just need something like console.out() or printf().
While looking for some samples on internet, found this:
? 2 + 2
This line supposed to print 4, but nothing happens when the program is run from the menu or tool bar.
In the command window, type "set device to screen"
You can create a program, may be called "start.prg" including the line above in the program. This is run everytime Foxpro is started from Desktop.
Click on Tools, Options, File locations, Startup Program,then "modify"
and enter the location of the "start.prg", for example, C:\Program Files\Microsoft Visual Foxpro 9\start.prg
******to print to paper *********************************************
set device to printer
set printer to &&& turn off all open print commands
???" " &&& open printer in raw mode
p_Landscape_On =chr(27)+"&l1O"
p_Landscape_Off =chr(27)+"&l0O"
n_Row=2
#n_Row, 1 say (p_Landscape_On) +(p_Draft)+(p_14inPaper)
n_Row=n_Row+1
******end of printing*****************************
#n_Row,n_Col_fav say (p_Landscape_Off)+(p_12CharPerInch)+p_Portrait)
set printer to
set device to screen
Type this into the Command text box and press Enter. Close all opened tables (if any) in order to see 4.
? is the correct way to display on screen. It will display on the next line of the current main window.
If you are getting no results try SET CONSOLE ON before your ?2+2
Another option, depending on your needs, is to use a WAIT WINDOW, ie WAIT WINDOW 'test'
You can also try ACTIVATE SCREEN prior to printing your text.

How can I see which processes/programs are sending/recieving data over internet in XP?

Is it possible to write a script to see which processes/programs are sending/receiving data over the internet in Windows XP? I have full administrator rights and I want to find a way to monitor data exchange on my machine without installing any additional software.
Step One: Windows XP
Open up the Run box by pressing the Windows key and R at the same time.
Put in CMD and press OK. The command prompt window will open up:
Step Two
In your open Command Prompt window, enter the following:
netstat -b 5 > activity.txt
and hit enter. (Note: to paste something into Command Prompt, you'll need to right click and click paste.)
If you forgot to run the prompt as an administrator (like I did in the screenshots above), just redo step one You can tell when it's running as administrator because instead of saying C:\Users\Username it says C:\Windows\system32.
If you've pasted the code right, a blinking cursor will... blink.
After a few minutes, press Ctrl+C. That'll stop the command.
Now type in command prompt activity.txt to open the log:
When you press Enter, your default text editor-probably Notepad-will open:
Now, scroll through the lists. You'll see that it's mostly your browser-but some times, there are programs like Google Talk's webcam program installed that call home even when you aren't using them.
Now that you've found any and all culprits that are programs accessing the internet (with and without your knowledge), you can either close them from the Task Manager or even uninstall them.

Resources