Jump to content
Sign in to follow this  
Anders

Logging-issue and minor details

Recommended Posts

Anders

Hi all of you...

I just discovered the program AutoIt the other day, and I was so impressed, that i wanted to try some out myself.

First I've read some documentation on the program - and tried the quick-guides - made me even more eager to get started.

anyways, Ive created this small script, just to get started - but i seem to have some issues around the logging part... I cant seem to get the Scite app. to aknowledge the logging part (and i do not quite understand this sentence: #include <File.au3> --what does this mean?)

Ive already tried searching for the answers, but i've just seem to stared me blind on it :-/

(i've posted the whole script, so that maybe if you see any other errors, you can give me some good pointers)

here it is:

---------------------

#include <File.au3>

$slogFilePath="D:\conncycle.log"

Ping ("www.Google.com",60000)

If @error = 0 Then

; Write starting cycle to log w. timestamp

_FileWriteLog($sLogPath,"Could not reach the Internet", -1)

_FileWriteLog($sLogPath,"ConnectionCycle started", -1)

_FileWriteLog($sLogPath,"Stopping VUZE", -1)

; Stopping VUZE

MouseClick ("right", 1321, 884, 1, 0)

MouseClick ("left", 1226, 812, 1, 0)

_FileWriteLog($sLogPath,"Stopped VUZE succesfully", -1)

; Stop OpenVPN GUI

_FileWriteLog($sLogPath,"Stopping OVPN", -1)

MouseClick ("right", 1304, 887, 1, 0)

MouseClick ("left", 1272, 725, 1, 0)

_FileWriteLog($sLogPath,"Stopped OVPN succesfully, -1")

; Start OpenVPN GUI

_FileWriteLog($sLogPath,"Starting OVPN, -1")

MouseClick ("right", 1304, 887, 1, 0)

MouseClick ("left", 1255, 709, 1, 0)

; Password+user authentication

_FileWriteLog($sLogPath,"Entering OVPN-authentication, -1")

WinWait ("Open VPN - User Authntication, -1")

MouseClick ("left", 731, 415, 1, 0)

Send ("USER-Name", 1)

MouseClick ("left", 699, 441, 1, 0)

Send ("passWORD", 1)

MouseClick ("left", 669, 474, 1, 0)

_FileWriteLog($sLogPath,"OVPN-authentication entered succesfully", -1)

; (now connected to OVPN)

Sleep (5000)

; Start VUZE

_FileWriteLog($sLogPath,"Starting VUZE", -1)

MouseClick ("left", 1321, 882, 2, 0)

Sleep (1000)

Mouseclick ("left", 60, 29, 1, 0)

Mouseclick ("left", 77, 65, 1, 0)

WinSetState ("Vuze", "", @SW_MINIMIZE)

_FileWriteLog($sLogPath,"VUZE started succesfully", -1)

_FileWriteLog($sLogPath,"ConnectionCycle executed succesfully", -1)

; This will create a tooltip in the upper left of the screen

ToolTip("INFO: Connection Cycled", 0, 0)

Sleep(2000) ; Sleep to give tooltip time to display

Else

_FileWriteLog($sLogPath,"Reached www.Google.com succesfully - NO CYCLE NEEDED", -1)

EndIf

; then the script have to sleep for 30 minutes and then run again:

Sleep (1800000)

$i = $i + 1

Wend

;An infinite loop

While 1

Wend

8.1.3

-----------------------

Hope you can & will help me..

Kind regards

/Anders

Share this post


Link to post
Share on other sites
youknowwho4eva

try using controlclick and controlsend. the includes are to use certain functions that are not default. it links to that au3 so it can use the functions in it.


Giggity

Share this post


Link to post
Share on other sites
PsaltyDS

Hi all of you...

I just discovered the program AutoIt the other day, and I was so impressed, that i wanted to try some out myself.

First I've read some documentation on the program - and tried the quick-guides - made me even more eager to get started.

anyways, Ive created this small script, just to get started - but i seem to have some issues around the logging part... I cant seem to get the Scite app. to aknowledge the logging part (and i do not quite understand this sentence: #include <File.au3> --what does this mean?)

Ive already tried searching for the answers, but i've just seem to stared me blind on it :-/

Hope you can & will help me..

Kind regards

/Anders

The function _FileWriteLog() is not part of the standard "built-in" set of AutoIt functions. It is declared in an "include file" called File.au3. Put your script in SciTE and put the cursor on that file name, then hit ALT-i and it will open that "User Declared Functions (UDF)" file in another tab. If you put the cursor on the function and hit CTRL-j instead, it will open the include file that contains that function and jump to the function.

You seem to put the file name in $slogFilePath, but all your calls use $sLogPath. Is that variable declared somewhere else?

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  

×