Valuater Posted March 22, 2010 Posted March 22, 2010 check out "Welcome to Autoit 1-2-3" in my signature below ... there are numerous examples of just what you are looking for 8)
Apixen Posted March 22, 2010 Author Posted March 22, 2010 (edited) 5char Edited November 14, 2013 by Apixen
Penisaurus Posted March 22, 2010 Posted March 22, 2010 #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Close Notepad", 168, 48, 243, 124) $Button1 = GUICtrlCreateButton("Close Notepad", 40, 8, 83, 25, $WS_GROUP) GUICtrlSetOnEvent($Button1, "NotepadClose") GUISetOnEvent($GUI_EVENT_CLOSE, "Close") GUISetState(@SW_SHOW) Func NotepadClose() If ProcessExists("Notepad.exe") Then ProcessClose("Notepad.exe") Else MsgBox(0, "Close Notepad", "Notepad is not open!") ; You can take out MsgBox if undeeded. EndIf EndFunc Func Close() Exit EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEndHope this might help. :)
Valuater Posted March 22, 2010 Posted March 22, 2010 Design is very specific. We are not mind readers. are you using on event mode? are you using a child GUI??... for the button ? or the notepad UI? any code to start from? maybe... http://www.autoitscript.com/forum/index.php?showtopic=111872&view=findpost&p=784283 ? 8)
Valuater Posted March 22, 2010 Posted March 22, 2010 #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Close Notepad", 168, 48, 243, 124) $Button1 = GUICtrlCreateButton("Close Notepad", 40, 8, 83, 25, $WS_GROUP) GUICtrlSetOnEvent($Button1, "NotepadClose") GUISetOnEvent($GUI_EVENT_CLOSE, "Close") GUISetState(@SW_SHOW) Func NotepadClose() If ProcessExists("Notepad.exe") Then ProcessClose("Notepad.exe") Else MsgBox(0, "Close Notepad", "Notepad is not open!") ; You can take out MsgBox if undeeded. EndIf EndFunc Func Close() Exit EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Hope this might help. :) You can not use GUIGetMsg() with On-Event() mode 8)
Penisaurus Posted March 22, 2010 Posted March 22, 2010 (edited) You can not use GUIGetMsg() with On-Event() mode 8) It still does what you'd like it to do, correct? If there's a problem then it can be taken out and replaced with: While 1 Sleep(1000) WEnd So it doesn't close till you want it to. Edited March 22, 2010 by Penisaurus
Apixen Posted March 22, 2010 Author Posted March 22, 2010 (edited) 5char Edited November 14, 2013 by Apixen
Apixen Posted March 26, 2010 Author Posted March 26, 2010 (edited) 5char Edited November 14, 2013 by Apixen
Moderators Melba23 Posted March 26, 2010 Moderators Posted March 26, 2010 Apixen,Did you look at FileOpenDialog in the Help file as Valuater suggested? As stated in the help file it:"Returns the full path of the file(s) chosen"Your question earlier referred to:Client.exeFolder Path:Input hereWith FileOpenDialog you get the folder for free! If you wanted to select a different folder for some reason then FileSelectFolder will allow to do so.Get it?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
Apixen Posted March 26, 2010 Author Posted March 26, 2010 (edited) 5char Edited November 14, 2013 by Apixen
martin Posted March 26, 2010 Posted March 26, 2010 K, How does the "button" React? Example please. (Functions)No, Im not an expert to this stuff, I'm just learning.No, I don't think you are.Do you make your own bed? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Apixen Posted March 26, 2010 Author Posted March 26, 2010 (edited) 5char Edited November 14, 2013 by Apixen
picea892 Posted March 27, 2010 Posted March 27, 2010 Demand it? What position are you in that you can make demands. I am frankly shocked anyone has chosen to help you never mind three MVPs. Ask politely, show some effort and you will not have retorts such as mine and Martin's.
Moderators Melba23 Posted March 27, 2010 Moderators Posted March 27, 2010 Apixen, Answer the problems given, That's the purpose of this topic, and sectionThat is most definitely NOT the way to get help here. Let me explain. This forum is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. We also expect that when you post here you have had a go at solving your problems beforehand. Having some code to work on is a great help - it saves us having to write something from scratch - and no-one here is too keen to help the "code it for me" brigade. So arriving here with a very peremptory manner demanding examples (as you have also done in previous topics) is not going to make you many friends. There is a wonderful Help file crammed full fo examples for you to try. There are excellent tutorials here and here and you will find other tutorials in the Wiki (the link is at the top of the page). There are even video tutorials on YouTube if you prefer watching to reading. Now go and write some code yourself using the command suggestions that you have been given above and see if you can get some way towards doing what you want. You know where we are when you run into difficulties - but I would strongly recommend a more consilatory posting style if you want any real help. 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
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