I have this AHK script running in my Windows 7. It opens a test1.xls file when I press the F2 key.
The script is fine but there is a little problem:
After a test1.xls has been opened, if I press the F2 key again, there will be another test1.xls opened.
That means if I press the F2 key 4 times, there will be 4 test1.xls opened.
I am looking for a solution for the problem.
Can you help me please?
Code: Select all
F2:: path := "C:\test1.xls" sleep, 100 XL := ComObjCreate("Excel.Application") sleep, 100 XL.Workbooks.Open(path) return