Sign in to follow this  
Followers 0
slouw

Send("{F12}") not working

8 posts in this topic

Hi There Memebers

Very grateful for any troubleshooting tips.

I have a situation where Send("{F12}") does not work from within a script.

The context is with an open Word, Excel or other program for which F12 brings up the "Save As" DB.

Manually entering F12 from one of these programs duly brings up the Save As DB.

But sending F12 from within the script seems to do nothing.

If after invoking the script I then press F12 manually from the keyboard the script moves on to invoke the next line of conde which is WinWaitActive("Save As").

The script then goes on to save the file as the new filename in the way intended.

So I know that the script is hanging waitng for the "Save As" DB which never appears.

The script used to work not sure what has changed.

I realise this could have many different possible causes.

It is troubleshooting ideas I am hoping for here.

I have tested other send key items in place of my F12 including these and they work as expected:

Send("{ENTER}")

or this sequence brings up Help:

Send("Sleep 500 then F5 then sleep 500 then exit")
Sleep(500)
Send("{F1}")
Sleep(500)
Exit

Many thnks for any rpelies whatsoever....

Share this post


Link to post
Share on other sites



Why not use the Word UDF that comes with AutoIt to automate Word?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thankyou...

JohnOne yes indeed the correct window is active. For instance it might be word for which I am wanting the Save As DB to be invoked. I am not sure I understand the 500ms comment. I usually for not have sleep cmd in there at all. I have put them in to see if it helped...

Water - What is word UDF? I seached AutoIT help and got a hit on _WordErrorHandlerRegister.... Is that what you are getting at? I will read up on it...

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

In the full Help file, go to the section down the bottom, named 'User Defined Function Reference'.

Open that, and down the bottom you will find 'Word Management'.

As for Active Window, you are mistaking what JohnOne said.

If you have the Word window up and running, and then got to another Window to double-click on your script, then the Word window has lost focus and is no longer active. You need to make sure, that your 'F12' is directed at the Word window, by making it active, with some of the Win commands (WinActivate, WinWaitActive, etc). You will also need to have a delay (sleep) in there to give time for the Word window to become active.

Note - I haven't really looked at your code, so you may have some of that already, but obviously not enough or with understanding.

Edited by TheSaint

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

In the full Help file, go to the section down the bottom, named 'User Defined Function Reference'.

Open that, and down the bottom you will find 'Word Management'.

You can also type word in the Index tab, open one of the pages and click back to Contents tab to see where it is.
1 person likes this

Share this post


Link to post
Share on other sites

Very true, but I'm a click man .... and avoid typing as much as I can ..... :muttley: ........ ;) ;)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

AutoIt comes with a UDF (User Defined Functions Library) to automate Word. If you need to work with Word 2007 or later you could have a look at my WordEx UDF (for download please see my signature).


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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
Sign in to follow this  
Followers 0