theocoza

Send {ENTER} not working

6 posts in this topic

#1 ·  Posted (edited)

Digging out some old posts...

Im new to autoit and im trying to automatize my softwares installation on new PC.

this code is not working:

#include <IE.au3>
#RequireAdmin

; Chrome download
$o_IE = _IECreate ()
_IENavigate ($o_IE, "https://dl.google.com/update2/1.3.28.15/GoogleInstaller_fr.application?appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7BC76EAF54-CD3B-5F21-FFDC-91E978A9E77F%7D%26lang%3Dfr%26browser%3D2%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26installdataindex%3Ddefaultbrowser")

; Chrome installation
WinWaitActive("Fichier ouvert - Avertissement de sécurité")
Send("{LEFT}{ENTER}")
_IEQuit($o_IE)

this code is working:

#include <IE.au3>
#RequireAdmin

; téléchargement de Chrome
$o_IE = _IECreate ()
_IENavigate ($o_IE, "https://dl.google.com/update2/1.3.28.15/GoogleInstaller_fr.application?appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7BC76EAF54-CD3B-5F21-FFDC-91E978A9E77F%7D%26lang%3Dfr%26browser%3D2%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26installdataindex%3Ddefaultbrowser")

; installation de Chrome
WinWaitActive("Fichier ouvert - Avertissement de sécurité")
Send("{LEFT}")
WinWaitActive("Fichier ouvert - Avertissement de sécurité")
Send("{ENTER}")
_IEQuit($o_IE)

This second solution is not clean and i'd prefer using the first one, if someone finds out why it is not working.

I tried other keystrokes and it seems I only have problems with {ENTER}.

Edited by Melba23
Changed title

Share this post


Link to post
Share on other sites



theocoza,

Welcome to the AutoIt forums.

Please do not "dig up old posts" - particularly when they have only a tenuous link to your problem - just start a new thread as I have now done for you. We ask you to do this for two main reasons:

  1. The language advances and the functionality might well be included in core or UDF code by now
  2. The changes in language syntax mean that it is likely that code from more than a couple of years ago may well not run under the current release interpreter without significant modification.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Ok, thanks for creating new thread for me (though i cant edit it now).

just for background info, i tried what had been previously said in the old thread:

; installation de Chrome
WinWaitActive("Fichier ouvert - Avertissement de sécurité")
Send("{LEFT}")
Sleep(100)
Send("{ENTER}")
_IEQuit($o_IE)

It's not wokring neither, i really have to call WinWaitActive a second time just to send {ENTER} keystroke.

Edited by theocoza

Share this post


Link to post
Share on other sites

Instead of using _IECreate, you could download the installer with InetGet and then launch it after ?

#RequireAdmin

InetGet("https://dl.google.com/update2/1.3.28.15/GoogleInstaller_fr.application?appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7BC76EAF54-CD3B-5F21-FFDC-91E978A9E77F%7D%26lang%3Dfr%26browser%3D2%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26installdataindex%3Ddefaultbrowser", "GoogleInstaller_fr.application")
ShellExecute("GoogleInstaller_fr.application")

 

Share this post


Link to post
Share on other sites

Thx for answer.

I didnt know this function, its working great and makes the code more readable.

Any idea why i have problems with send("{LEFT}{ENTER}")?

My first thought was it's sending its commands so fast, the application may not have the time to apply all the keystrokes. But send("{TAB}{TAB}{TAB}{TAB}{ENTER}") is sending the correct amount of {TAB}, it only has a problem on {ENTER}. And using send("{LEFT}") -> sleep(1000) -> send("{ENTER}") is not working neither...

Why do I need to call WinWaitActive a second time just to send("{ENTER}")?

Share this post


Link to post
Share on other sites

I tried to download an run the GoogleInstaller_fr.application, but I have an error "Impossible de télécharger l'application", so I cannot get the same window than you.

Did you try do use the Window Info Tool, to identify the controls ? Maybe you could use ControlClick (it's more reliable than Send).

A+ (et boujour de Franche-Comté !)

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