Snoobie
Snoobie

Reputation: 193

Autohotkey Open Run Dialog and execute command

I currently would like autohotkey to open the run dialog box, then focus on the box and enter a command to run Excel in its own instance. The issue I have I only know how to send key, but that isn't very reliable as if my computer lags it won't capture the text. Is there anyway to focus the dialog box and have text placed into it then ran?

^+e::
    SetKeyDelay, 0
    FileDlg := ComObjCreate("Shell.Application").FileRun, FileDlg := ""
    send, excel.exe /x {ENTER}
    return

Upvotes: 0

Views: 332

Answers (1)

alpha bravo
alpha bravo

Reputation: 7948

you could use COM directly on Excel

xl := ComObjCreate("Excel.Application")         ; createa a handle to excel file
xl.Workbooks.Add                                ; create new workbook
xl.Visible := True                              ; set Excel to be visible

Upvotes: 1

Related Questions