piratao2 Posted May 18, 2009 Share Posted May 18, 2009 msgbox pauses execution, I want some msgbox that will not pause it. Thanks! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 18, 2009 Moderators Share Posted May 18, 2009 piratao2,Look at SplashTextOn in the Help file.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
piratao2 Posted May 18, 2009 Author Share Posted May 18, 2009 Can the SplashTextOn screen contain a button and close only when the user clicks on this button? If not what else can I use? Link to comment Share on other sites More sharing options...
Valuater Posted May 18, 2009 Share Posted May 18, 2009 Maybe... MsgBoxer("Main Event", "Please wait.... ") Func MsgBoxer($title, $text) Local $Script = 'MsgBox(262208,"' & $title & '","' & $text & '")' Local $file_loc = @ScriptDir & "\Killer.au3" FileDelete($file_loc) FileWrite($file_loc, $Script) If @Compiled = 1 Then $file_exe = FileGetShortName(@AutoItExe & ' /AutoIt3ExecuteScript "' & $file_loc & '"') Run($file_exe) Else $file_au3 = FileGetShortName($file_loc) Run(@AutoItExe & " " & $file_au3, "", @SW_HIDE) EndIf EndFunc ;==>MsgBoxer MsgBox(4096, "Test", "The script has continued ") 8) Link to comment Share on other sites More sharing options...
FreeFry Posted May 18, 2009 Share Posted May 18, 2009 Simple answer: no. But there're alternatives, such as what Valuater posted, or, you could use GUICreate to make a custom one(too tired to post an example, sorry). Link to comment Share on other sites More sharing options...
CodyBarrett Posted May 18, 2009 Share Posted May 18, 2009 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt ('GUIoneventmode',1) $I = GUICreate ( "Example", 200,100) GUICtrlCreateButton ('Example Button', 50, 70, 100, 20) GUISetOnEvent ($GUI_EVENT_CLOSE,'_exit',$I) GUISetState() While 1 WEnd Func _exit () Exit EndFunc [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
piratao2 Posted May 18, 2009 Author Share Posted May 18, 2009 Let me tell you what's the problem... My main program have a GUI and should be able to popup multiple message boxes with each error that it finds while executing some tasks that I will not mention for simplicity. I should then be able to deal with multiple GUI Message Boxes and close each of them when the respective OK button has been pressed on each different GUI Message Box. Now I need some ideas just to make sure that the right GUI will be closed when I press the OK button on it. ;suppose here is the code that creates my main GUI, with Opt ('GUIoneventmode',1) ;my program is already working and has functions for everything I need. The only remaining is the GUI Message Box. while 1=1 sleep(100) wend ;-------------------------------------------------------------------------------------- func _GUIMsgBox($titlemsg,$textmsg) GUICreate($titlemsg,300,200) GUICtrlCreateLabel($textmsg,10,10,280,80) GUICtrlCreateButton("Ok",105,110,90,17) GUICtrlSetOnEvent(-1,"btn_guimsgbox_click") GUISetState(@SW_SHOW) EndFunc ;-------------------------------------------------------------------------------------- func btn_guimsgbox_click() GUIDelete() EndFunc The function that creates the various GUI windows is ok. The problem is closing only the right one. I tought GUIDelete would consider the last used GUI as being the one where I clicked the OK button, but on my tests, when I clicked OK on one of the GUI Message Boxes that I created, another one closed. And then the Ok on the other GUI Message Boxes were doing nothing... Please help with any ideas... Thanks. Link to comment Share on other sites More sharing options...
Valuater Posted May 18, 2009 Share Posted May 18, 2009 (edited) Use my function above and you can have as many message boxes as you want and no worry about which GUI is going to close 8) Edited May 18, 2009 by Valuater Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 18, 2009 Moderators Share Posted May 18, 2009 (edited) I'm curious on why you'd have a message box pop up at all if you didn't want the user to interact with it or receive a return value at least. If you do want a return value, Valuaters (the way it's set up currently) won't achieve that for you without using std method. @Val .. Using FileGetShortName() like that does nothing:$file_loc = @DesktopDir & "\I am a directory\I am a file.exe" ConsoleWrite(FileGetShortName(@AutoItExe & ' /AutoIt3ExecuteScript "' & $file_loc & '"') & @CRLF) It's best to just use double quotes (you should also do that for the AutoIt exe). Example:$file_exe = '"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & $file_loc & '"') Edit: I'll add the redundancy of returning a value with that type of message box, is the script still has to pause. Example with std:ConsoleWrite(__MsgBox(68, "Main Event", "Please wait.... ") & @CRLF) Func __MsgBox($i_flag, $s_title, $s_text = "", $i_timeout = 0) Local $s_send = 'ConsoleWrite(MsgBox(' & _ $i_flag & ",'" & $s_title & "','" & $s_text & "'," & $i_timeout & "))" Local $s_out_val = "" Local $i_pid = Run('"' & @AutoItExe & '" /AutoIt3ExecuteLine "' & $s_send & '"', "", @SW_HIDE, 6) While 1 $s_out_val &= StdoutRead($i_pid) If @error Then ExitLoop WEnd Return Int($s_out_val) EndFunc Edited May 19, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
piratao2 Posted May 19, 2009 Author Share Posted May 19, 2009 Use my function above and you can have as many message boxes as you want and no worry about which GUI is going to close 8)b If @Compiled = 1 Then $file_exe = FileGetShortName(@AutoItExe & ' /AutoIt3ExecuteScript "' & $file_loc & '"') Run($file_exe) Else $file_au3 = FileGetShortName($file_loc) Run(@AutoItExe & " " & $file_au3, "", @SW_HIDE) EndIfThe code that you wrote simply does not work for me. The program is intended to run on machines that don't have autoit installed and it would be very unreasonable to request autoit to be installed as a pre requisite for my program to work. My function should work if I manage to associate the guidelete() with the gui window where the user clicked the button ok. And the reason for having multiple message boxes on the screen is to inform the user that some of the processes failed to complete, keeping a message on the screen for each failed process, while not interfering on the remaining processes that my program should start. So, in short, the reason is just notification without stoping the main processing. And the reason for having various message boxes (instead of a single one in the end) is just kind of visual convenience, because my program starts many specific processes in a specific sequence. So it is easier to identify which launched processes errored out if I keep the sequence in the task bar. So, does anybody have a creative idea on how I can create various GUIs and point their OK buttons to the same function, being this function responsible for closing only the GUI where the respective OK button has been pressed? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 19, 2009 Moderators Share Posted May 19, 2009 (edited) The code that you wrote simply does not work for me. The program is intended to run on machines that don't have autoit installed and it would be very unreasonable to request autoit to be installed as a pre requisite for my program to work.My function should work if I manage to associate the guidelete() with the gui window where the user clicked the button ok.And the reason for having multiple message boxes on the screen is to inform the user that some of the processes failed to complete, keeping a message on the screen for each failed process, while not interfering on the remaining processes that my program should start.So, in short, the reason is just notification without stoping the main processing. And the reason for having various message boxes (instead of a single one in the end) is just kind of visual convenience, because my program starts many specific processes in a specific sequence. So it is easier to identify which launched processes errored out if I keep the sequence in the task bar.So, does anybody have a creative idea on how I can create various GUIs and point their OK buttons to the same function, being this function responsible for closing only the GUI where the respective OK button has been pressed?AutoIt doesn't have to be installed as long as you are calling that from an AutoIt executable As far as the other stuff, I think maybe you should re-design your idea a bit to be something that is synchronous.Edit:Had to edit my smiley Edited May 19, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
piratao2 Posted May 19, 2009 Author Share Posted May 19, 2009 AutoIt doesn't have to be installed as long as you are calling that from an AutoIt executable As far as the other stuff, I think maybe you should re-design your idea a bit to be something that is synchronous.Edit:Had to edit my smiley Did not know any autoit exe could be used to execute an au3...But I think anyway that generating multiple scripts is not good technique, so your idea is not what I use to do.Thanks anyway. Link to comment Share on other sites More sharing options...
piratao2 Posted May 19, 2009 Author Share Posted May 19, 2009 I have the solution already. It's working preety fine. To call the function that creates a GUI Message Box: $Form1_1 = GUICreate("Macro Putty", 664, 617, 194, 116) Opt("GUIOnEventMode", 1) GUISetState(@SW_SHOW, $Form1_1) ;my main gui code here ;there are other functions to do the main program work ;then below I show examples on how to use my GUI Message Boxes. _GUIMsgBox("test1","text here") _GUIMsgBox("test2","text here") _GUIMsgBox("test3","text here") ;this while is for keeping the main gui program running until the events of the main program don't occur. While 1 Sleep(100) WEndoÝ÷ Ø Ý¶ºw-ìjëh×6func _GUIMsgBox($titlemsg,$textmsg) GUICreate($titlemsg,300,200) GUICtrlCreateLabel($textmsg,10,10,280,80) GUICtrlCreateButton("Ok",105,110,90,17) GUICtrlSetOnEvent(-1,"btn_guimsgbox_click") GUISetState(@SW_SHOW) EndFunc ;-------------------------------------------------------------------------------------- func btn_guimsgbox_click() local $handle_msg $handle_msg=WinGetHandle("[active]") GUIDelete($handle_msg) EndFunc Link to comment Share on other sites More sharing options...
herewasplato Posted May 19, 2009 Share Posted May 19, 2009 ... It's working preety fine. ...Pretty fine? Does that mean that it does not always work for you? Anyway, I'll offer this solution from the help file under "Running Scripts" Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, [color="#ff0000"]''[/color]Hello World![color="#ff0000"]''[/color], [color="#ff0000"]''[/color]Hi![color="#ff0000"]''[/color])"')It is one line of code. It will always work (if you get the single quotes and double quotes right). It allows the main script to continue. ...but you probably want to stick with your GUI if it works for you. Note: It does generate one instance of the compiled script for each MsgBox. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Valuater Posted May 19, 2009 Share Posted May 19, 2009 The code that you wrote simply does not work for me.NMI'm done with this thread8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 19, 2009 Moderators Share Posted May 19, 2009 Did not know any autoit exe could be used to execute an au3...But I think anyway that generating multiple scripts is not good technique, so your idea is not what I use to do.Thanks anyway.I never said it was the solution, I personally would write a dll for it in another language if I were going to do it that way. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
trancexx Posted May 19, 2009 Share Posted May 19, 2009 (edited) You could always do someting like this:expandcollapse popup#NoTrayIcon #include <WindowsConstants.au3> ;#include <WinAPI.au3> Opt("WinWaitDelay", 0) Global $hGui = GUICreate("Test", 300, 300, 20, 100, -1, $WS_EX_TOPMOST) Global $hButton_NonBlocking_InputBox = GUICtrlCreateButton("Show InputBox", 100, 100, 150, 25) Global $hButton_Classic_InputBox = GUICtrlCreateButton("Show classic InputBox", 100, 150, 150, 25) Global $hButton = GUICtrlCreateButton("FileOpenDialog", 20, 220, 120, 25) #cs Global $bDialog = "0x0100FFFF00000000000004004C0ACC80040000000000A2005F00000000004100" & _ "750074006F0049007400200049006E00700075007400200042006F0078000000" & _ "0800000000014D00530020005300680065006C006C00200044006C0067000000" & _ "0000000000000000000002500700070093002C00EA030000FFFF820050007200" & _ "6F006D0070007400000000000000000000000000800081500700380093000C00" & _ "E9030000FFFF8100000000000000000000000000010001501000490032000E00" & _ "01000000FFFF80004F004B000000000000000000000000000000015057004900" & _ "32000E0002000000FFFF8000430061006E00630065006C0000000000" Global $tDialog = DllStructCreate("byte[" & BinaryLen($bDialog) & "]") DllStructSetData($tDialog, 1, $bDialog) Global $hDialogProc = DllCallbackRegister("_DialogProc", "int", "hwnd;dword;dword;hwnd") Global $aCall = DllCall("user32.dll", "hwnd", "CreateDialogIndirectParamW", _ "hwnd", 0, _ "ptr", DllStructGetPtr($tDialog), _ "hwnd", $hGui, _ "ptr", DllCallbackGetPtr($hDialogProc), _ "dword", 0) Global $hDialog = $aCall[0] #ce ;#cs Global $hDialogProc = DllCallbackRegister("_DialogProc", "int", "hwnd;dword;dword;hwnd") Global $aCall = DllCall("user32.dll", "hwnd", "CreateDialogParamW", _ "hwnd", 0, _ "int", 1000, _ "hwnd", $hGui, _ "ptr", DllCallbackGetPtr($hDialogProc), _ "dword", 0) Global $hDialog = $aCall[0] ;#ce GUISetState() While 1 Switch GUIGetMsg() Case - 3 Exit Case $hButton_NonBlocking_InputBox WinSetState($hDialog, 0, @SW_SHOW) ;_WinAPI_ShowWindow($hDialog) Case $hButton_Classic_InputBox InputBox("", "") Case $hButton FileOpenDialog("", "", "(*)", Default, "", $hGui) EndSwitch WEnd DllCallbackFree($hDialogProc) Func _DialogProc($hWnd, $iMsg, $wParam, $lParam) Switch $iMsg Case 16 WinSetState($hWnd, 0, @SW_HIDE); use DestroyWindow to destroy it (modeless dialog box) Case $WM_COMMAND Switch $wParam Case 1 ConsoleWrite("'OK' clicked" & @CRLF) Case 2 ConsoleWrite("'Cancel'-ed" & @CRLF) EndSwitch EndSwitch EndFunc ;==>_DialogProcOnly imagination is needed to modify that to suite your needs.There is also ProgAndy's thread exploit around (use forum's search engine).But, I guess there is nothing wrong with two processes. Edited May 19, 2009 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
piratao2 Posted May 19, 2009 Author Share Posted May 19, 2009 (edited) Just to make sure, I'd like to say that the solution that I posted works 100% perfect, it's simple and it's 100% perfect for my needs. But I liked too herewasplato's suggestion, however I'm not sure it would be good to create another instance of the program for each message that pops up... trancexx's solution may work too (I did not take the time to look it carefuly, but it seems to be creating a message box using the api directly)... Thanks everybody! Thanks too to Valuater whom seemed to get angry with me... I did not mean to offend, just told that the proposed solution is not the type of solution that my program requires. Overrall it's basically kind of personal taste... Edited May 19, 2009 by piratao2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now