Jump to content

Give window titles that run as other user a prefix


Recommended Posts

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)

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 ;)



Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...