Sign in to follow this  
Followers 0
Buffo

Give window titles that run as other user a prefix

1 post in this topic

I wrote a little script that runs programs in an other user context.

To see in which context it is running I would like to read out the original window title and combine it with the prefixed username. For example the command-prompt: Instead of "Command Prompt" I would like "Admin - Command Prompt".

With some programs works this alright, but in the most cases it won't. Here my code:

...
$user = "Admin"
$pid = Run(MyProg ...)
...
$win_list = WinList()
For $n = 1 To $win_list[0][0]
$title = $win_list[$n][0]
$proc  = WinGetProcess($title)
If $proc = $pid Then
WinSetTitle($title, "", $user & " - " & $title)
ExitLoop
EndIf
Next

RunAsSet() and so on are correct but I want to show only the interesting code.

I know that it can work only in windows which do not change their titles periodly but for example the program

"MyUninstaller" from www.nirsoft.net isn't showing the title correct.

Is there an error in reasoning or can I change my script to better working one.

Or even better: @all AutoIt-Gurus out there: Is there a simpler and/or better solution to manage?

Thx for your replies ;)

Cu,

Buffo

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0