Jump to content

ShellExecute seems to be waiting


lozman
 Share

Recommended Posts

I am currently trying to automate an install using AutoIT 3, but I can't get something to work right.

Here is the code (I put the msgbox statements in just for troubleshooting);

ShellExecute("install.msi")
MsgBox(1, "Msg1", "Msg1")
WinWaitActive("Open File - Security Warning")
Send("!r")
MsgBox(1, "Msg2", "Msg2")

If I run this install.msi file manually a windows dialog appears to warn me that it is unsigned. This is the only dialog that comes up as part of the install and I want to get autoit to automatically hit the "Run" button. (this is what the script above is supposed to do).

However although ShellExecute is supposed execute the file then carry on through the script, it doesn't seem to do that in this case.

The reason I have put the MsgBoxes there is to try and figure out if it was simply a problem with WinWaitActive finding the correct window, but even the MsgBox line doesn't get executed (Msg1 doesn't appear).

This is what seems to be happening;

1. I run script above.

2. AutoIt executes "install.msi".

3. as part of install.msi executing, the dialog comes up warning that the msi file is unsigned.

4. At this point you would expect the first MsgBox (Msg1) to be displayed but it is not.

5. Only after I hit "Run" on the warning dialog (manually) does Msg1 get displayed.

From this, I can tell that the script is pausing right after the ShellExecute line until I hit Run on the warning dialog.

The question is why? How can I get around this?

If you need any further info please ask :)

Thanks,

Lozman.

Link to comment
Share on other sites

Hi lozman welcome to autoit. This is my work around when I tried to do an install and Security warning windows appears.

AdlibEnable('_WinTitle')
ShellExecuteWait("install.msi")
AdlibDisable()


Func _WinTitle()
    If WinActive('Open File - Security Warning') Then ControlClick('Open File - Security Warning',"","&Run")
EndFunc
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

I've been having exactly the same problem with Open File - Security Warning while trying to script the install of Daemon Tools.

Everything comes to a screachin freakin halt. Danny's AdlibEnable didn't work for me either. The system halts at the Security Warning. I tried changing from /noexecute=optin to /noexecute=optout in boot.ini, no diff. Need 2x4, pine, to whack system awake again.

Anybody got wood?

AdlibEnable ( "OpenFile" )

ShellExecute ( "daemon410-x86.exe" )

Sleep ( 200 )

AdlibDisable()

Func OpenFile()

MsgBox ( 0, "yo" )

If WinActive( "Open File - Security Warning" ) Then

ControlClick( "Open File - Security Warning","","&Run" )

EndIf

EndFunc

NOTE:

MsgBox ( 0, "yo" ) never fires.

UPDATE:

See, www.mcse.ms/message1030070.html for a way to disable the Open File - Security Warning dialog box:

Run gpedit.msc, and go to Local Computer Policy->User

Configuration->Administrative Templates->Windows

Components->Attachment Manager and enable "Default risk level for file

attachments", and then enable "Inclusion list for low risk file types"

and add to this list the file extensions that you want to open without

triggering this ...

Hi lozman welcome to autoit. This is my work around when I tried to do an install and Security warning windows appears.

AdlibEnable('_WinTitle')
ShellExecuteWait("install.msi")
AdlibDisable()
Func _WinTitle()
    If WinActive('Open File - Security Warning') Then ControlClick('Open File - Security Warning',"","&Run")
EndFunc
Edited by uptimeinf
Link to comment
Share on other sites

@uptimeinf I don't know the reason why, but when I tested the script using ShellExecute() function I get this message in SciTe.

==> Unable to execute the external program.:

ShellExecuteWait(@ScriptDir & "\daemon410-x86.exe", "'', @ScriptDir)

I tried different ways to use ShellExecute and every single one failed to execute Daemon410-x86.exe. The beauty of AutioIt is using the HELP FILE and finding another way to acomplish what you want. Beside ShellExecute() there are Run() and Runwait() functions.

Try this one:

AdlibEnable('_WinTitle')
    Run(@ScriptDir & "\daemon410-x86.exe", @TempDir, @SW_SHOW)
    WinWait("DAEMON Tools 4.10 (32 bit)","Welcome to the DAEMO")
AdlibDisable()

;~ From here continue the next steps of your script to install Daemon.

Func _WinTitle()
    If WinActive('Open File - Security Warning') Then ControlClick('Open File - Security Warning',"","&Run")
EndFunc

Note:

Don't forget that after the Run() function you need to wait for the Security Warning windows to pop out before AdlibDisable(). Otherwise AdliDisable will run before Security Warning windows pop out.

Edited by Danny35d
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
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...