Sign in to follow this  
Followers 0
jtucker

Firefox Save File Dialog

8 posts in this topic

Hi all,

I am new to the forums so bear with me. I have tried searching around for quite a while for a solution to my problem but, I couldn't find any so I registered here to ask for help.

I am trying to automate the download of a file from a website using Ruby and FireWatir plus the WIN32OLE AutoItX3 Control. My script works fine if I am logged in, but fails if I run it as a scheduled task (with username/password) while noone is logged in. After doing some research it is now obvious that the win commands and the mouse move and click commands won't work without a user logged in.

I need a way to have the 'Save File' button pressed on the dialog that pops up when I try to download the file. I have tried using the ControlSend command to send an {ENTER} key press but that fails. Using the AutoIt window inspector I can see that the dialog box does not have a control ID. It seems my script will just skip over the AutoIt commands like WinWaitClose when I am not logged in.

Can anyone help me solve this problem? I have seen others with similar problems and the solution seems to be ControlSend, but that is not working for me. If AutoIt cannot perform what I want it to do, does anyone have an alternative program or solution I can try?

(I also have another script that needs to be able to log into a webpage using the windows authentication popup, and AutoIt isnt working there either when I am not logged in.)

Thanks,

jtucker

Share this post


Link to post
Share on other sites



--UPDATE---

Tried to do this:

autoit.ControlSend("Opening #{db_name}.EXE", "", "[CLASS:MozillaWindowClass; INSTANCE:1]", "{ENTER}")

...doesn't work when not logged in. Works fine if i'm logged in.

Share this post


Link to post
Share on other sites

It's because each user has his/her/its own desktop. I include "it" because the system account isn't a person and thus doesn't have a gender. The system account has its own set of windows that it is allowed to interact with. It cannot interact with another user's desktop. Not without weird tweaks anyways.

Share this post


Link to post
Share on other sites

It's because each user has his/her/its own desktop. I include "it" because the system account isn't a person and thus doesn't have a gender. The system account has its own set of windows that it is allowed to interact with. It cannot interact with another user's desktop. Not without weird tweaks anyways.

I have my scheduled task running as an admin on the remote machine for that reason. There still seems to be a problem interacting with the desktop. I need some "wierd tweaks" right about now! : )

Share this post


Link to post
Share on other sites

The admin account has the admin's desktop. It's separate from the logged in user unless the logged in user is on the admin account.

I'm afraid I can't help you with those tweaks. I've never messed with that kind of thing, I only know it's possible.

Share this post


Link to post
Share on other sites

Well, the user my script runs under just happens to be part of the administrators group... but anyway. I didn't think this would be possible for the reasons you have stated and based on my research.

Would you be able to recommend any other way to pull a file from a webpage without using something that needs to be logged in or clicked to work?

Share this post


Link to post
Share on other sites

I suppose you could use the HTTP UDF and read the html code, then download the file yourself. It's a little bit more work but you don't have to worry about user accounts.

Share this post


Link to post
Share on other sites

I was hopeing I wouldn't have to do something like that. : ( Thank you for your help though!

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