Sign in to follow this  
Followers 0
glowfire

Downloading a File behind auth. form and from a discon. TS Session

6 posts in this topic

Hi Guys,

I am prette new to AutoIt and it was my last hope that I can solve my issue.

What I need to do:

1. Navigate to a web-site

2. Fill in a simple form (which places a cookie on my system)

3. pars through a list of links and download a specific file with a dynamic URL (download requires this cookie - otherwise I only get the login page)

My issue is that the script has to run on a disconnected terminal server session and therefore has no ability to interact with the desktop.

I got a script which is doing everything I want but it fails when it runs on that disconnected sesseion.

Do you guys have an idea what I can do to get the script running?

Thank

Glowfire

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

How do you initiate? You can create a task, and your script will run on session 0(no desktop)...no issues there, but some things will never occur (such as a window being active) Check out the wiki page.

http://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F

I'd suggest writing the results of all actions to a log file, so you see what step fails, so you can work on a fix. To help move the script along, don't use any interminable function calls...always do finite loop, or add a max wait (generally an optional variable).

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Also, look at the _IE* functions to do what you're trying to do, this way there's no need for any controlclick or controlsend commands.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Thanks for your help so far!

The _IE* functions doesn't provide any function to handle a file open windows dialog and therefore it doesn't work :(

It seems tat the controlsend() and controlclick() functions will help here. However I don't get them to work as I would expect it.

The Button I would like to click has following data:

>>>> Window <<<<
Title: Windows Internet Explorer
Class: #32770
Position: 521, 269
Size: 391, 274
Style: 0x96C80284
ExStyle: 0x00010101
Handle: 0x00520982

>>>> Control <<<<
Class: Button
Instance: 3
ClassnameNN: Button3
Name:
Advanced (Class): [CLASS:Button; INSTANCE:3]
ID:
Text: Save &as
Position: 10, 170
Size: 365, 29
ControlClick Coords: 60, 14
Style: 0x5000200E
ExStyle: 0x00000000
Handle: 0x0004062E

>>>> Mouse <<<<
Position: 594, 475
Cursor ID: 0
Color: 0x000000

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
&Open
&Save
Save &as
Cancel


>>>> Hidden Text <<<<

And i try it with this line of code:

ControlClick("Windows Internet Eplorer", "", "[CLASS:Button; TEXT:Save &as; INSTANCE:3]")

But it doesnt work - I guess I have missed something.

Share this post


Link to post
Share on other sites

Have you tried retrieving the link's href and then downloading the file with InetGet()?

Share this post


Link to post
Share on other sites

Those window popups are modal, and will deadlock your script (it will not start until manual intervention to close the popup). There are ways around it, but InetGet is probably the easier route. The other option is starting a second script to click the link, so it's deadlocked instead. Another way involves focusing on the link, and sending {enter}, rather than _ie click action.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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