Sign in to follow this  
Followers 0

Is the syntax for AutoIT like like this VBS?

2 posts in this topic

I have this chunk of VBS code:

' ---------------------------------------------------------------------------------------
' |                                  Disable AutoLogon                             |
' ---------------------------------------------------------------------------------------
Function DisableAutoLogon()
    On Error Resume Next

    FSO.DeleteFile "M:\ccs\udf.ini", True   

    If( (WshShell.RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName", "", "REG_SZ") <> 0) Or (WshShell.RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName", "", "REG_SZ") <> 0) Or (WshShell.RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword", "", "REG_SZ") <> 0) Or (WshShell.RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon", "0", "REG_SZ") <> 0) Or (WshShell.RegWrite("HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword", "", "REG_SZ") <> 0) ) Then
        WshShell.LogEvent 1, "Disable AutoLogon FAIL"
        WshShell.LogEvent 0, "Disable AutoLogon Successful"
    End If
End Function

Notice the If ((WhsShell.RegWrite... part. Can I string RegWrite's together like this in an If - Then statement in AutoIT?

Also, in VBS I can hang a _ character off the end of the line and that signals the continuation of the code on the next line. Is there an equivalent in AutoIT?



Share this post

Link to post
Share on other sites

#2 ·  Posted (edited)

AutoIt has it's own builtin Reg* functions for ease of use and yes you can combine them into a long conditional line, just as displayed.



Underscore is valid in AutoIt also, just leave a space before the previous character and the underscore will work fine.


Underscore as in continuation character I am refering to...

Edited by MHz

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