thecakeisalie Posted May 29, 2012 Posted May 29, 2012 (edited) Hello everyone, just had a quick question. I've already searched the help file and forums regarding this question and was not able to find anything. I am sure someone has encountered this before. Perhaps it is the way I have worded it, but I having a bit of a problem. I was wondering if a MsgBox could be declared in a variable for later use? Currently, my script looks like this: $domain = @LogonDomain $add_to_domain= MsgBox(4, "Hey, listen!", "This computer is not in the domain, would you like to add it now?") #cs code #ce If $domain <> "MYDOMAIN" Then If $add_to_domain == 6 Then ;more code Else ;more code EndIf EndIf The problem is, the MsgBox pops up as soon as it is declared. Would I have to create another function in order for this to work? It is more of a preference thing for me if I have to use the same MsgBox more than once. Any help would be much appreciate, thanks for your time. Edited May 29, 2012 by thecakeisalie
water Posted May 29, 2012 Posted May 29, 2012 MsgBox is the name of an AutoIt function. That means it is executed where you place it in your code. What you can "declare in a variable for later use" are the parameters for function MsgBox. Something like:Global $iMB_Flag = 4 Global $sMB_Title = "Hey,listen!" Global $sMB_Text = "This computer is not in the domain, would you like to add it now?" ;more code MsgBox($iMB_Flag, $sMB_Title, $sMB_Text) 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
thecakeisalie Posted May 29, 2012 Author Posted May 29, 2012 MsgBox is the name of an AutoIt function. That means it is executed where you place it in your code. What you can "declare in a variable for later use" are the parameters for function MsgBox. Something like:Global $iMB_Flag = 4 Global $sMB_Title = "Hey,listen!" Global $sMB_Text = "This computer is not in the domain, would you like to add it now?" ;more code MsgBox($iMB_Flag, $sMB_Title, $sMB_Text) Thanks for the reply That makes way more sense to do it that way.
water Posted May 29, 2012 Posted May 29, 2012 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
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