DigDeep Posted May 2, 2015 Posted May 2, 2015 I am trying to get the font color function setup but not able to get after multiple attempts also.What I want is when any of the Step actions are completed, it would display msgbox with the status. The Status action Function is assigned at the end.Now I wanted if the msgbox displays Value1: Failed then the Failed word should show in Green. and if it's Passed the the Passed should be Green in color.Now after trying a lot with different ways, I understand that this might not be possible with just a normal msgbox. I even checked with _ExtMsgBox funtions but it did not helped here.I can try to get the $Failed = 'Failed' and $Passed = 'Passed' assigned initiattly and call that inside the function. But that also did not work.I believe GUICtrlSetColor($Install, $COLOR_GREEN) and GUICtrlSetColor($Install, $COLOR_RED) but for that I have to prepare the Func Final() in a different way which I am not able to do.Is there anyways you can help me here? expandcollapse popup#Region #AutoIt3Wrapper_Run_Tidy=y #EndRegion #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <process.au3> #include <IE.au3> #include <Array.au3> #include <Constants.au3> Global $InstallEvent, $Value1, $Value2 #Region $Form1 = GUICreate("Form1", 388, 241, 750, 360) $Step1 = GUICtrlCreateLabel("Step 1", 32, 40, 42, 20) $Step2 = GUICtrlCreateLabel("Step 3", 216, 40, 42, 20) $Step3 = GUICtrlCreateLabel("Step 2", 120, 40, 42, 20) $Step4 = GUICtrlCreateLabel("Step 4", 312, 40, 42, 20) $Input_Text = GUICtrlCreateInput("", 48, 104, 289, 24) $OK = GUICtrlCreateButton("OK", 152, 176, 75, 25) GUISetState(@SW_SHOW) #EndRegion OnAutoItExitRegister("Process_Terminated") While 1 $nMsg = GUIGetMsg() $aInfo = GUIGetCursorInfo($Form1) If $aInfo[2] Then If $aInfo[4] = $Input_Text Then GUICtrlSetData($Input_Text, "") EndIf Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $OK Select Case GUICtrlRead($Input_Text) = '1' ; Running multiple functions SplashTextOn("Step 1", "Running multiple functions under Step 1.", 275, 100, -1, -1, "Verdana") CreateLog() ; Set up Log file Sleep(1000) SplashOff() MsgBox(0, "Final", $Value1 & @CRLF & $Value2) Case GUICtrlRead($Input_Text) = '2' ; Running multiple functions SplashTextOn("Step 2", "Running multiple functions under Step 2.", 275, 100, -1, -1, "Verdana") CreateLog() ; Set up Log file Sleep(1000) SplashOff() MsgBox(0, "Final", $Value1 & @CRLF & $Value2) Case GUICtrlRead($Input_Text) = '3' ; Running multiple functions SplashTextOn("Step 3", "Running multiple functions under Step 3.", 275, 100, -1, -1, "Verdana") CreateLog() ; Set up Log file Sleep(10000) SplashOff() MsgBox(0, "Final", $Value1 & @CRLF & $Value2) Case GUICtrlRead($Input_Text) = '4' ; Running multiple functions SplashTextOn("Step 3", "Running multiple functions under Step 3.", 275, 100, -1, -1, "Verdana") CreateLog() ; Set up Log file Sleep(10000) SplashOff() Final() MsgBox(0, "Final", $Value1 & @CRLF & $Value2) EndSelect EndSwitch WEnd Func CreateLog() ; Creating Logs Global $InstallFolder = @ScriptDir ; Create the Log file in this folder Global $InstallEvent = $InstallFolder & "\" & "Process.log" _FileCreate($InstallEvent) EndFunc ;==>CreateLog Func Process_Terminated() Switch @exitMethod ;Case 0 ; _FileWriteLog($InstallEvent, "Natural closing.") Case 1 _FileWriteLog($InstallEvent, "close by Exit function.") Case 2 _FileWriteLog($InstallEvent, "close by clicking on exit of the systray.") Case 3 _FileWriteLog($InstallEvent, "close by user logoff.") Case 4 _FileWriteLog($InstallEvent, "close by Windows shutdown.") EndSwitch EndFunc ;==>Process_Terminated Func Final() Select Case Not ProcessExists("ProcessName") $Value1 = "Value 1: Failed" Case Else $Value1 = "Value 1: Passed" EndSelect Select Case Not FileExists("Program Name") $Value2 = "Value 2: Failed" Case Else $Value2 = "Value 2: Passed" EndSelect EndFunc ;==>Final
water Posted May 2, 2015 Posted May 2, 2015 MsgBox doesn't support the setting of colors.You could either create your own child GUI to display the colored message or use the ExtMsgBox UDF written by Melba23. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
DigDeep Posted May 2, 2015 Author Posted May 2, 2015 I have already been trying to see if a child GUI will help but not able to get that and have already checked the _Extended msgbox of Melba which looks what I a, looking for but not able to understand how to get it started.
Moderators Melba23 Posted May 2, 2015 Moderators Posted May 2, 2015 sunshinesmile84,Not too difficult to get what you want:#include "ExtMsgBox.au3" _ExtMsgBoxSet(0, Default, Default, 0xFF0000) ; Set text to red _ExtMsgBox($EMB_ICONINFO, "OK", "Font colour", "I am in RED") _ExtMsgBoxSet(0, Default, Default, 0x00FF00) ; Set text to green _ExtMsgBox($EMB_ICONINFO, "OK", "Font colour", "I am in GREEN")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
DigDeep Posted May 2, 2015 Author Posted May 2, 2015 hey Melba23, thank you for replying.This is what I am getting.$EMB_ICONINFO was giving variable not declared which went off after getting it at the top but others not. I think "ExtMsgBox.au3" is not getting recognized on mine.
Moderators Melba23 Posted May 2, 2015 Moderators Posted May 2, 2015 sunshinesmile84,Have you downloaded the ExtMsgBox UDF from the link in my sig and placed it in the same folder as the script?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
DigDeep Posted May 2, 2015 Author Posted May 2, 2015 Got it now.Let me check how I can use this on my code. This thing is, I want only the word Failed or Passed to be colored and not the complete line.Thanks for your help. Will disturb you again if any issues.
Moderators Melba23 Posted May 2, 2015 Moderators Posted May 2, 2015 sunshilesmile84, I want only the word Failed or Passed to be colored and not the complete lineThen you will need to create your own dialog and use separate labels - is it really worth the extra effort?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
water Posted May 2, 2015 Posted May 2, 2015 Why color single words? That's eye candy. Wouldn't MsgBox do the same? Set the flags and you will get error, information or abort icons. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
DigDeep Posted May 2, 2015 Author Posted May 2, 2015 Yes, the code I have written needs to have it differentiated like that. I am at the end of my work but stuck with just this part since long time. This is what I wanted. There are many Steps that would be displayed but as an example I am just shown 2 lines here.Step 1: PassedStep 2: Failed
DigDeep Posted May 2, 2015 Author Posted May 2, 2015 (edited) I want single words coz, I have written the function as:So, when the msgbox is called after the step 1 or 2 or 3 or 4, it would display the msgbox either of the 2: Value 1: Passed / Failed Func Final() Select Case Not ProcessExists("ProcessName") $Value1 = "Value 1: Failed" Case Else $Value1 = "Value 1: Passed" EndSelect Select Case Not FileExists("Program Name") $Value2 = "Value 2: Failed" Case Else $Value2 = "Value 2: Passed" EndSelectEndFunc ;==>Final Edited May 2, 2015 by sunshinesmile84
water Posted May 2, 2015 Posted May 2, 2015 Couldn't you just use upper case and spaces? So "Failed" becomes "F A I L E D" My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
DigDeep Posted May 2, 2015 Author Posted May 2, 2015 So, depending upon the work done if the value is passed, then it should give the same line as Value 1: and only the Passed or Failed would be changed.
DigDeep Posted May 2, 2015 Author Posted May 2, 2015 I was actually planning to also keep the Func like this.So is there anything could be done with this $Failed and $Passed as per your UDF and it could be added in the below function.Or if a new GUI could be created which will only get active when the MsgBox is called after the steps performed.I know I am asking more time from you and would appreciate your help. $Failed = 'Failed' $Passed = 'Passed' Func Final() Select Case Not ProcessExists("ProcessName") $Value1 = "Value 1: " & $Failed Case Else $Value1 = "Value 1: " & $Passed EndSelect Select Case Not FileExists("Program Name") $Value2 = "Value 2: " & $Failed Case Else $Value2 = "Value 2: " & $Passed EndSelect EndFunc ;==>Final
GordonFreeman Posted May 2, 2015 Posted May 2, 2015 (edited) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 438, 192, 124) GUICtrlCreateLabel("Step 1:",10,10,400,25) GUICtrlSetFont(-1,16,600,"","Comic Sans MS") $LBL_Value1 = GUICtrlCreateLabel("",110,10,300,25) GUICtrlSetFont(-1,16,600,"","Comic Sans MS") $BTN_Start = GUICtrlCreateButton("Start",300,300,300,100) GUICtrlSetFont(-1,16,600,"","Comic Sans MS") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $BTN_Start If Random(0,1,1) = 1 Then GUICtrlSetData($LBL_Value1,"Congratulations! You are the 1000th visitor! You won!") GUICtrlSetColor($LBL_Value1,0x00FF00) Else GUICtrlSetData($LBL_Value1,"FAIL") GUICtrlSetColor($LBL_Value1,0xFF0000) EndIf EndSwitch WEnd Then you will need to create your own dialog and use separate labels - is it really worth the extra effort? Edited May 2, 2015 by GordonFreeman Frabjous Installation
DigDeep Posted May 2, 2015 Author Posted May 2, 2015 This is not working out... I know it might be frustrating you too. Thank you everyone who gave time for me. Really appreciate.I will have to keep searching how to get this done though.
DigDeep Posted May 2, 2015 Author Posted May 2, 2015 Why color single words? That's eye candy. Wouldn't MsgBox do the same? Set the flags and you will get error, information or abort icons. @water The reason I do not want to use the msgbox Flag for abort or retry because teh code I have written does lots of tasks. At the end it will re-check all the work performed and then will throw the msgbox with the results which of then got Passed and which programs got failed. Now we needed the Passed and Failed words to be shown with colors so as to better identify them.
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