Jump to content

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


Recommended Posts

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!
Link to comment
Share on other sites

  • Moderators

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

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.

Link to comment
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!
Link to comment
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!
Link to comment
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.)

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!
Link to comment
Share on other sites

  • Moderators

FileOpenDialog stops your script basically until it receives a command.

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

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.

Link to comment
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!
Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...