366 posts in this topic
SOLVED: Unable to display MsgBox from Service
I'm unable to display a message box from a compiled AutoIt alerting script that is executed from a service (also a compiled AutoIt script). I used $MB_SERVICE_NOTIFICATION, but the dialog doesn't appear and the alerting script continues as if the OK button had been clicked. The service script uses ShellExecute() to launch the alerter (as opposed to a *Wait() call) so it can continue processing. Note that we used Windows Service Wrapper (winsw) to turn the compiled script into a service but haven't identified any issues from it.
I tried the one-line execute example given in this thread: Message box timeout not working
; 2097152 = $MB_SERVICE_NOTIFICATION $iPID = Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(2097152, ''' & $sTitle & ''', ''' & $sText & ''')"') without the timeout code, but no luck: the MsgBox does not appear. (In any case, we don't have AutoIt installed on the target system, so it would have to be converted into a .exe file.)
We're developing and unit-testing on Win 7 Enterprise; the target OS is Win 7 Pro, and the AutoIt version is 126.96.36.199.
Any solutions or suggestions will be much appreciated. Code fragments are below.
The following code fragment is the relevant portion of the alerting script that displays the MsgBox:
[...] ; Alert the operator that there's a problem with the recording $sFeed = $aRecInfo $sSession = $aRecInfo $sTemp = $aRecInfo $sDate = _FormatDate($sTemp) $sTemp = $aRecInfo $sTime = _FormatTime($sTemp) _Debug2("Inactive recording feed " & $sFeed & ", Session=" & $sSession & ", Start Date/Time=" & _ $sDate & " " & $sTime) $sErrorMsg = "ERROR: Feed " & $sFeed & " for session " & $sSession & " stopped, notify reporter immediately" $iMbFlag = $MB_SERVICE_NOTIFICATION _Debug1("Displaying MsgBox...") MsgBox($iMbFlag, "INTERVIEW RECORDING ERROR", $sErrorMsg) _Debug1("Returned from MsgBox") [...]
And the calling code fragment in the service is:
; Walk through the array backwards so we don't end up evaluating an index that doesn't exist For $iIndex = UBound($aFeedArray)-1 To 0 Step -1 [...] ; Before timing-out the feed, check for a .mpgpart file (=> feed may still be recording) $sDirPath = $sDirTemp & "\" & $sFeedTemp & "\" & $aFeedArray[$iIndex][$cSessionName] $sMpgPartName = GetMpgPart($sDirPath, $sFeedTemp) If StringLen($sMpgPartName) > 0 Then ; If .mpgpart file name hasn't changed in more than $iDeadFeedTime seconds, then declare feed dead ; ========v Test code to force error v======== $sMpgPartName = $aFeedArray[$iIndex][$cMpgPartName] ; ========^ Test code to force error ^======== _Debug2("Just set $sMpgPartName to '" & $sMpgPartName & "', should fall into dead-feed code") If $sMpgPartName = $aFeedArray[$iIndex][$cMpgPartName] Then ; Name is same => feed is dead: alert the operator and delete the feed w/out stop-processing _Debug2("Feed " & $sFeedTemp & " looks dead -- alerting the operator") _Debug2("Delete GUID " & $aFeedArray[$iIndex][$cGUID]) ; ======== Alert app execution ======== ; $sAlertApp = @ScriptDir & "\" & "RecAlert.exe" $iChildPid = ShellExecute($sAlertApp, $sDirPath, "", "open") _Debug2("Alert app: ShellExecute(): " & _RetStr($iChildPid, @error, @extended)) _ArrayDelete($aFeedArray, $iIndex) Else ; Otherwise, the .mpgpart name has changed, reset the timer, store the name, and continue _Debug2("Feed " & $sFeedTemp & " timeout, but has new .mpgpart file -- continuing") $aFeedArray[$iIndex][$cDateTime] = TimerInit() $aFeedArray[$iIndex][$cMpgPartName] = $sMpgPartName EndIf ContinueLoop EndIf [...] Next
CompileMe - Compile script faster without GUI, using hotkey
- Compile script faster
- Using Hotkey, no GUI
- Using *.BAT and *.VBS script to compile
- Full info for *.exe file. Ex: Software name, version, companyname ...
Tiếng Việt: https://khathiatz.blogspot.com/2016/07/compile-me.html
Compile question help
I would like to ask you some questions about compiling.
I use Autoit wrapper gui 15.920.938.0
1. I would like to delete all comments from my compiled code.
If is possible...
I am using the 188.8.131.52 version of Autoit, I would like this time to protect my code, without using external tools that are seen as viruses, how do you protect your code usually?
Just a Little question why the autoit exes also with a very Little Code get when generated around 800-1000kb also would there be anyday away to compile a script to a Dynamic Link Library(dll)? Is there a way to Change to encryption of Compiling to something what makes the compile file a bit Shorter :O?
Thanks in advance.
When we compile our code through Aut2exe, version is missing if we check the properties of the compiled executable.
Can any one suggest how to set a version number to the compiled exe.