Jump to content

Recommended Posts

Posted (edited)

Edited:

You shud probably use RunWait

or something like

Do
    Sleep(10)
until WinExists($ConfigWindowTitle) = 1

or

WinWait($ConfigWindowTitle)

One of them shud work for you (probably WinWait)

After that add

Winactivate

winwaitactive

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Posted

Thanks for all the help once again..

I now think it's working with the code below.

What was making things worse is that I was trying to run the scheduled task with a user account which I only really connect to over RDP.

When I disconnected from my session (even though the user was still logged in - I could see the account in task manager still logged on from the other account logged on at the console) the task would run as scheduled but for some reason the script opened firefox but couldn't bring it into focus?!? Even if it worked OK if I was still connected to the session.

You'll notice I have left a sleep in too after WinWaitActive - no idea why but sometimes (1 in 10) it was missing a {tab} which caused issues. This seems to fix though.

$ConfigWindowTitle = "[CLASS:MozillaUIWindowClass]"
; or
; $ConfigWindowTitle = "Mozilla Firefox"

Run("C:\Program Files (x86)\Mozilla Firefox\firefox.exe") ;Run firefox remove include x86 for 64bit system

WinWait($ConfigWindowTitle)
;Sleep(15000)

;$var = 
WinActivate($ConfigWindowTitle)
;ConsoleWrite($var)
; or
;MsgBox(0, "", $var)

WinWaitActive($ConfigWindowTitle) ; Wait for it to be active before sending keystrokes.

sleep(2000)

Send("{TAB 7}") ;focus address bar

Send("http://192.168.1.1/setup.cgi?next_file=Status.htm{ENTER}") ;send url

WinWaitActive("Authentication Required") ; wait for password box

Send("{ENTER}")

WinWaitActive("Modem Router Status") ;wait for modem window

Send("{TAB 11}{ENTER}") ;select disconnect

; WinClose($ConfigWindowTitle)

Now I'll wait until the morning to see if my router d/c's as expected at 2am...

Posted

For RDC i dont know how its working on focusing after you DCC from session becose when i DCC from it i dont see whats happening on page :mellow:.

Send isnt reliable in focusing controls especialy if its for browser and even if you used SendKeepActive and you dont have information if a page is loaded or not.

There are probably alot of other wayes to try do it

firstone is to try with IE with _IE instead of FireFox

The other is to search on forum to see if there is FireFox udf in Exsample part of forum

Instead send tab for focus address bar to use ControlFocus ( probably combinating ControlClick ControlSend ControlSetText and ControlGetFocus ControlCommand) or to use command from UDF.

For ie its simple

#include <IE.au3>

$oIE = _IECreate ("http://192.168.1.1/setup.cgi?next_file=Status.htm")

It will wait (pause script) for page to load and you can use whall list of _IE commands to submit data or click on buttons in ie win.

There r alot of combinations and you need to finde one that is working best for you.

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Posted

For RDC i dont know how its working on focusing after you DCC from session becose when i DCC from it i dont see whats happening on page

Haha I know, I can only 'see' that its not focused the page when I reconnect to the session and see firefox in the background behind other windows.

It has been working as expected now for a good few scheduled attempts, which is great! Thanks once again for all the help everyone.:(

I will certainly be looking at other solutions and maybe IE is the way i'll go... but I'm stubbourn and have a I've started so i'll finish attitude.!

i'm slowly learing the different commands so will be trying them out soon. :mellow:

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
  • Recently Browsing   0 members

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