user1070774
user1070774

Reputation: 19

Send command doesn't send keys in autoit script

I started writing code like this using AutoIT V3

$file = "G:\FullSetup800203.exe"

ShellExecuteWait($file)

Sleep(75000)

WinWaitActive("M1 Setup")

Send("!n")

It all works but send command doesn't work.

I am using windows 7 64-bit machine.

Upvotes: 1

Views: 10209

Answers (4)

Christine Reardon
Christine Reardon

Reputation: 26

add Administrator to the opening of cmd.exe ControlSend("Administrator: C:\Windows\system32\cmd.exe", "", "", "cd C:\Program Files (x86)\thefile")@SW_SHOW)

Upvotes: 0

tiemco
tiemco

Reputation: 86

After long searching why the script works on Windows XP and not on Windows 7 64 bit I discovered the cause. On Windows 7 the AutoIt script has to run as Administrator to send keystrokes and access controls for some applications.

Upvotes: 0

Rutger
Rutger

Reputation: 1

$file = "G:\FullSetup800203.exe"

ShellExecute($file)

Sleep(75000)

WinWaitActive("M1 Setup")

Send("!{n}")

try that.

Upvotes: 0

Matt
Matt

Reputation: 7160

I may be wrong, but it looks to me as though you are using ShellExecuteWait when you don't actually want to Wait.

What is happening right now is that you are running the file and WAITING for it to close, once the process is exitted then you sleep for another 75 seconds before waiting for some window to be active and then sending the characters. Is that what you intended?

The send command always sends the keys. To say it "doesn't work" is not right, it just do what you expected it to.

Upvotes: 3

Related Questions