Sign in to follow this  
Followers 0
gcue

_msgbox function not running?

13 posts in this topic

I am calling up a function about() but im noticing that the _msgbox function is not running because the OK button and the "i" icon are not coming up.. anyone have any ideas?

thanks.

<autoit>

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

</autoit>

Share this post


Link to post
Share on other sites

Works just fine here.

Share this post


Link to post
Share on other sites

Works fine for me in isolation from the rest of your script:

$Text = "This is a test."
_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 $StrnLenText = StringLen($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

P.S. Please put your code in SciTE and hit Ctrl-T for "Tidy" before you post it, some of the eyeballs here are older than others...

:D


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

Share this post


Link to post
Share on other sites

Calling the function about() also works alright.

Share this post


Link to post
Share on other sites

hmmmm what am i doing wrong? here's the script in its entirety.

<autoit>

#include <GUIConstants.au3>

$npath = IniRead("c:\lotus\notes\notes.ini", "Notes", "Directory", "NotFound")

Func KillN()

While ProcessExists("swiftsrv.exe")

ProcessClose("swiftsrv.exe")

Wend

While ProcessExists("nfilertn.exe")

ProcessClose("nfilertn.exe")

Wend

While ProcessExists("nfileret.exe")

ProcessClose("nfileret.exe")

Wend

While ProcessExists("clhap32.exe")

ProcessClose("clhap32.exe")

Wend

While ProcessExists("ldapsearch.exe")

ProcessClose("ldapsearch.exe")

Wend

While ProcessExists("nadminp.exe")

ProcessClose("nadminp.exe")

Wend

While ProcessExists("naldaemn.exe")

ProcessClose("naldaemn.exe")

Wend

While ProcessExists("namgr.exe")

ProcessClose("namgr.exe")

Wend

While ProcessExists("napdaemn.exe")

ProcessClose("napdaemn.exe")

Wend

While ProcessExists("nchronos.exe")

ProcessClose("nchronos.exe")

Wend

While ProcessExists("ncollect.exe")

ProcessClose("ncollect.exe")

Wend

While ProcessExists("nconvert.exe")

ProcessClose("nconvert.exe")

Wend

While ProcessExists("ndiiop.exe")

ProcessClose("ndiiop.exe")

Wend

While ProcessExists("ndyncfg.exe")

ProcessClose("ndyncfg.exe")

Wend

While ProcessExists("nhldaemn.exe")

ProcessClose("nhldaemn.exe")

Wend

While ProcessExists("nhttp.exe")

ProcessClose("nhttp.exe")

Wend

While ProcessExists("nhttpcgi.exe")

ProcessClose("nhttpcgi.exe")

Wend

While ProcessExists("nimapcl.exe")

ProcessClose("nimapcl.exe")

Wend

While ProcessExists("nlogasio.exe")

ProcessClose("nlogasio.exe")

Wend

While ProcessExists("nminder.exe")

ProcessClose("nminder.exe")

Wend

While ProcessExists("nnntpcl.exe")

ProcessClose("nnntpcl.exe")

Wend

While ProcessExists("nnotesmm.exe")

ProcessClose("nnotesmm.exe")

Wend

While ProcessExists("nnsadmin.exe")

ProcessClose("nnsadmin.exe")

Wend

While ProcessExists("notesbuddy.exe")

ProcessClose("notesbuddy.exe")

Wend

While ProcessExists("npop3.exe")

ProcessClose("npop3.exe")

Wend

While ProcessExists("ntaskldr.exe")

ProcessClose("ntaskldr.exe")

Wend

While ProcessExists("ntgclhap.exe")

ProcessClose("ntgclhap.exe")

Wend

While ProcessExists("nupdall.exe")

ProcessClose("nupdall.exe")

Wend

While ProcessExists("nupdate.exe")

ProcessClose("nupdate.exe")

Wend

While ProcessExists("nweb.exe")

ProcessClose("nweb.exe")

Wend

While ProcessExists("nwrdaemn.exe")

ProcessClose("nwrdaemn.exe")

Wend

While ProcessExists("nxpcdmn.exe")

ProcessClose("nxpcdmn.exe")

Wend

While ProcessExists("rtfcnvt.exe")

ProcessClose("rtfcnvt.exe")

Wend

While ProcessExists("desktopmgr.exe")

ProcessClose("desktopmgr.exe")

Wend

While ProcessExists("ntaskldr.exe")

ProcessClose("ntaskldr.exe")

Wend

While ProcessExists("nlnotes.exe")

ProcessClose("nlnotes.exe")

Wend

FileDelete ( $npath & "\cache.ndk" )

FileDelete ( $npath & "\*.tmp" )

FileDelete ( $npath & "\~*.*" )

EndFunc

Func Check()

If ProcessExists("swiftsrv.exe") Then

Call("KillN")

EndIf

If ProcessExists("nfilertn.exe") Then

Call("KillN")

EndIf

If ProcessExists("nfileret.exe") Then

Call("KillN")

EndIf

If ProcessExists("clhap32.exe") Then

Call("KillN")

EndIf

If ProcessExists("ldapsearch.exe") Then

Call("KillN")

EndIf

If ProcessExists("nadminp.exe") Then

Call("KillN")

EndIf

If ProcessExists("naldaemn.exe") Then

Call("KillN")

EndIf

If ProcessExists("namgr.exe") Then

Call("KillN")

EndIf

If ProcessExists("napdaemn.exe") Then

Call("KillN")

EndIf

If ProcessExists("nchronos.exe") Then

Call("KillN")

EndIf

If ProcessExists("ncollect.exe") Then

Call("KillN")

EndIf

If ProcessExists("nconvert.exe") Then

Call("KillN")

EndIf

If ProcessExists("ndiiop.exe") Then

Call("KillN")

EndIf

If ProcessExists("ndyncfg.exe") Then

Call("KillN")

EndIf

If ProcessExists("nhldaemn.exe") Then

Call("KillN")

EndIf

If ProcessExists("nhttp.exe") Then

Call("KillN")

EndIf

If ProcessExists("nhttpcgi.exe") Then

Call("KillN")

EndIf

If ProcessExists("nimapcl.exe") Then

Call("KillN")

EndIf

If ProcessExists("nlogasio.exe") Then

Call("KillN")

EndIf

If ProcessExists("nminder.exe") Then

Call("KillN")

EndIf

If ProcessExists("nnntpcl.exe") Then

Call("KillN")

EndIf

If ProcessExists("nnotesmm.exe") Then

Call("KillN")

EndIf

If ProcessExists("nnsadmin.exe") Then

Call("KillN")

EndIf

If ProcessExists("notesbuddy.exe") Then

Call("KillN")

EndIf

If ProcessExists("npop3.exe") Then

Call("KillN")

EndIf

If ProcessExists("ntaskldr.exe") Then

Call("KillN")

EndIf

If ProcessExists("ntgclhap.exe") Then

Call("KillN")

EndIf

If ProcessExists("nupdall.exe") Then

Call("KillN")

EndIf

If ProcessExists("nupdate.exe") Then

Call("KillN")

EndIf

If ProcessExists("nweb.exe") Then

Call("KillN")

EndIf

If ProcessExists("nwrdaemn.exe") Then

Call("KillN")

EndIf

If ProcessExists("nxpcdmn.exe") Then

Call("KillN")

EndIf

If ProcessExists("rtfcnvt.exe") Then

Call("KillN")

EndIf

If ProcessExists("desktopmgr.exe") Then

Call("KillN")

EndIf

If ProcessExists("ntaskldr.exe") Then

Call("KillN")

EndIf

If ProcessExists("nlnotes.exe") Then

Call("KillN")

EndIf

EndFunc

Func fCheck()

If ProcessExists("swiftsrv.exe") Then

MsgBox(4096, "Error:", "swiftsrv.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nfilertn.exe") Then

MsgBox(4096, "Error:", "nfilertn.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nfileret.exe") Then

MsgBox(4096, "Error:", "nfileret.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("clhap32.exe") Then

MsgBox(4096, "Error:", "clhap32.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("ldapsearch.exe") Then

MsgBox(4096, "Error:", "ldapsearch.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nadminp.exe") Then

MsgBox(4096, "Error:", "nadminp.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("naldaemn.exe") Then

MsgBox(4096, "Error:", "naldaemn.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("namgr.exe") Then

MsgBox(4096, "Error:", "namgr.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("napdaemn.exe") Then

MsgBox(4096, "Error:", "napdaemn.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nchronos.exe") Then

MsgBox(4096, "Error:", "nchronos.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("ncollect.exe") Then

MsgBox(4096, "Error:", " cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nconvert.exe") Then

MsgBox(4096, "Error:", "ncollect.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("ndiiop.exe") Then

MsgBox(4096, "Error:", "ndiiop.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("ndyncfg.exe") Then

MsgBox(4096, "Error:", "ndyncfg.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nhldaemn.exe") Then

MsgBox(4096, "Error:", "nhldaemn.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nhttp.exe") Then

MsgBox(4096, "Error:", "nhttp.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nhttpcgi.exe") Then

MsgBox(4096, "Error:", "nhttpcgi.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nimapcl.exe") Then

MsgBox(4096, "Error:", "nimapcl.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nlogasio.exe") Then

MsgBox(4096, "Error:", "nlogasio.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nminder.exe") Then

MsgBox(4096, "Error:", "nminder.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nnntpcl.exe") Then

MsgBox(4096, "Error:", "nnntpcl.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nnotesmm.exe") Then

MsgBox(4096, "Error:", "nnotesmm.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nnsadmin.exe") Then

MsgBox(4096, "Error:", "nnsadmin.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("notesbuddy.exe") Then

MsgBox(4096, "Error:", "notesbuddy.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("npop3.exe") Then

MsgBox(4096, "Error:", "npop3.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("ntaskldr.exe") Then

MsgBox(4096, "Error:", "ntaskldr.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("ntgclhap.exe") Then

MsgBox(4096, "Error:", "ntgclhap.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nupdall.exe") Then

MsgBox(4096, "Error:", "nupdall.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nupdate.exe") Then

MsgBox(4096, "Error:", "nupdate.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nweb.exe") Then

MsgBox(4096, "Error:", "nweb.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nwrdaemn.exe") Then

MsgBox(4096, "Error:", "nwrdaemn.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nxpcdmn.exe") Then

MsgBox(4096, "Error:", "nxpcdmn.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("rtfcnvt.exe") Then

MsgBox(4096, "Error:", "rtfcnvt.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("desktopmgr.exe") Then

MsgBox(4096, "Error:", "desktopmgr.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("ntaskldr.exe") Then

MsgBox(4096, "Error:", "ntaskldr.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

If ProcessExists("nlnotes.exe") Then

MsgBox(4096, "Error:", "nlnotes.exe cannot terminate. Notes cannot restart. Please restart your PC when convenient.")

Exit

EndIf

$search = FileFindFirstFile($npath & "\~*.*")

While 1

$file = FileFindNextFile($search)

If @error Then ExitLoop

MsgBox(4096, "Error:", $npath & "\~notes.lck cannot be deleted. Notes cannot restart. Please restart your PC when convenient.")

Exit

WEnd

EndFunc

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

Func Prog()

ProgressOn ( "KILL NOTES", "killing notes...", "0 percent")

For $i = 10 to 100 step 10

sleep (100)

ProgressSet( $i, $i & " percent")

Next

ProgressSet(100 , "Restarting Notes", "Complete!")

sleep (100)

EndFunc

Func CheckST ()

sleep (1000)

If ProcessExists("nlnotes.exe") Then

Exit

ElseIf ProcessExists("sametime.exe") Then

MsgBox(4096, "Cannot Restart Notes...", "Please exit Sametime then manually re-open Notes.")

EndIf

EndFunc

Func RNotes ()

$answer = MsgBox(262148, "Notes", "Re-Open Notes?")

If $answer = 6 Then

Run ("C:\lotus\notes\nlnotes.exe")

ElseIf $answer = 7 Then

Exit

EndIf

EndFunc

$parent = GUICreate("Kill Notes v0.26", 220, 80)

Opt("GUICoordMode",2)

$Button_1 = GUICtrlCreateButton ( "Run", 10, 30, 100 )

$Button_2 = GUICtrlCreateButton ( "About", 0, -1 )

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button_1

GUISetState(@SW_HIDE)

Call("Prog")

Call("KillN")

Call("Check")

Call("fCheck")

Call("RNotes")

Call("CheckST")

ProgressOff ( )

ExitLoop

Case $msg = $Button_2

Call("About")

EndSelect

Wend

</autoit>

Calling the function about() also works alright.

Share this post


Link to post
Share on other sites

Honestly, I'm clueless. I'm working now so I can't really see what's wrong :D It's a very weird problem. But changing _MsgBox() with the built-in MsgBox() function works just like yours.

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(64, "About Kill Notes v0.26", $Text)
EndFunc   ;==>About

Share this post


Link to post
Share on other sites

I am calling up a function about() but im noticing that the _msgbox function is not running because the OK button and the "i" icon are not coming up.. anyone have any ideas?

thanks.

You posted the same stuff elsewhere on this forum ... crossposting is NOT a smart thing to do ...

You are getting your own _Msgbox mixed up with AutoIT's Msgbox, which is defined as

MsgBox ( flag, "title", "text" [, timeout] )

So, what is the flag for your own version "_msgbox" and where is it applied? I cannot decipher "104" as a valid entry, if that is what it was meant to be?

Share this post


Link to post
Share on other sites

You posted the same stuff elsewhere on this forum ... crossposting is NOT a smart thing to do ...

You are getting your own _Msgbox mixed up with AutoIT's Msgbox, which is defined as

MsgBox ( flag, "title", "text" [, timeout] )

So, what is the flag for your own version "_msgbox" and where is it applied? I cannot decipher "104" as a valid entry, if that is what it was meant to be?

No no, he's making a custom messagebox with a GUI. 104 is the icon index of user32.dll. The weird thing is that the _MsgBox() udf works fine when isolated.

Share this post


Link to post
Share on other sites

This is very confusing, I can't find what's wrong... Look at this, I call About() before creating the main GUI and it works fine, but when I call it after creating the main GUI, it stops working. I can't find any repeated variables that could be causing the problem... so I don't know. Look:

#include <GUIConstants.au3>
$npath = IniRead("c:\lotus\notes\notes.ini", "Notes", "Directory", "NotFound")

;=======
About();Works fine here.
;=======
$parent = GUICreate("Kill Notes v0.26", 220, 80)

Opt("GUICoordMode", 2)
$Button_1 = GUICtrlCreateButton("Run", 10, 30, 100)
$Button_2 = GUICtrlCreateButton("About", 0, -1)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_1
            GUISetState(@SW_HIDE)
            Call("Prog")
            Call("KillN")
            Call("Check")
            Call("fCheck")
            Call("RNotes")
            Call("CheckST")
            ProgressOff()
            ExitLoop
        Case $msg = $Button_2
            ;========
            About();Doesn't work
            ;=========
    EndSelect
    ;========
    About();Doesn't work
    ;=========
WEnd

Share this post


Link to post
Share on other sites

This is very confusing, I can't find what's wrong... Look at this, I call About() before creating the main GUI and it works fine, but when I call it after creating the main GUI, it stops working. I can't find any repeated variables that could be causing the problem... so I don't know. Look:

#include <GUIConstants.au3>
$npath = IniRead("c:\lotus\notes\notes.ini", "Notes", "Directory", "NotFound")

;=======
About();Works fine here.
;=======
$parent = GUICreate("Kill Notes v0.26", 220, 80)

Opt("GUICoordMode", 2)
$Button_1 = GUICtrlCreateButton("Run", 10, 30, 100)
$Button_2 = GUICtrlCreateButton("About", 0, -1)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_1
            GUISetState(@SW_HIDE)
            Call("Prog")
            Call("KillN")
            Call("Check")
            Call("fCheck")
            Call("RNotes")
            Call("CheckST")
            ProgressOff()
            ExitLoop
        Case $msg = $Button_2
            ;========
            About();Doesn't work
            ;=========
    EndSelect
    ;========
    About();Doesn't work
    ;=========
WEnd

Share this post


Link to post
Share on other sites

This is very confusing, I can't find what's wrong... Look at this, I call About() before creating the main GUI and it works fine, but when I call it after creating the main GUI, it stops working. I can't find any repeated variables that could be causing the problem... so I don't know. Look:

#include <GUIConstants.au3>
$npath = IniRead("c:\lotus\notes\notes.ini", "Notes", "Directory", "NotFound")

;=======
About();Works fine here.
;=======
$parent = GUICreate("Kill Notes v0.26", 220, 80)

Opt("GUICoordMode", 2)
$Button_1 = GUICtrlCreateButton("Run", 10, 30, 100)
$Button_2 = GUICtrlCreateButton("About", 0, -1)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_1
            GUISetState(@SW_HIDE)
            Call("Prog")
            Call("KillN")
            Call("Check")
            Call("fCheck")
            Call("RNotes")
            Call("CheckST")
            ProgressOff()
            ExitLoop
        Case $msg = $Button_2
            ;========
            About();Doesn't work
            ;=========
    EndSelect
    ;========
    About();Doesn't work
    ;=========
WEnd

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

:D

haha

To OP. here's a fix for your _Msgbox() function:

Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = 0)
    Opt("GUICoordMode", 1)
    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)
    Opt("GUICoordMode", 2)
    Return $MsgValue
EndFunc   ;==>_MsgBox
Edited by Nahuel

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