Jump to content

Problem with Run()


Recommended Posts

Okay, I just made up this script/program that allows you to login and run programs as a specific user.

I just whipped it up for myself because I was getting tired of finding a shortcut to what I wanted, and then Right-Clicking > Run As... etc.

So I basically remade the windows Run dialog to suit my purposes. But anyway, on with my problem.

As you might have guessed, I use RunAsSet() to tell the script who to run files as, and one of the ways I make sure that someone has logged in correctly is by doing something like the following:

Opt('RunErrorsFatal', 0);

RunAsSet($User, @Computername, $Pass)
Run(@ComSpec & ' /c echo Checking login', '', @SW_HIDE);
If @error Then
  RunAsSet();
  DoStat('Error logging in. Possible invalid username/password.');
Else
  RegWrite($G_Reg, 'Username', 'REG_SZ', $User);
  DoStat('User ' & $User & ' logged in.');
EndIf

That makes sense right? We all know that if RunAsSet() was given invalid username/password info, then the Run() and RunWait() commands will error, so I just have it do a quick check right away by running something and seeing if it errors. Now, we all know what the @SW_HIDE in the Run() function is supposed to be doing, right? But it's not doing it! The big black window pops up, it's just for a second but it's still pestersome. Does anybody know why it is doing this? It only seems to happen when I've "logged in" with RunAsSet().

Thanks for reading, and if anybody is interested in the script/program, I'll probably post it on Virtual Plastic and in the Scripts and Scraps forum when it's all done and pretty looking.

Thanks again!

Link to comment
Share on other sites

I don't know about your problem, but how is this a GUI related question? You do realize that you posted this in the "GUI creation support" section?

[Edit]: Just so you don't create a 2nd thread, it might as well stay here since it did get started (and a forum admin can move it if they feel so moved to do so.) However, since this forum does not allow the deletion of posts of thread by thread starters, it will probably be best if it says here.

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

I don't know about your problem, but how is this a GUI related question?  You do realize that you posted this in the "GUI creation support" section?

Err, oops. I guess cus the script I was working on involved the GUI so much, I didn't even think to put it somewhere else.

Sorry about that! Hopefully an administrator will move this quickly. (I certainly won't double the post somewhere else, I know how annoying that is!)

Edited by Saunders
Link to comment
Share on other sites

  • Developers

As you might have guessed, I use RunAsSet() to tell the script who to run files as, and one of the ways I make sure that someone has logged in correctly is by doing something like the following:

Known about this issue and posted a workarround here sometime ago. Try and see if that works for you: #13924

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...