kcvinu Posted February 24, 2015 Posted February 24, 2015 (edited) Hi all,I have made a simple script to use instead of MsgBox function. This function takes only one parameter as message text. It will display your script name as message title. Here is the code. You can include this in your script.#cs Function name = Alert($msg) Creater = kcvinu Example = Alert("Hello World!") This function is an alternative for MsgBox. It only takes one parameter as message text And it will display the script name as title #ce Func Alert($msg) Local $title = StringSplit(@ScriptName,".") ; Splitting the script name into two piece. MsgBox(0,$title[1],$msg) ; Using the first piece as title. 2nd piece is the extension. EndFuncHere is the fileAlert.au3 Edited September 6, 2015 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
kjsisco Posted February 24, 2015 Posted February 24, 2015 Interesting function. Did you actually want it to replace the msg box? If so, you still needed to use it. Maybe I misunderstood the point?
JohnOne Posted February 24, 2015 Posted February 24, 2015 MsgBox(0, StringSplit(@ScriptName,".")[1], "Hello") kcvinu 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
water Posted February 24, 2015 Posted February 24, 2015 What is the advantage compared to MsgBox? kcvinu 1 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
wakillon Posted February 24, 2015 Posted February 24, 2015 What's happen if there is several points in the script name ? kcvinu 1 AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
kcvinu Posted February 24, 2015 Author Posted February 24, 2015 Hi water, Sometimes we need to use the MsgBox function rapidly. I mean for test purposes. Mostly, when we learning something. Then we don't need to type the flag and title. Just use this function with your msg. @ wakillon, Commonly people don't uses dots in filenames. Most programmers uses underscore in filenames. If you want to use two or more dots in your filename, then i need to use another function to strip the extension. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
kcvinu Posted February 24, 2015 Author Posted February 24, 2015 If so, you still needed to use it. @ kjsisco, This function is for instant use. And what do you mean by this comment. @ JohnOne, Thank you for that code Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
iamtheky Posted February 24, 2015 Posted February 24, 2015 @scriptlinenumber or a timerdiff or just about anything else would be more useful than the script name as the hard coded title, imho. and i believe he means that you can't call it a "msgbox alternative", because it uses msgbox. It is more a thread discussing your "msgbox presets". kcvinu 1 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
Valuater Posted February 24, 2015 Posted February 24, 2015 All Functions should have a "Return" Return MsgBox(0, StringSplit(@ScriptName,".")[1], $msg) kcvinu and saeid 2
kcvinu Posted February 24, 2015 Author Posted February 24, 2015 @ boththose OK. got it. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
Gianni Posted February 24, 2015 Posted February 24, 2015 ... Sometimes we need to use the MsgBox function rapidly .... I would add a default parameter so you can call the function even more quickly (that is even without parameters at all....) Func Alert($msg = "Pause") Local $title = StringSplit(@ScriptName,".") ; Splitting the script name into two piece. MsgBox(0,$title[1],$msg) ; Using the first piece as title. 2nd piece is the extension. EndFunc Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
kcvinu Posted February 24, 2015 Author Posted February 24, 2015 @ Valuater, This is my fist step in the UDF world. I know, i need to learn more. Thanks for the suggestion. @ gil900, Actually, This is the first time i met _WinAPI_ShowMsg. I don't know anything about it. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
wakillon Posted February 24, 2015 Posted February 24, 2015 (edited) i need to use another function to strip the extension. This is what I wanted hear you say. Take a look to the _PathSplit function. Edited February 24, 2015 by wakillon AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
JohnOne Posted February 24, 2015 Posted February 24, 2015 If you are going to use something like this you should make the other parameters optional. _MsgBox("Hello") _MsgBox("Hello", "Title") _MsgBox("Hello", "Title", 4096) Func _MsgBox($msg, $title = StringSplit(@ScriptName,".")[1], $flag = 0) Return MsgBox($flag, $title, $msg) EndFunc kcvinu 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
kcvinu Posted February 24, 2015 Author Posted February 24, 2015 @ wakillon, Here is the code. #cs Function name = Alert($msg) Creater = kcvinu Example = Alert("Hello World!") This function is an alternative for MsgBox. It only takes one parameter as message text And it will display the script name as title #ce Func Alert($msg) Local $Length = StringLen(@ScriptName) Local $title = StringMid(@ScriptName,1,$Length-4) ; Stripping the script name without extension. MsgBox(0,$title,$msg) EndFunc Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
Gianni Posted February 24, 2015 Posted February 24, 2015 @ wakillon, Here is the code. #cs Function name = Alert($msg) Creater = kcvinu Example = Alert("Hello World!") This function is an alternative for MsgBox. It only takes one parameter as message text And it will display the script name as title #ce Func Alert($msg) Local $Length = StringLen(@ScriptName) Local $title = StringMid(@ScriptName,1,$Length-4) ; Stripping the script name without extension. MsgBox(0,$title,$msg) EndFunc what happens if your script name has no extension..... Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
kcvinu Posted February 24, 2015 Author Posted February 24, 2015 what happens if your script name has no extension..... You can't run a script without save it in SciTe. If you save your script, then your script name must have an extension. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
Gianni Posted February 24, 2015 Posted February 24, 2015 You can't run a script without save it in SciTe. If you save your script, then your script name must have an extension. yes, but you can compile it, remove the .exe extension and run it from another script by the run() function.... kcvinu 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
kcvinu Posted February 24, 2015 Author Posted February 24, 2015 (edited) yes, but you can compile it, remove the .exe extension and run it from another script by the run() function.... If so, i need to include an if statement to check if the script name has an extension. Edited February 24, 2015 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
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