Jump to content

Include ?


MattX
 Share

Recommended Posts

I have this code which launches a prog called Boardworks. I need to capture which user is launching it though so thought I would use the _FileWriteLog feature.

Problem I have is that I am not sure how the #inlude works and also can you compile some code that has the #include statement in ?

My code is called historylog.au3 does the include have to be that name ?

#include File.au3
Dim $sLogPath = "c:\logs\sitelog.txt"
Dim $sLogMsg = "History Boardwords Opened"
Dim $user = @UserName
_FileWriteLog($sLogPath, $sLogMsg, $user)
Run("C:\Program Files\Boardworks\KS2 History\Boardworks KS2 History.exe")
BlockInput(1)
Sleep(3000)
If WinExists("Boardworks KS2 History") Then
   Send("{ENTER}")
Else
   Exit
EndIf
Link to comment
Share on other sites

I think is

#include <File.au3>

and you have to be in the Autoit folder to execute or compiling this script. After compilation you can use it freely since the whole file.au3 is... included :idiot:

Otherwise you can just copy the whole File.au3 in the botton of the scripr.

Btw... FileWriteLog is really a simple function, maybe you can write your own?

Link to comment
Share on other sites

I think is

#include <File.au3>

and you have to be in the Autoit folder to execute or compiling this script. After compilation you can use it freely since the whole file.au3 is... included :idiot:

Otherwise you can just copy the whole File.au3 in the botton of the scripr.

Btw... FileWriteLog is really a simple function, maybe you can write your own?

<{POST_SNAPBACK}>

I'm afraid I'm not that intelligent to write my own !! I wish I had the knowledge of some of you guys - I just manage to scrape through doing my small scripts every so often...
Link to comment
Share on other sites

Great I have this working but need to add the username - Do I have to edit the actual function to get the user name in the log too ?

Like declare the $user = @username within the function and not in my original script ?

Link to comment
Share on other sites

Great I have this working but need to add the username - Do I have to edit the actual function to get the user name in the log too ?

Like declare the $user = @username within the function and not in my original script ?

<{POST_SNAPBACK}>

I think I have done it - I edited the function to declare the $user

Local $user
$user = @username
$sMsg = $sDateNow & " " & $sTimeNow & " : " & $sLogMsg & $user
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...