Myfault Posted February 25, 2009 Share Posted February 25, 2009 Hi all, i'm doing some scripts in Autoit and it is fun ...It's a real powerfull tool..and i want to thak you all for the infos in this forum. I searched in forum but i didn't find nothing about this... My problem is: 1) i have a script (main.au3) that do something in steps way IE(no real code): Main() Func Main($state) switch case = 1 do something case = 2 do else Endfunc Func 1 .. $state=1 Return $state Endfunc Func 2 ... $state=2 Return $state Endfunc 2) I wish to create a au3 (log.au3) with gui creation that write into an edit control and write into a txt file messages sended by every func in main.au3 i tried onevent but with no luck. Thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 25, 2009 Moderators Share Posted February 25, 2009 (edited) Myfault,First, welcome to the AutoIt forums.Reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously.You should also look at the excellent tutorials that you will find here and here. That will help you with writing proper AutoIt code based on what you have posted.For your second question, look in the Help file at GUICtrlSetData for getting the messages into an Edit control and _FileWriteLog for the text file.Come back and ask again when you run into problems. When you post the code you have produced, please put CODE tags around it to help others see it more clearly. Just place [code ] before and [/code ] afterwards (leave out the spaces at the end of the tags - they are only there so the tags show in this post!).M23 Edited February 25, 2009 by Melba23 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...
Myfault Posted February 25, 2009 Author Share Posted February 25, 2009 (edited) hi, thanks Melba23. I try to explain better my problem. My main.au3 work well and do all i want (400 lines of code), now i need to log single operations from main.au3 to a log window and a txt file. example: main.au3 #include "log.au3" function1() Func function1() ;do something $variable = 5 ;send to log this variable ;here is the part i don't know _GUICtrlEdit_AppendText($editctrl,$variable) EndFunc log.au3 #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 633, 454, 193, 115) $editctrl = GUICtrlCreateEdit("", 0, 0, 185, 89) GUICtrlSetData(-1, "editctrl") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd what's wrong with this? thanks Edited February 25, 2009 by Myfault Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 25, 2009 Moderators Share Posted February 25, 2009 Myfault,Apologies if I took you for a complete beginner. :-)If you want to use _GUICtrlEdit_AppendText you need to include GuiEdit.au3. This code works fine - just press the button to run the function:#include <GUIConstantsEx.au3> #Include <GuiEdit.au3> $Form1 = GUICreate("Form1", 600, 400, 200, 150) Global $editctrl = GUICtrlCreateEdit("", 10, 10, 200, 330) Global $button = GUICtrlCreateButton("Log", 10, 350, 80, 30) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button function1() EndSwitch WEnd Func function1() ;do something $variable = "Add this to the editcontrol" & @CRLF ;send to log this variable _GUICtrlEdit_AppendText($editctrl,$variable) EndFuncHope this helps. Ask if there is anything else.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...
Myfault Posted February 25, 2009 Author Share Posted February 25, 2009 Thanks Melba... i'm not a total beginner but need to learn a lot now my script log what i want but only on button click....there's a way to log without click on button and do log event inside function1 ? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 25, 2009 Moderators Share Posted February 25, 2009 Myfault,The _GUICtrlEdit_AppendText is inside the function, so just call the function from within your script and _GUICtrlEdit_AppendText will write to the edit control. I only added the button so that the function could be called when wanted - it serves no purpose other than that.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...
Myfault Posted February 26, 2009 Author Share Posted February 26, 2009 thanks... i know where i was wrong. i was calling the function from another au3 file. my project have this files: main.au3 (all the logic) var.au3 (variables) gui.au3 (the gui) log.au3 (the log) i was calling log function, that was in log.au3, from inside main.au3. Now i must only copy all log.au3 code inside main.au3. thanks again 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