Jump to content

incorrect number of parameters in function call


gcue
 Share

Recommended Posts

i know its coming from dFolders2($current)

not sure why.. can anyone see it?

#include <GUIConstants.au3>
#include <Constants.au3>
#include <file.au3>
Opt("GUICoordMode",2)
Opt("GUIOnEventMode",1)
Opt("GUIResizeMode", 1)

Func Prog()
ProgressOn ( "Clean-UP", "Cleaning...", "0 percent")
For $i = 10 to 100 step 10
    sleep (100)
    ProgressSet( $i, $i & " percent")
Next
ProgressSet(100 , "Clean-UP", "Complete!")
    sleep (100)
EndFunc


Func Warn()
Msgbox(512,'Warning',  'Please Close Any Open Applications Before Continuing!')
EndFunc

Func dFiles()
AutoItSetOption ( "ExpandEnvStrings", 1 )

FileDelete("c:\lotus\notes\data\cache.ndk")
FileDelete("u:\apps\notes\data\cache.ndk")
FileDelete("c:\lotus\notes\data\*.tmp")
FileDelete("u:\apps\notes\data\*.tmp")
FileDelete("c:\lotus\notes\data\~*.*")
FileDelete("u:\apps\notes\data\~*.*")
EndFunc

Func dFOlders()
dFolders2 ("C:\temp")
dFolders2 ("C:\WINNT\Temporary Internet Files")
dFolders2 ("C:\WINNT\system32\dllcache")
dFolders2 ("C:\MSOCache\All Users")
dFolders2 ("C:\WINNT\Prefetch")
EndFunc

Func dFolders2($current)
    Local $search = FileFindFirstFile($current & "\*.*")
    While 1
        Dim $file = FileFindNextFile($search)
        If @error Or StringLen($file) < 1 Then ExitLoop
        If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") Then

                FileDelete ($current & "\" & $file)

        EndIf
        If StringInStr(FileGetAttrib($current & "\" & $file), "D") Then
            
            DirRemove ($current & "\" & $file,1)
            
        EndIf
    WEnd
    FileClose($search)
EndFunc

Func Change()
MsgBox(262144, "Clean-UP v0.13", 'Change Log'&@CRLF & _
                        ''&@CRLF & _
                        'Changes from v0.12 to v0.13'&@CRLF & _
                        ''&@CRLF & _
                        '1. Changed GUI layout.'&@CRLF & _
                        '2. Added this change log.'&@CRLF & _
                        ''&@CRLF & _
                        'Please Contact GXM x90760 with Bug Reports/Suggestions.')
EndFunc


Func About()

Msgbox(64,'About Clean-UP',  'Contact GXM x90760 for questions'&@crlf& _
                    ''&@crlf& _
            'Deletes the following files:'&@CRLF& _
                    ''&@crlf& _
                    'c:\lotus\notes\data\cache.ndk'&@crlf& _
                    'c:\lotus\notes\data\*.tmp'&@crlf& _
                    'c:\lotus\notes\data\~*.*'&@crlf& _
                    'u:\apps\notes\data\cache.ndk'&@crlf& _
                    'u:\apps\notes\data\*.tmp'&@crlf& _
                    'u:\apps\notes\data\~*.*'&@crlf& _
                    ''&@crlf& _
            'Deletes files from the following directories:'&@CRLF& _
                    ''&@crlf& _
                    'C:\temp\'&@crlf& _
                    'C:\WINNT\system32\dllcache\'&@crlf& _
                    'C:\MSOCache\All Users\'&@crlf& _
                    'C:\WINNT\Prefetch\'&@crlf& _
                        'C:\WINNT\Temporary Internet Files\')

EndFunc

GUICreate("Clean-UP v0.13", 220,80)

$filemenu = GUICtrlCreateMenu("&File")
$fileexititem = GUICtrlCreateMenuItem("Exit", $filemenu)
GUICtrlSetOnEvent(-1,"Xbutton")

$helpmenu = GUICtrlCreateMenu ("&Help")
$changeitem = GUICtrlCreateMenuitem ("Change Log",$helpmenu)
GUICtrlSetOnEvent(-1,"Change")
$helpitem = GUICtrlCreateMenuitem ("About",$helpmenu)
GUICtrlSetOnEvent(-1,"About")

$Button_1 = GUICtrlCreateButton ( "Run",  60, 15, 100 )
GUICtrlSetOnEvent(-1, "CRun")

GUISetOnEvent($GUI_EVENT_CLOSE, "Xbutton")

GUISetState(@SW_SHOW)

Func CRun()
  Warn()            
  Prog()
  dFiles()
  dFolders()
  dFolders2()
  ProgressOff()
EndFunc

While 1
  Sleep(1000)
Wend

Func Xbutton()
  Exit
EndFunc
Link to comment
Share on other sites

Run it from SciTE and the error in the Console will tell you line and character number where the reported error is.

:D

P.S. ...or, you could just fix what weaponx found for you! :D

If you want that parameter to be optional, give it a default value in the function declaration:

Func dFolders2($current = "")
    If $current = "" Then Return ""
    
    ; ...
    
EndFunc

:)

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