Jump to content
Sign in to follow this  

An example of running .Au3 from UltraEdit

Recommended Posts

hello, just installed AutoIt3 today

here is a sample .wsf file that runs in W2k, XP and W2k3 with latest UltraEdit

save this in same folder as AutoIt3.exe

for example d:\program files\AutoIt3\AutoItWrap.wsf

to configure, start UltraEdit, click Advanced, Tool Configuration and type in

Command: wscript "D:\Program Files\AutoIt3\AutoItWrap.wsf" /script:"%f"

Name: AutoIt3

to test if you got it right, paste this into the ultraedit blank window

; This is my first script

MsgBox(0, "My First Script!", "Hello World!")

save the above anywhere as something ending with .au3 and click on

Advanced, AutoIt3

let me know if any questions, hope to contribute and get some learning in return





<job id="AutoIt3 Call Wrapper">

<?job error="true" debug="true" ?>



Submits the AutoIt script specified in the argument as a batch job.




helpstring="Path/filename of the AutoIt3 .au3 script you want to run."





Example: WScript AutoItWrap.wsf /script:"c:\myprog.au3"



<object ID="WinShell" progid="WScript.Shell"/>

<object ID="Network" progid="WScript.Network"/>

<object ID="FSO" progid="Scripting.FileSystemObject"/>

<script language="VBScript">

Option Explicit

Const DQ = """"

' Const vbOkOnly = 0

' Const vbInformation = 64

' Const vbCritical = 16

Call main

' ================================================

Sub main

Dim AutoProg

Dim Autoexe

Dim WorkingDir

Dim BaseFileName

Dim LogFile

Dim ListFile

Dim RunLine

Dim uedit



If WScript.Arguments.Count <> 1 Then

With WScript



End With

End If

AutoProg = WScript.Arguments.Named("script")

If Not FSO.FileExists(AutoProg) Then

With WScript

.Echo "Problem--I don't find any such file as " & AutoProg & "!"


End With

End If

If LCase(FSO.GetExtensionName(AutoProg)) <> "au3" Then

With WScript

.Echo "Problem--" & AutoProg & " isn't an AutoIt3 script!"


End With

End If

BaseFileName = FSO.GetParentFolderName(AutoProg) & "\" & FSO.GetBaseName(AutoProg)

' LogFile = BaseFileName & ".log"

' ListFile = BaseFileName & ".lst"

uedit = "uedit32.exe "

AutoExe = WinShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\HiddenSoft\AutoIt3\InstallDir") & "\AutoIt3.exe"

If Not FSO.FileExists(AutoExe) Then

WScript.Echo "Problem--AutoIt3.exe is not found where the registry says it should be!"


RunLine = DQ & AutoExe & DQ _

& " " & DQ & AutoProg & DQ

' _

' & " -log " & DQ & LogFile & DQ _

' & " -print " & DQ & ListFile & DQ _

' & " -nologo"

' MsgBox RunLine

' Call WinShell.Run(RunLine, SHOWNORMAL, True)

Call WinShell.Run(RunLine, SHOWMINIMIZED, True)

' If CheckLog(LogFile) Then

' MsgBox FSO.GetFileName(AutoProg) & " ran with errors--check your log file!", vbOKOnly + vbCritical, "Uh-oh!"

' Else

' MsgBox FSO.GetFileName(AutoProg) & " ran successfully!", vbOkOnly + vbInformation, "Yay!"

' End If

' If FSO.FileExists(ListFile) Then

' WinShell.Run(DQ & ListFile & DQ)

' End If

' WinShell.Run( uedit & DQ & LogFile & DQ)

End If

End Sub

' ================================================

Public Function CheckLog(LogFilePath)

Dim booReturn

Dim LogFile

Dim Contents

Dim Rgx


booReturn = True

Set LogFile = FSO.OpenTextFile(LogFilePath, FORREADING)

Contents = LogFile.ReadAll

Set Rgx = New RegExp

With Rgx

' For now we are ignoring warnings (since the expiration warnings are coming up)

' .Pattern = "error"

.Pattern = "error:|warning:"

.IgnoreCase = True

booReturn = .Test(Contents)

End With

CheckLog = booReturn

End Function

' ================================================

' WScript.Echo "Finished running " & WScript.ScriptName




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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...