Sign in to follow this  
Followers 0
ismadmin

new to autoit

16 posts in this topic

I created a conditional exe with autoit to detect whether a program was installed and to install it using admin account if it wasn't. It runs great if I sit at the users desk and click on it to run. If I try to add it to a Windows XP logoff script via group policy, the xp logoff process cuts it off before it finishes. I can see the script start and luanch the installer, but then the 'saving network settings box' pops up and i get the Windows logon screen. Any ideas how to allow my script to run at logoff?

Share this post


Link to post
Share on other sites



If you have a script, it needs to wait for your autoit program to finish.

And your autoit program needs to wait for an installer program to finish.

Share this post


Link to post
Share on other sites

If you have a script, it needs to wait for your autoit program to finish.

And your autoit program needs to wait for an installer program to finish.

What?

The OP wants to know if there is a way to pause the shutdown process while the Autoit script performs an install. Do you know how to do that? If so, please share that info.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

u could use the dos command for cancel shutdown and then let autoit logoff again at the end of your script

Edit: the dos command is Shutdown -a

Edited by zeroZshadow

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites

u could use the dos command for cancel shutdown and then let autoit logoff again at the end of your script

Edit: the dos command is Shutdown -a

I tried that- same result. It behaves as if Windows believes the logoff script is complete.

Share this post


Link to post
Share on other sites

What?

The OP wants to know if there is a way to pause the shutdown process while the Autoit script performs an install. Do you know how to do that? If so, please share that info.

via Group Policy, you can have a script run before system logs you off. I thought that was what he was doing.

Share this post


Link to post
Share on other sites

via Group Policy, you can have a script run before system logs you off. I thought that was what he was doing.

Exactly right. It seems Windows doesn't want me to finish any Autoit exe's though. I've tried placing the exe directly as the loggoff script, having a .bat logoff and calling the exe and even copying the exe to the local drive and calling it locally. I've used dos cmds within the autoit exe to runas and provide admin username and password and I've also tried using the built in Autoit RunAsSet.

Share this post


Link to post
Share on other sites

Exactly right. It seems Windows doesn't want me to finish any Autoit exe's though. I've tried placing the exe directly as the loggoff script, having a .bat logoff and calling the exe and even copying the exe to the local drive and calling it locally. I've used dos cmds within the autoit exe to runas and provide admin username and password and I've also tried using the built in Autoit RunAsSet.

odd. Must it be run at logoff? Seems it would be just as effective at logon. I know that's not the answer you're looking for, but just saying that could be an interim work around.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Like I said, does your AutoIt program wait for your installer to finish? Post your script if you can.

Share this post


Link to post
Share on other sites

@Joon,

I think that I see where you are headed now.

Sorry, I just did not understand your first post.

So, the OS launches the AutoIt script like a RunWait and as long as the AutoIt script is waiting for the install to complete, the OS should wait too - is that it?

-MSP-


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

So, the OS launches the AutoIt script like a RunWait and as long as the AutoIt script is waiting for the install to complete, the OS should wait too - is that it?

That's what I'm thinking.. :)

Share this post


Link to post
Share on other sites

Like I said, does your AutoIt program wait for your installer to finish? Post your script if you can.

apolgoies in advance for sloppiness\rookieisms

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

Run('cmd')

If FileExists("c:\windows\IE7\iexplore.exe") Then

WinWait("C:\WINDOWS\system32\cmd.exe","")

If Not WinActive("C:\WINDOWS\system32\cmd.exe","") Then WinActivate("C:\WINDOWS\system32\cmd.exe","")

WinWaitActive("C:\WINDOWS\system32\cmd.exe","")

Send("\\dc01\sources\execss{SHIFTDOWN}`{SHIFTUP}1\adobe\acrobat_reader8.exe{ENTER}")

Else

WinWait("C:\WINDOWS\system32\cmd.exe","")

If Not WinActive("C:\WINDOWS\system32\cmd.exe","") Then WinActivate("C:\WINDOWS\system32\cmd.exe","")

WinWaitActive("C:\WINDOWS\system32\cmd.exe","")

Send("runas{SPACE}/user{SHIFTDOWN};{SHIFTUP}domainname\adminuser\\dc01\sources\execss{SHIFTDOWN}`{SHIFTUP}1\ie7\ie7setup.exe{ENTER}")

WinWait("C:\WINDOWS\system32\cmd.exe","")

If Not WinActive("C:\WINDOWS\system32\cmd.exe","") Then WinActivate("C:\WINDOWS\system32\cmd.exe","")

WinWaitActive("C:\WINDOWS\system32\cmd.exe","")

Send("adminpassword")

EndIf

This runs great and does exactly what I want when I double click it to run, but when I run as logoff script, Windows appears to consider it completed before it is actually finished with its work

Is there something I need to add on tothe end of the script to make it wait until the install is done before closing?

Share this post


Link to post
Share on other sites

just looked at help files for runwait, I think I see how I can use this to overcome the problem. I'm rewriting now and I'll let you know how it works. Thanks guys

Share this post


Link to post
Share on other sites

Your system environment might different during logoff.

Try this.

If FileExists("c:\windows\IE7\iexplore.exe") Then
    RunWait("\\dc01\sources\execss~1\adobe\acrobat_reader8.exe")
Else
    RunAsSet("adminuser", "domainname", "adminpassword")
    RunWait("\\dc01\sources\execss~1\ie7\ie7setup.exe")
    RunAsSet()
EndIf

Share this post


Link to post
Share on other sites

I'll try it!

thanks.

Share this post


Link to post
Share on other sites

looks like that did it. nice and compact too. Thanks Joon

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