Jump to content

Display Msgbox but continue the script.


ejbmail
 Share

Recommended Posts

I need HELP on how to display a message box but the script will continue to finish with the message box still remaining on the Remote PC. I can not use a time out function because I want to leave the message box for the user to reboot when he can.

Link to comment
Share on other sites

I need HELP on how to display a message box but the script will continue to finish with the message box still remaining on the Remote PC. I can not use a time out function because I want to leave the message box for the user to reboot when he can.

I believe what you're looking for is /AutoIt3ExecuteLine (check for it in the help file under "Search")

Here's an example:

#include <GUIConstants.au3>
GUICreate("Background process",500,500)
GUICtrlCreateLabel("Counter:",10,10,50,20)
$counter = GUICtrlCreateLabel("",10,25,50,20)

$start = 1
$stop = 10
GUICtrlSetData($counter,$start)
GUISetState()
While 1
    Do
    Sleep (1000)
    GUICtrlSetData($counter,GUICtrlRead($counter)+1)
    If GUICtrlRead($counter) = 3 Then
        Run(@AutoItExe & ' /AutoIt3ExecuteLine  "MsgBox(0, ''Notice:'', ''Note that the counter in the background GUI continues incrementing'')"')
    EndIf
Until GUICtrlRead($counter) = $stop
Exit
WEnd

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

A quick question.....

Do you mean that I should run my script exe with this run command or add this to my script as a command line for the message box.

I believe what you're looking for is /AutoIt3ExecuteLine (check for it in the help file under "Search")

Here's an example:

#include <GUIConstants.au3>
GUICreate("Background process",500,500)
GUICtrlCreateLabel("Counter:",10,10,50,20)
$counter = GUICtrlCreateLabel("",10,25,50,20)

$start = 1
$stop = 10
GUICtrlSetData($counter,$start)
GUISetState()
While 1
    Do
    Sleep (1000)
    GUICtrlSetData($counter,GUICtrlRead($counter)+1)
    If GUICtrlRead($counter) = 3 Then
        Run(@AutoItExe & ' /AutoIt3ExecuteLine  "MsgBox(0, ''Notice:'', ''Note that the counter in the background GUI continues incrementing'')"')
    EndIf
Until GUICtrlRead($counter) = $stop
Exit
WEnd
Link to comment
Share on other sites

When I add this line into my script I receive this error:

Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(4095, "Installation Completed", "**** Please reboot the PC ****")"')

This is the relevant part:

Run(@AutoItExe & ' /AutoIt3ExecuteLine  "MsgBox(0, ''Notice:'', ''Note that the counter in the background GUI continues incrementing'')"')

post-22821-1196103091_thumb.jpg

Link to comment
Share on other sites

  • 2 weeks later...

This method is good for returning values:

$iCount = 0 ;Only for the example
AdlibEnable("SetData", 1000)

$iRet = _MsgBoxEx(36, "My Title", "Message")

MsgBox(64, "", "Returned Value is: " & $iRet)

Func SetData($sData)
    $iCount += 1
    ConsoleWrite("The script is not paused " & $iCount & " second(s)" & @LF)
EndFunc

Func _MsgBoxEx($iType, $sTitle, $sText, $iTimeOut=0)
    Local $sAu3Line = '"ConsoleWrite(MsgBox(' & $iType & ', ''' & $sTitle & ''', ''' &  $sText & ''', ' &  $iTimeOut & '))"'
    Local $iAu3PID = Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sAu3Line, '', @SW_SHOW, 6)
    WinWait($sTitle, $sText)
    
    Local $iStdOutRead
    While ProcessExists($iAu3PID)
        $iStdOutRead = StdoutRead($iAu3PID, 5, True)
        If Number($iStdOutRead) Then Return $iStdOutRead
        Sleep(10)
    WEnd
    
    If Number($iStdOutRead) Then Return $iStdOutRead
    Return SetError(1, 0, -1)
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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