Sign in to follow this  
Followers 0
shreeks

How to automate the click of “Save as :” button?

9 posts in this topic

Hi,

I could automate the initiation of “Save as :” dialog box with default filename as SQL_S_data(refer line 1 of the code snippet). But couldn’t the automate the press of “Save” button. Below is the code that I’ve written for the same. Could anyone help on this.

Note : Send(“{Enter}”) doesn’t work and is not sending “Enter” key functionality.

Refer the picture for the further details.

post-64194-0-70572900-1305541941_thumb.p


Learning is Lifelong!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Look at the Control* functions in the help file.

Control* functions + AutoItInfo tool and you'll probably make quick work of it.

(ControlClick() function to be more specific)

Edit:

This is of course assuming this is a 3rd party dialog box you're trying to manipulate.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Sorry.

I forgot to attach the code snippet.Below, is the same.

Local $fname = FileSaveDialog("Save as :", @WORKINGDIR, "Excel file (*.xls)|Text file (*.csv)","","SQL_S_data.xls")  ; save as in working dir
Send("{Enter}")


Learning is Lifelong!

Share this post


Link to post
Share on other sites

Look at the Control* functions in the help file.

Control* functions + AutoItInfo tool and you'll probably make quick work of it.

(ControlClick() function to be more specific)

Edit:

This is of course assuming this is a 3rd party dialog box you're trying to manipulate.

Hi,

I tried using Control* functions + AutoItInfo tool but of no use. Secondly, the dialog box is the Save as: dialog of MS Excel.


Learning is Lifelong!

Share this post


Link to post
Share on other sites

Hi shreeks,

plz check, if the save button has the focus when sending {ENTER}, otherwise it won't work. (Just use the tab key to watch the cursor changing focus.)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Hi shreeks,

plz check, if the save button has the focus when sending {ENTER}, otherwise it won't work. (Just use the tab key to watch the cursor changing focus.)

Hi jo,

I tried with three possibilities but couldn't.

Option 1 :

Local $fname = FileSaveDialog("Save as :", @WORKINGDIR, "Excel file (*.xls)|Text file (*.csv)","","SQL_S_data.xls")  ; save as in working dir
WinWaitActive ( "Save as :");
Send("!s")

Option 2 :

Local $fname = FileSaveDialog("Save as :", @WORKINGDIR, "Excel file (*.xls)|Text file (*.csv)","","SQL_S_data.xls")  ; save as in working dir
ControlFocus ( "Save as :", "&Save", 1 )
Send("{Enter}")

Option 3:

Local $fname = FileSaveDialog("Save as :", @WORKINGDIR, "Excel file (*.xls)|Text file (*.csv)","","SQL_S_data.xls")  ; save as in working dir
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{Enter}")

Edited by shreeks

Learning is Lifelong!

Share this post


Link to post
Share on other sites

FileOpenDialog stops your script basically until it receives a command.

Why you would want to manipulate your own dialog box is beyond me.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

FileOpenDialog stops your script basically until it receives a command.

Why you would want to manipulate your own dialog box is beyond me.

"FileOpenDialog stops your script basically until it receives a command." - Oops. I never knew.

FileOpenDialog() opens a dialog box with "Save" button. I need to some how automate the click of "Save" button. Any ideas? You can refer the previous reply for the possible alternatives(code snippets) that I tried.


Learning is Lifelong!

Share this post


Link to post
Share on other sites

Hi shreeks,

it's just as SmOke_n wrote, script is paused while the dialog is shown(thus you would have to have a second script that closes your dialog box). And thinking a second about it, SmOke_n is also right with his comment *Why you would want to manipulate your own dialog box is beyond me*.

Maybe you can tell us, what you are trying to achieve.

jofun

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