Jump to content

says i need an endfunc.. but i dont see where


gcue
 Share

Recommended Posts

i have this msgbox running seperately..

then ALL I did was put put it an FUNC ABOUT () before it and ENDFUNC and the end of it

so i can call upon it and i get the following error:

Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = 0)

Error: "Func" statement has no matching "EndFunc"

can anyone help?

=====

Func About()

$Text = ""

$Text &= ('About Kill Notes v0.26'&@crlf& _

'(contact GXM x90760 for questions/suggestions)'&@crlf& _

''&@crlf& _

'Deletes the following from current data directory specified in notes.ini:'&@CRLF& _

''&@crlf& _

' cache.ndk'&@crlf& _

' ~*.*'&@crlf& _

' *.tmp'&@crlf& _

''&@crlf& _

'Kills The Following Processes:'&@crlf& _

''&@crlf& _

' swiftsrv.exe nlnotes.exe ndiiop.exe'&@crlf& _

' nfilertn.exe nlogasio.exe nweb.exe'&@crlf& _

' nfileret.exe nminder.exe ndyncfg.exe'&@crlf& _

' clhap32.exe nnntpcl.exe nwrdaemn.exe'&@crlf& _

' ldapsearch.exe nnotesmm.exe nhldaemn.exe'&@crlf& _

' nadminp.exe nnsadmin.exe nxpcdmn.exe'&@crlf& _

' naldaemn.exe notesbuddy.exe nhttp.exe'&@crlf& _

' namgr.exe npop3.exe rtfcnvt.exe'&@crlf& _

' napdaemn.exe ntaskldr.exe nhttpcgi.exe'&@crlf& _

' nchronos.exe ntgclhap.exe desktopmgr.exe'&@crlf& _

' ncollect.exe nupdall.exe nimapcl.exe'&@crlf& _

' nconvert.exe nupdate.exe nltaskldr.exe'&@crlf& _

''&@crlf& _

'Kill Notes Process:'&@crlf& _

''&@crlf& _

'1. Terminates the processes mentioned above.'&@crlf& _

'2. Runs a check to see if any of the processes are still running.'&@crlf& _

' if so, it tries to terminate them again.'&@crlf& _

'3. Runs a second check to see if any of the processes are still running.'&@crlf& _

' if so, it reports that process as unterminateable (have yet to see this'&@crlf& _

' happen).'&@crlf& _

'4. Reads what current data directory is in c:\lotus\Notes\Notes.ini'&@crlf& _

' then deletes cache.ndk, *.tmp and ~*.* from that directory.'&@crlf& _

'5. Checks to see if <current Notes data dir>\~Notes.lck still exists. If so,'&@crlf& _

' indicates that Notes cannot restart and suggests a manual reboot.'&@crlf& _

'6. Prompts to restart Notes.'&@crlf& _

'7. If user choses to restart Notes a check is performed to see if Notes'&@crlf& _

' is running. If it is not, then it could not restart. It seems there'&@crlf& _

' are some processes shared with Sametime 7.5. A check is performed'&@crlf& _

' to see if Sametime is running. If so, it prompts the user to'&@crlf& _

' manually exit Sametime and manually re-open Notes.')

_MsgBox(104, "About Kill Notes v0.26", $Text)

Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = 0)

Local $StrnLenText = MsgLongestString($mb_Text)

Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 6.5

If (160 + $NumberOfLines) >= @DesktopHeight Then $NumberOfLines = @DesktopHeight - 100

Local $Button1Txt = "OK"

Local $MsgValue = 0

Local $Timer = ''

Local $ScrollLabel1 = -1, $ScrollLabel2 = -1

Local $iMsgBox = GUICreate($mb_Title, $StrnLenText + 165, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)

Local $Edit = GUICtrlCreateEdit($mb_Text, 60, 10, $StrnLenText + 105, 30 + $NumberOfLines, BitOR(0x00200000, 0x0800),

0x990)

GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)

$Button1 = GUICtrlCreateButton($Button1Txt, 45 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button1Txt),

25)

GUISetState()

If $mb_Time <> 0 Then $Timer = TimerInit()

While 1

$imsg = GUIGetMsg()

Select

Case $imsg = $Button1

$MsgValue = 6

ExitLoop

Case $mb_Time <> 0

If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop

EndSelect

WEnd

GUIDelete($iMsgBox)

Return $MsgValue

EndFunc

Func MsgLongestString($sText)

Local $Times = ''

Local $sSplit = StringSplit($sText, @CRLF)

If Not @error Then

ArraySortByLen($sSplit)

If StringLen($sSplit[1]) <= 150 Then $Times = 4.5

If StringLen($sSplit[1]) >= 101 And StringLen($sSplit[1]) <= 150 Then $Times = 0

If StringLen($sSplit[1]) >= 151 And StringLen($sSplit[1]) <= 201 Then $Times = 0

If StringLen($sSplit[1]) >= 102 Then $Times = 0

Return Round(StringLen($sSplit[1])*$Times)

Else

If StringLen($sText) <= 50 Then $Times = 0

If StringLen($sText) >= 101 And StringLen($sText) <= 150 Then $Times = 0

If StringLen($sText) >= 151 And StringLen($sText) <= 201 Then $Times = 0

If StringLen($sText) >= 102 Then $Times = 0

Return Round(StringLen($sText)*$Times)

EndIf

EndFunc

Func ArraySortByLen(ByRef $nArray, $Start = 1)

For $i = $Start To UBound($nArray) - 2

Local $SE = $i

For $x = $i To UBound($nArray) - 1

If StringLen($nArray[$SE]) < StringLen($nArray[$x]) Then $SE = $x

Next

Local $HLD = $nArray[$i]

$nArray[$i] = $nArray[$SE]

$nArray[$SE] = $HLD

Next

EndFunc

EndFunc

=======

Link to comment
Share on other sites

  • Developers

In these cases its easiest to run the Tidy program ... that will tell/show you where you went wrong:

Func About()
    $Text = ""
    $Text &= ('About Kill Notes v0.26' & @CRLF & _
            '(contact GXM x90760 for questions/suggestions)' & @CRLF & _
            '' & @CRLF & _
            'Deletes the following from current data directory specified in notes.ini:' & @CRLF & _
            '' & @CRLF & _
            ' cache.ndk' & @CRLF & _
            ' ~*.*' & @CRLF & _
            ' *.tmp' & @CRLF & _
            '' & @CRLF & _
            'Kills The Following Processes:' & @CRLF & _
            '' & @CRLF & _
            ' swiftsrv.exe nlnotes.exe ndiiop.exe' & @CRLF & _
            ' nfilertn.exe nlogasio.exe nweb.exe' & @CRLF & _
            ' nfileret.exe nminder.exe ndyncfg.exe' & @CRLF & _
            ' clhap32.exe nnntpcl.exe nwrdaemn.exe' & @CRLF & _
            ' ldapsearch.exe nnotesmm.exe nhldaemn.exe' & @CRLF & _
            ' nadminp.exe nnsadmin.exe nxpcdmn.exe' & @CRLF & _
            ' naldaemn.exe notesbuddy.exe nhttp.exe' & @CRLF & _
            ' namgr.exe npop3.exe rtfcnvt.exe' & @CRLF & _
            ' napdaemn.exe ntaskldr.exe nhttpcgi.exe' & @CRLF & _
            ' nchronos.exe ntgclhap.exe desktopmgr.exe' & @CRLF & _
            ' ncollect.exe nupdall.exe nimapcl.exe' & @CRLF & _
            ' nconvert.exe nupdate.exe nltaskldr.exe' & @CRLF & _
            '' & @CRLF & _
            'Kill Notes Process:' & @CRLF & _
            '' & @CRLF & _
            '1. Terminates the processes mentioned above.' & @CRLF & _
            '2. Runs a check to see if any of the processes are still running.' & @CRLF & _
            ' if so, it tries to terminate them again.' & @CRLF & _
            '3. Runs a second check to see if any of the processes are still running.' & @CRLF & _
            ' if so, it reports that process as unterminateable (have yet to see this' & @CRLF & _
            ' happen).' & @CRLF & _
            '4. Reads what current data directory is in c:\lotus\Notes\Notes.ini' & @CRLF & _
            ' then deletes cache.ndk, *.tmp and ~*.* from that directory.' & @CRLF & _
            '5. Checks to see if <current Notes data dir>\~Notes.lck still exists. If so,' & @CRLF & _
            ' indicates that Notes cannot restart and suggests a manual reboot.' & @CRLF & _
            '6. Prompts to restart Notes.' & @CRLF & _
            '7. If user choses to restart Notes a check is performed to see if Notes' & @CRLF & _
            ' is running. If it is not, then it could not restart. It seems there' & @CRLF & _
            ' are some processes shared with Sametime 7.5. A check is performed' & @CRLF & _
            ' to see if Sametime is running. If so, it prompts the user to' & @CRLF & _
            ' manually exit Sametime and manually re-open Notes.')
    _MsgBox(104, "About Kill Notes v0.26", $Text)
;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
    Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = 0)
        Local $StrnLenText = MsgLongestString($mb_Text)
        Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 6.5
        If (160 + $NumberOfLines) >= @DesktopHeight Then $NumberOfLines = @DesktopHeight - 100
        Local $Button1Txt = "OK"
        Local $MsgValue = 0
        Local $Timer = ''
        Local $ScrollLabel1 = -1, $ScrollLabel2 = -1
        Local $iMsgBox = GUICreate($mb_Title, $StrnLenText + 165, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)
        Local $Edit = GUICtrlCreateEdit($mb_Text, 60, 10, $StrnLenText + 105, 30 + $NumberOfLines, BitOR(0x00200000, 0x0800),
        0x990)
        GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)
        $Button1 = GUICtrlCreateButton($Button1Txt, 45 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button1Txt),
        25)
        GUISetState()
        If $mb_Time <> 0 Then $Timer = TimerInit()
        While 1
            $imsg = GUIGetMsg()
            Select
                Case $imsg = $Button1
                    $MsgValue = 6
                    ExitLoop
                Case $mb_Time <> 0
                    If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop
            EndSelect
        WEnd
        GUIDelete($iMsgBox)
        Return $MsgValue
    EndFunc ;==>_MsgBox
;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
    Func MsgLongestString($sText)
        Local $Times = ''
        Local $sSplit = StringSplit($sText, @CRLF)
        If Not @error Then
            ArraySortByLen($sSplit)
            If StringLen($sSplit[1]) <= 150 Then $Times = 4.5
            If StringLen($sSplit[1]) >= 101 And StringLen($sSplit[1]) <= 150 Then $Times = 0
            If StringLen($sSplit[1]) >= 151 And StringLen($sSplit[1]) <= 201 Then $Times = 0
            If StringLen($sSplit[1]) >= 102 Then $Times = 0
            Return Round(StringLen($sSplit[1]) * $Times)
        Else
            If StringLen($sText) <= 50 Then $Times = 0
            If StringLen($sText) >= 101 And StringLen($sText) <= 150 Then $Times = 0
            If StringLen($sText) >= 151 And StringLen($sText) <= 201 Then $Times = 0
            If StringLen($sText) >= 102 Then $Times = 0
            Return Round(StringLen($sText) * $Times)
        EndIf
    EndFunc ;==>MsgLongestString
;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
    Func ArraySortByLen(ByRef $nArray, $Start = 1)
        For $i = $Start To UBound($nArray) - 2
            Local $SE = $i
            For $x = $i To UBound($nArray) - 1
                If StringLen($nArray[$SE]) < StringLen($nArray[$x]) Then $SE = $x
            Next
            Local $HLD = $nArray[$i]
            $nArray[$i] = $nArray[$SE]
            $nArray[$SE] = $HLD
        Next
    EndFunc ;==>ArraySortByLen
EndFunc ;==>ArraySortByLen
Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

As far as I'm aware, Functions cannot be nested.

You need to separate each function.

Func MyFunction_1()

....some statements

EndFunc

Func MyFunction_2()

....some statements

EndFunc

If you need MyFunction_2() within MyFunction_1() You need to call if from MyFunction_1()

MyFunction_1()
    ....statements
     MyFunction_2()
     ....Statements
EndFunc
Exit

Func MyFunction_2()
     ....some statements
EndFunc
Edited by Scriptonize

If you learn from It, it's not a mistake

Link to comment
Share on other sites

  • Developers

But if u look closely.. each Func has a corresponding EndFunc =/

Agree that you have enough EndFunc statements but one is in the wrong place... did you read the Tidy Error ?

You cannot have a Func-EndFunc inside another Func-Endfunc :D

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Wow I wasnt aware of that utility thanks!

but the errors still didnt help me figure out what's wrong. lol!!

In these cases its easiest to run the Tidy program ... that will tell/show you where you went wrong:

Func About()
    $Text = ""
    $Text &= ('About Kill Notes v0.26' & @CRLF & _
            '(contact GXM x90760 for questions/suggestions)' & @CRLF & _
            '' & @CRLF & _
            'Deletes the following from current data directory specified in notes.ini:' & @CRLF & _
            '' & @CRLF & _
            ' cache.ndk' & @CRLF & _
            ' ~*.*' & @CRLF & _
            ' *.tmp' & @CRLF & _
            '' & @CRLF & _
            'Kills The Following Processes:' & @CRLF & _
            '' & @CRLF & _
            ' swiftsrv.exe nlnotes.exe ndiiop.exe' & @CRLF & _
            ' nfilertn.exe nlogasio.exe nweb.exe' & @CRLF & _
            ' nfileret.exe nminder.exe ndyncfg.exe' & @CRLF & _
            ' clhap32.exe nnntpcl.exe nwrdaemn.exe' & @CRLF & _
            ' ldapsearch.exe nnotesmm.exe nhldaemn.exe' & @CRLF & _
            ' nadminp.exe nnsadmin.exe nxpcdmn.exe' & @CRLF & _
            ' naldaemn.exe notesbuddy.exe nhttp.exe' & @CRLF & _
            ' namgr.exe npop3.exe rtfcnvt.exe' & @CRLF & _
            ' napdaemn.exe ntaskldr.exe nhttpcgi.exe' & @CRLF & _
            ' nchronos.exe ntgclhap.exe desktopmgr.exe' & @CRLF & _
            ' ncollect.exe nupdall.exe nimapcl.exe' & @CRLF & _
            ' nconvert.exe nupdate.exe nltaskldr.exe' & @CRLF & _
            '' & @CRLF & _
            'Kill Notes Process:' & @CRLF & _
            '' & @CRLF & _
            '1. Terminates the processes mentioned above.' & @CRLF & _
            '2. Runs a check to see if any of the processes are still running.' & @CRLF & _
            ' if so, it tries to terminate them again.' & @CRLF & _
            '3. Runs a second check to see if any of the processes are still running.' & @CRLF & _
            ' if so, it reports that process as unterminateable (have yet to see this' & @CRLF & _
            ' happen).' & @CRLF & _
            '4. Reads what current data directory is in c:\lotus\Notes\Notes.ini' & @CRLF & _
            ' then deletes cache.ndk, *.tmp and ~*.* from that directory.' & @CRLF & _
            '5. Checks to see if <current Notes data dir>\~Notes.lck still exists. If so,' & @CRLF & _
            ' indicates that Notes cannot restart and suggests a manual reboot.' & @CRLF & _
            '6. Prompts to restart Notes.' & @CRLF & _
            '7. If user choses to restart Notes a check is performed to see if Notes' & @CRLF & _
            ' is running. If it is not, then it could not restart. It seems there' & @CRLF & _
            ' are some processes shared with Sametime 7.5. A check is performed' & @CRLF & _
            ' to see if Sametime is running. If so, it prompts the user to' & @CRLF & _
            ' manually exit Sametime and manually re-open Notes.')
    _MsgBox(104, "About Kill Notes v0.26", $Text)
;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
    Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = 0)
        Local $StrnLenText = MsgLongestString($mb_Text)
        Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 6.5
        If (160 + $NumberOfLines) >= @DesktopHeight Then $NumberOfLines = @DesktopHeight - 100
        Local $Button1Txt = "OK"
        Local $MsgValue = 0
        Local $Timer = ''
        Local $ScrollLabel1 = -1, $ScrollLabel2 = -1
        Local $iMsgBox = GUICreate($mb_Title, $StrnLenText + 165, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)
        Local $Edit = GUICtrlCreateEdit($mb_Text, 60, 10, $StrnLenText + 105, 30 + $NumberOfLines, BitOR(0x00200000, 0x0800),
        0x990)
        GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)
        $Button1 = GUICtrlCreateButton($Button1Txt, 45 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button1Txt),
        25)
        GUISetState()
        If $mb_Time <> 0 Then $Timer = TimerInit()
        While 1
            $imsg = GUIGetMsg()
            Select
                Case $imsg = $Button1
                    $MsgValue = 6
                    ExitLoop
                Case $mb_Time <> 0
                    If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop
            EndSelect
        WEnd
        GUIDelete($iMsgBox)
        Return $MsgValue
    EndFunc;==>_MsgBox
;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
    Func MsgLongestString($sText)
        Local $Times = ''
        Local $sSplit = StringSplit($sText, @CRLF)
        If Not @error Then
            ArraySortByLen($sSplit)
            If StringLen($sSplit[1]) <= 150 Then $Times = 4.5
            If StringLen($sSplit[1]) >= 101 And StringLen($sSplit[1]) <= 150 Then $Times = 0
            If StringLen($sSplit[1]) >= 151 And StringLen($sSplit[1]) <= 201 Then $Times = 0
            If StringLen($sSplit[1]) >= 102 Then $Times = 0
            Return Round(StringLen($sSplit[1]) * $Times)
        Else
            If StringLen($sText) <= 50 Then $Times = 0
            If StringLen($sText) >= 101 And StringLen($sText) <= 150 Then $Times = 0
            If StringLen($sText) >= 151 And StringLen($sText) <= 201 Then $Times = 0
            If StringLen($sText) >= 102 Then $Times = 0
            Return Round(StringLen($sText) * $Times)
        EndIf
    EndFunc;==>MsgLongestString
;### Tidy Error -> func Not closed before "Func" statement.
;### Tidy Error ->  & CHR$(34) & FIRSTWORD$ & " cannot be inside any IF/Do/While/For/Case/Func statement.
    Func ArraySortByLen(ByRef $nArray, $Start = 1)
        For $i = $Start To UBound($nArray) - 2
            Local $SE = $i
            For $x = $i To UBound($nArray) - 1
                If StringLen($nArray[$SE]) < StringLen($nArray[$x]) Then $SE = $x
            Next
            Local $HLD = $nArray[$i]
            $nArray[$i] = $nArray[$SE]
            $nArray[$SE] = $HLD
        Next
    EndFunc;==>ArraySortByLen
EndFunc;==>ArraySortByLen
Link to comment
Share on other sites

ur a genius!!!

that worked!!!

but not i lost the OK button so no theres no way to close out the window.

alternatively, maybe i can make the window with a X button?

....

_MsgBox(104, "About Kill Notes v0.26", $Text)

;something is missing here : you starts a new func below but the previous one is not closed.
EndFunc ;try this here and delete the last EndFunc :)

Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = 0)

...

Link to comment
Share on other sites

ur a genius!!!

that worked!!!

but not i lost the OK button so no theres no way to close out the window.

alternatively, maybe i can make the window with a X button?

You really should give credit where credit is due .... Jos answered your question correctly the first time.... and the second time. I guess you're just too lazy to look at the code.

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Link to comment
Share on other sites

Sorry I had accidentally hit the wrong reply button. =)

Any idea how i can get my OK button back? I tried calling the _Msbox function before the first EndFunc but that didnt work

===

Func About()

$Text = ""

$Text &= ('About Kill Notes v0.26'&@crlf& _

'(contact GXM x90760 for questions/suggestions)'&@crlf& _

''&@crlf& _

'Deletes the following from current data directory specified in notes.ini:'&@CRLF& _

''&@crlf& _

' cache.ndk'&@crlf& _

' ~*.*'&@crlf& _

' *.tmp'&@crlf& _

''&@crlf& _

'Kills The Following Processes:'&@crlf& _

''&@crlf& _

' swiftsrv.exe nlnotes.exe ndiiop.exe'&@crlf& _

' nfilertn.exe nlogasio.exe nweb.exe'&@crlf& _

' nfileret.exe nminder.exe ndyncfg.exe'&@crlf& _

' clhap32.exe nnntpcl.exe nwrdaemn.exe'&@crlf& _

' ldapsearch.exe nnotesmm.exe nhldaemn.exe'&@crlf& _

' nadminp.exe nnsadmin.exe nxpcdmn.exe'&@crlf& _

' naldaemn.exe notesbuddy.exe nhttp.exe'&@crlf& _

' namgr.exe npop3.exe rtfcnvt.exe'&@crlf& _

' napdaemn.exe ntaskldr.exe nhttpcgi.exe'&@crlf& _

' nchronos.exe ntgclhap.exe desktopmgr.exe'&@crlf& _

' ncollect.exe nupdall.exe nimapcl.exe'&@crlf& _

' nconvert.exe nupdate.exe nltaskldr.exe'&@crlf& _

''&@crlf& _

'Kill Notes Process:'&@crlf& _

''&@crlf& _

'1. Terminates the processes mentioned above.'&@crlf& _

'2. Runs a check to see if any of the processes are still running.'&@crlf& _

' if so, it tries to terminate them again.'&@crlf& _

'3. Runs a second check to see if any of the processes are still running.'&@crlf& _

' if so, it reports that process as unterminateable (have yet to see this'&@crlf& _

' happen).'&@crlf& _

'4. Reads what current data directory is in c:\lotus\Notes\Notes.ini'&@crlf& _

' then deletes cache.ndk, *.tmp and ~*.* from that directory.'&@crlf& _

'5. Checks to see if <current Notes data dir>\~Notes.lck still exists. If so,'&@crlf& _

' indicates that Notes cannot restart and suggests a manual reboot.'&@crlf& _

'6. Prompts to restart Notes.'&@crlf& _

'7. If user choses to restart Notes a check is performed to see if Notes'&@crlf& _

' is running. If it is not, then it could not restart. It seems there'&@crlf& _

' are some processes shared with Sametime 7.5. A check is performed'&@crlf& _

' to see if Sametime is running. If so, it prompts the user to'&@crlf& _

' manually exit Sametime and manually re-open Notes.')

_MsgBox(104, "About Kill Notes v0.26", $Text)

EndFunc

Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = 0)

Local $StrnLenText = MsgLongestString($mb_Text)

Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 6.5

If (160 + $NumberOfLines) >= @DesktopHeight Then $NumberOfLines = @DesktopHeight - 100

Local $Button1Txt = "OK"

Local $MsgValue = 0

Local $Timer = ''

Local $ScrollLabel1 = -1, $ScrollLabel2 = -1

Local $iMsgBox = GUICreate($mb_Title, $StrnLenText + 165, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)

Local $Edit = GUICtrlCreateEdit($mb_Text, 60, 10, $StrnLenText + 105, 30 + $NumberOfLines, BitOR(0x00200000, 0x0800),

0x990)

GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)

$Button1 = GUICtrlCreateButton($Button1Txt, 45 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button1Txt),

25)

GUISetState()

If $mb_Time <> 0 Then $Timer = TimerInit()

While 1

$imsg = GUIGetMsg()

Select

Case $imsg = $Button1

$MsgValue = 6

ExitLoop

Case $mb_Time <> 0

If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop

EndSelect

WEnd

GUIDelete($iMsgBox)

Return $MsgValue

EndFunc

Func MsgLongestString($sText)

Local $Times = ''

Local $sSplit = StringSplit($sText, @CRLF)

If Not @error Then

ArraySortByLen($sSplit)

If StringLen($sSplit[1]) <= 150 Then $Times = 4.5

If StringLen($sSplit[1]) >= 101 And StringLen($sSplit[1]) <= 150 Then $Times = 0

If StringLen($sSplit[1]) >= 151 And StringLen($sSplit[1]) <= 201 Then $Times = 0

If StringLen($sSplit[1]) >= 102 Then $Times = 0

Return Round(StringLen($sSplit[1])*$Times)

Else

If StringLen($sText) <= 50 Then $Times = 0

If StringLen($sText) >= 101 And StringLen($sText) <= 150 Then $Times = 0

If StringLen($sText) >= 151 And StringLen($sText) <= 201 Then $Times = 0

If StringLen($sText) >= 102 Then $Times = 0

Return Round(StringLen($sText)*$Times)

EndIf

EndFunc

Func ArraySortByLen(ByRef $nArray, $Start = 1)

For $i = $Start To UBound($nArray) - 2

Local $SE = $i

For $x = $i To UBound($nArray) - 1

If StringLen($nArray[$SE]) < StringLen($nArray[$x]) Then $SE = $x

Next

Local $HLD = $nArray[$i]

$nArray[$i] = $nArray[$SE]

$nArray[$SE] = $HLD

Next

EndFunc

==

Link to comment
Share on other sites

Look how much nicer the code looks when you tidy it and use [ autoit ] [ /autoit ] boxes. (take out the spaces)

Func About()
    $Text = ""
    $Text &= ('About Kill Notes v0.26' & @CRLF & _
            '(contact GXM x90760 for questions/suggestions)' & @CRLF & _
            '' & @CRLF & _
            'Deletes the following from current data directory specified in notes.ini:' & @CRLF & _
            '' & @CRLF & _
            ' cache.ndk' & @CRLF & _
            ' ~*.*' & @CRLF & _
            ' *.tmp' & @CRLF & _
            '' & @CRLF & _
            'Kills The Following Processes:' & @CRLF & _
            '' & @CRLF & _
            ' swiftsrv.exe nlnotes.exe ndiiop.exe' & @CRLF & _
            ' nfilertn.exe nlogasio.exe nweb.exe' & @CRLF & _
            ' nfileret.exe nminder.exe ndyncfg.exe' & @CRLF & _
            ' clhap32.exe nnntpcl.exe nwrdaemn.exe' & @CRLF & _
            ' ldapsearch.exe nnotesmm.exe nhldaemn.exe' & @CRLF & _
            ' nadminp.exe nnsadmin.exe nxpcdmn.exe' & @CRLF & _
            ' naldaemn.exe notesbuddy.exe nhttp.exe' & @CRLF & _
            ' namgr.exe npop3.exe rtfcnvt.exe' & @CRLF & _
            ' napdaemn.exe ntaskldr.exe nhttpcgi.exe' & @CRLF & _
            ' nchronos.exe ntgclhap.exe desktopmgr.exe' & @CRLF & _
            ' ncollect.exe nupdall.exe nimapcl.exe' & @CRLF & _
            ' nconvert.exe nupdate.exe nltaskldr.exe' & @CRLF & _
            '' & @CRLF & _
            'Kill Notes Process:' & @CRLF & _
            '' & @CRLF & _
            '1. Terminates the processes mentioned above.' & @CRLF & _
            '2. Runs a check to see if any of the processes are still running.' & @CRLF & _
            ' if so, it tries to terminate them again.' & @CRLF & _
            '3. Runs a second check to see if any of the processes are still running.' & @CRLF & _
            ' if so, it reports that process as unterminateable (have yet to see this' & @CRLF & _
            ' happen).' & @CRLF & _
            '4. Reads what current data directory is in c:\lotus\Notes\Notes.ini' & @CRLF & _
            ' then deletes cache.ndk, *.tmp and ~*.* from that directory.' & @CRLF & _
            '5. Checks to see if <current Notes data dir>\~Notes.lck still exists. If so,' & @CRLF & _
            ' indicates that Notes cannot restart and suggests a manual reboot.' & @CRLF & _
            '6. Prompts to restart Notes.' & @CRLF & _
            '7. If user choses to restart Notes a check is performed to see if Notes' & @CRLF & _
            ' is running. If it is not, then it could not restart. It seems there' & @CRLF & _
            ' are some processes shared with Sametime 7.5. A check is performed' & @CRLF & _
            ' to see if Sametime is running. If so, it prompts the user to' & @CRLF & _
            ' manually exit Sametime and manually re-open Notes.')
    _MsgBox(104, "About Kill Notes v0.26", $Text)
EndFunc   ;==>About
Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = 0)
    Local $StrnLenText = MsgLongestString($mb_Text)
    Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 6.5
    If (160 + $NumberOfLines) >= @DesktopHeight Then $NumberOfLines = @DesktopHeight - 100
    Local $Button1Txt = "OK"
    Local $MsgValue = 0
    Local $Timer = ''
    Local $ScrollLabel1 = -1, $ScrollLabel2 = -1
    Local $iMsgBox = GUICreate($mb_Title, $StrnLenText + 165, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)
    Local $Edit = GUICtrlCreateEdit($mb_Text, 60, 10, $StrnLenText + 105, 30 + $NumberOfLines, BitOR(0x00200000, 0x0800),
    0x990)
    GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)
    $Button1 = GUICtrlCreateButton($Button1Txt, 45 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button1Txt),
    25)
    GUISetState()
    If $mb_Time <> 0 Then $Timer = TimerInit()
    While 1
        $imsg = GUIGetMsg()
        Select
            Case $imsg = $Button1
                $MsgValue = 6
                ExitLoop
            Case $mb_Time <> 0
                If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop
        EndSelect
    WEnd
    GUIDelete($iMsgBox)
    Return $MsgValue
EndFunc   ;==>_MsgBox
Func MsgLongestString($sText)
    Local $Times = ''
    Local $sSplit = StringSplit($sText, @CRLF)
    If Not @error Then
        ArraySortByLen($sSplit)
        If StringLen($sSplit[1]) <= 150 Then $Times = 4.5
        If StringLen($sSplit[1]) >= 101 And StringLen($sSplit[1]) <= 150 Then $Times = 0
        If StringLen($sSplit[1]) >= 151 And StringLen($sSplit[1]) <= 201 Then $Times = 0
        If StringLen($sSplit[1]) >= 102 Then $Times = 0
        Return Round(StringLen($sSplit[1]) * $Times)
    Else
        If StringLen($sText) <= 50 Then $Times = 0
        If StringLen($sText) >= 101 And StringLen($sText) <= 150 Then $Times = 0
        If StringLen($sText) >= 151 And StringLen($sText) <= 201 Then $Times = 0
        If StringLen($sText) >= 102 Then $Times = 0
        Return Round(StringLen($sText) * $Times)
    EndIf
EndFunc   ;==>MsgLongestString
Func ArraySortByLen(ByRef $nArray, $Start = 1)
    For $i = $Start To UBound($nArray) - 2
        Local $SE = $i
        For $x = $i To UBound($nArray) - 1
            If StringLen($nArray[$SE]) < StringLen($nArray[$x]) Then $SE = $x
        Next
        Local $HLD = $nArray[$i]
        $nArray[$i] = $nArray[$SE]
        $nArray[$SE] = $HLD
    Next
EndFunc   ;==>ArraySortByLen
Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

wow you're right looks alot better! thanks =)

the cleanup still didnt help me find out why the OK button is missing =/

Look how much nicer the code looks when you tidy it and use [ autoit ] [ /autoit ] boxes. (take out the spaces)

Func About()
    $Text = ""
    $Text &= ('About Kill Notes v0.26' & @CRLF & _
            '(contact GXM x90760 for questions/suggestions)' & @CRLF & _
            '' & @CRLF & _
            'Deletes the following from current data directory specified in notes.ini:' & @CRLF & _
            '' & @CRLF & _
            ' cache.ndk' & @CRLF & _
            ' ~*.*' & @CRLF & _
            ' *.tmp' & @CRLF & _
            '' & @CRLF & _
            'Kills The Following Processes:' & @CRLF & _
            '' & @CRLF & _
            ' swiftsrv.exe nlnotes.exe ndiiop.exe' & @CRLF & _
            ' nfilertn.exe nlogasio.exe nweb.exe' & @CRLF & _
            ' nfileret.exe nminder.exe ndyncfg.exe' & @CRLF & _
            ' clhap32.exe nnntpcl.exe nwrdaemn.exe' & @CRLF & _
            ' ldapsearch.exe nnotesmm.exe nhldaemn.exe' & @CRLF & _
            ' nadminp.exe nnsadmin.exe nxpcdmn.exe' & @CRLF & _
            ' naldaemn.exe notesbuddy.exe nhttp.exe' & @CRLF & _
            ' namgr.exe npop3.exe rtfcnvt.exe' & @CRLF & _
            ' napdaemn.exe ntaskldr.exe nhttpcgi.exe' & @CRLF & _
            ' nchronos.exe ntgclhap.exe desktopmgr.exe' & @CRLF & _
            ' ncollect.exe nupdall.exe nimapcl.exe' & @CRLF & _
            ' nconvert.exe nupdate.exe nltaskldr.exe' & @CRLF & _
            '' & @CRLF & _
            'Kill Notes Process:' & @CRLF & _
            '' & @CRLF & _
            '1. Terminates the processes mentioned above.' & @CRLF & _
            '2. Runs a check to see if any of the processes are still running.' & @CRLF & _
            ' if so, it tries to terminate them again.' & @CRLF & _
            '3. Runs a second check to see if any of the processes are still running.' & @CRLF & _
            ' if so, it reports that process as unterminateable (have yet to see this' & @CRLF & _
            ' happen).' & @CRLF & _
            '4. Reads what current data directory is in c:\lotus\Notes\Notes.ini' & @CRLF & _
            ' then deletes cache.ndk, *.tmp and ~*.* from that directory.' & @CRLF & _
            '5. Checks to see if <current Notes data dir>\~Notes.lck still exists. If so,' & @CRLF & _
            ' indicates that Notes cannot restart and suggests a manual reboot.' & @CRLF & _
            '6. Prompts to restart Notes.' & @CRLF & _
            '7. If user choses to restart Notes a check is performed to see if Notes' & @CRLF & _
            ' is running. If it is not, then it could not restart. It seems there' & @CRLF & _
            ' are some processes shared with Sametime 7.5. A check is performed' & @CRLF & _
            ' to see if Sametime is running. If so, it prompts the user to' & @CRLF & _
            ' manually exit Sametime and manually re-open Notes.')
    _MsgBox(104, "About Kill Notes v0.26", $Text)
EndFunc   ;==>About
Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = 0)
    Local $StrnLenText = MsgLongestString($mb_Text)
    Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 6.5
    If (160 + $NumberOfLines) >= @DesktopHeight Then $NumberOfLines = @DesktopHeight - 100
    Local $Button1Txt = "OK"
    Local $MsgValue = 0
    Local $Timer = ''
    Local $ScrollLabel1 = -1, $ScrollLabel2 = -1
    Local $iMsgBox = GUICreate($mb_Title, $StrnLenText + 165, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)
    Local $Edit = GUICtrlCreateEdit($mb_Text, 60, 10, $StrnLenText + 105, 30 + $NumberOfLines, BitOR(0x00200000, 0x0800),
    0x990)
    GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)
    $Button1 = GUICtrlCreateButton($Button1Txt, 45 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button1Txt),
    25)
    GUISetState()
    If $mb_Time <> 0 Then $Timer = TimerInit()
    While 1
        $imsg = GUIGetMsg()
        Select
            Case $imsg = $Button1
                $MsgValue = 6
                ExitLoop
            Case $mb_Time <> 0
                If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop
        EndSelect
    WEnd
    GUIDelete($iMsgBox)
    Return $MsgValue
EndFunc   ;==>_MsgBox
Func MsgLongestString($sText)
    Local $Times = ''
    Local $sSplit = StringSplit($sText, @CRLF)
    If Not @error Then
        ArraySortByLen($sSplit)
        If StringLen($sSplit[1]) <= 150 Then $Times = 4.5
        If StringLen($sSplit[1]) >= 101 And StringLen($sSplit[1]) <= 150 Then $Times = 0
        If StringLen($sSplit[1]) >= 151 And StringLen($sSplit[1]) <= 201 Then $Times = 0
        If StringLen($sSplit[1]) >= 102 Then $Times = 0
        Return Round(StringLen($sSplit[1]) * $Times)
    Else
        If StringLen($sText) <= 50 Then $Times = 0
        If StringLen($sText) >= 101 And StringLen($sText) <= 150 Then $Times = 0
        If StringLen($sText) >= 151 And StringLen($sText) <= 201 Then $Times = 0
        If StringLen($sText) >= 102 Then $Times = 0
        Return Round(StringLen($sText) * $Times)
    EndIf
EndFunc   ;==>MsgLongestString
Func ArraySortByLen(ByRef $nArray, $Start = 1)
    For $i = $Start To UBound($nArray) - 2
        Local $SE = $i
        For $x = $i To UBound($nArray) - 1
            If StringLen($nArray[$SE]) < StringLen($nArray[$x]) Then $SE = $x
        Next
        Local $HLD = $nArray[$i]
        $nArray[$i] = $nArray[$SE]
        $nArray[$SE] = $HLD
    Next
EndFunc   ;==>ArraySortByLen
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...