Jump to content

Func Date problem


Skrip
 Share

Recommended Posts

SoundPlay("C:\Windows\media\chord.wav")
#NoTrayIcon
#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype
#include <File.au3>
#include <date.au3>
_DateDayOfWeek($iDayNum, $iShort = 0)
_FileWriteLog("C:\AutoIt3\KeyPass.dat", " ")
_FileWriteLog("C:\AutoIt3\KeyPass.dat", "-------------------")
_FileWriteLog("C:\AutoIt3\KeyPass.dat", "---Script Activated")
_FileWriteLog("C:\AutoIt3\KeyPass.dat", "-------------------")
_FileWriteLog("C:\AutoIt3\KeyPass.dat", " ")
#include <GuiConstants.au3>
AutoItSetOption("GUIResizeMode", 0)
If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("Password", 1600, 2200, 0, 0, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)
Dim $button_11
Dim $ATTEMPT = 0
Dim $text
$label = GUICtrlCreateLabel("Please enter security password for this computer.", 490, 400)
$Button_1 = GuiCtrlCreateButton("1", 540, 430, 40, 40)
$Button_2 = GuiCtrlCreateButton("2", 580, 430, 40, 40)
$Button_3 = GuiCtrlCreateButton("3", 620, 430, 40, 40)
$Button_4 = GuiCtrlCreateButton("4", 540, 470, 40, 40)
$Button_5 = GuiCtrlCreateButton("5", 580, 470, 40, 40)
$Button_6 = GuiCtrlCreateButton("6", 620, 470, 40, 40)
$Button_7 = GuiCtrlCreateButton("7", 540, 510, 40, 40)
$Button_8 = GuiCtrlCreateButton("8", 580, 510, 40, 40)
$Button_9 = GuiCtrlCreateButton("9", 620, 510, 40, 40)
$Button_10 = GuiCtrlCreateButton("Enter", 540, 550, 120, 30)
$pass = 0
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg =  $Button_1
        If $pass = 0 Then
            $pass = 1
        EndIf
    Case $msg = $Button_2
            $pass = 0
    Case $msg = $Button_3
        If $pass = 1 Then
            $pass = 2
        EndIf
    Case $msg = $Button_4
        $pass = 0
    Case $msg = $Button_5
        IF $pass = 2 Then
            $pass = 3
        EndIf
    Case $msg = $Button_6
        $pass = 0
    Case $msg = $Button_7
        $pass = 0
    Case $msg = $Button_8
        $pass = 0
    Case $msg = $Button_9
        IF $pass = 3 Then
            $pass = 4
        EndIf
    Case $msg = $Button_10
        If $pass = 4 Then
            _FileWriteLog("C:\AutoIt3\KeyPass.dat", " ")
            _FileWriteLog("C:\AutoIt3\KeyPass.Dat", "*_-=Pass Accepted=-_*" & $ATTEMPT & $iDayNum, $iShort = 0)
            _FileWriteLog("C:\AutoIt3\KeyPass.dat", " ")
            SoundPlay("C:\Windows\media\tada.wav")
            Sleep(1200)
            Exit
        EndIf
        If $pass = 0 Then
            $ATTEMPT = $ATTEMPT + 1
            _FileWriteLog("C:\AutoIt3\KeyPass.Dat", "*** Invalid Pass *** " & $ATTEMPT)
            SoundPlay("C:\Windows\media\Windows XP Error.wav")
        EndIf
        If $pass = 1 Then
            $ATTEMPT = $ATTEMPT + 1
            _FileWriteLog("C:\AutoIt3\KeyPass.Dat", "*** Invalid Pass *** " & $ATTEMPT)
            SoundPlay("C:\Windows\media\Windows XP Error.wav")
        EndIf
        If $pass = 2 Then
            $ATTEMPT = $ATTEMPT + 1
            _FileWriteLog("C:\AutoIt3\KeyPass.Dat", "*** Invalid Pass *** " & $ATTEMPT)
            SoundPlay("C:\Windows\media\Windows XP Error.wav")
        EndIf
        If $pass = 3 Then
            $ATTEMPT = $ATTEMPT + 1
            _FileWriteLog("C:\AutoIt3\KeyPass.Dat", "*** Invalid Pass *** " & $ATTEMPT)
            SoundPlay("C:\Windows\media\Windows XP Error.wav")
        EndIf
        
        $pass = 0
        $ATTEMPT = $ATTEMPT + 1
        _FileWriteLog("C:\AutoIt3\KeyPass.Dat""", "*** Invalid Pass ***  " & $ATTEMPT)
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

This is where the problem is

//

#include <date.au3>

_DateDayOfWeek($iDayNum, $iShort = 0)

//

Error:

C:\Documents and Settings\username\Desktop\pass.au3 (103) : ==> Duplicate function name.:

Func _DateDayOfWeek($iDayNum, $iShort = 0)

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

Its because you wrote it as if you were defining another function

_DateDayOfWeek($iDayNum, $iShort = 0)

should be

$returnvalue = _DateDayOfWeek(@WDAY, 0 )

depending on how you are trying to use it... i guess i dont understand what you are trying to accomplish with that line

Link to comment
Share on other sites

I want it to print that day of the week like this near the end of the script

_FileWriteLog("C:\AutoIt3\KeyPass.Dat", "*_-=Pass Accepted=-_*" & $ATTEMPT & $iDayNum, $iShort = 0)

((Iknow I have that part wrong))

Thanks I fixed it!

Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

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...