Jump to content

RunAsSet and @SW_HIDE


nobby
 Share

Recommended Posts

Hey,

When running the following script, notepad is hidden:

RunWait("notepad.exe","",@SW_HIDE)

But if I use the same line with RunAsSet, notepad is visible:

RunAsSet("administrator", "domain", "password", 0)
RunWait("notepad.exe","",@SW_HIDE)
RunAsSet()

Is there a way of hiding notepad (or any other programs) when running as?

CheersNobby

Link to comment
Share on other sites

Hey,

When running the following script, notepad is hidden:

RunWait("notepad.exe","",@SW_HIDE)

But if I use the same line with RunAsSet, notepad is visible:

RunAsSet("administrator", "domain", "password", 0)
RunWait("notepad.exe","",@SW_HIDE)
RunAsSet()

Is there a way of hiding notepad (or any other programs) when running as?

<{POST_SNAPBACK}>

Rerun your own script with specific parameters and in the beginning of your script check if the specific parameters were passed and then run notepad with @SW_HIDE.
Link to comment
Share on other sites

Here is a way of getting around it, not very pretty but it works.

Split the script in 2, use the first to call the second as Admin

Script1

RunAsSet("administrator", "domain", "password", 0)
Run("script2.exe","",@SW_HIDE)
RunAsSet()

Script2

RunWait("notepad.exe","",@SW_HIDE)

CheersNobby

Link to comment
Share on other sites

  • Developers

Yes it is a bug in windows. I don't think AutoIt can work around it.

<{POST_SNAPBACK}>

Here a workaround posted a while ago...

its a script example which restars itself ..

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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
 Share

  • Recently Browsing   0 members

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