GodForsakenSoul Posted December 17, 2009 Share Posted December 17, 2009 (edited) i would like to work with more then one file.#include "GuiInclude\GUIConstants.au3" #include "GuiInclude\GUIPracticeConjucagtion.au3" #include "GuiInclude\GUIPracticeKana.au3" #include "GuiInclude\GUIOptions.au3" GUICreate("Basic Japanese Training", 550,200) ;Master gui control Opt("GuiCoordMode", 0) ;right left corner + relative to last controll created $button1=GUICtrlCreateButton("Practice Conjugation",20,30,250,20) $button2=GUICtrlCreateButton("Practice Kana", 0,30,250,20) $button3=GUICtrlCreateButton("Options", 0,30, 250,20) $button4=GUICtrlCreateButton("Exit", 0,70,250,20) $logo=GUICtrlCreatePic("GuiInclude\Graphic\LOGO.BMP", 300, -150, 200, 150) GUISetState() ;Actually shows the GUI while 1=1 $msg = GUIGetMsg() Select Case $msg=$GUI_EVENT_CLOSE ExitLoop Case $msg=$button1 Call("Practice1") ; Case $msg=$button2 ; Call("P2") ; Case $msg=$button3 ; Call("Options") Case $msg=$button4 ExitLoop EndSelect Wendhowever, this doesn't seem to work. it refuses to accept the call, despite the fact the other file, which is GUIPracticeConjucagtion.au3. IT FRIGGIN EXISTS!i put a Func and everything.now here's another nifty thing i'm trying to pull off here.$RFileName=Random(1,2,1) $RFileLine=Random(1,2,1) $file=FileOpen("Verbs\"&$RFileName, 4) $line=FileReadLine($file,$RFileLine) MsgBox(1,"",$line)i want it to pick one out of two files and one out of two lines in said file. it shows an empty msgbox instead. help?edit: thanks to m32's genius-ness i figured out i had an extremely retarded problem. The first problem, however, remains....edit2: as soon as i try to put the random file/line reader thing into a function, it refuses to work. what the heck? Edited December 17, 2009 by GodForsakenSoul Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 17, 2009 Moderators Share Posted December 17, 2009 GodForsakenSoul,Q1. Why use Call? If the file is included and Practice1 is a function within it, then a simple function_name command will suffice.Q2. What are the 2 files called (at the moment you are looking for files named 1 and 2, with no extension, in the Verbs folder within @ScriptDir), where are they (in relation to your script), and have you done any errorchecking on the file handle you get back?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...
GodForsakenSoul Posted December 17, 2009 Author Share Posted December 17, 2009 GodForsakenSoul, Q1. Why use Call? If the file is included and Practice1 is a function within it, then a simple function_name command will suffice. Q2. What are the 2 files called (at the moment you are looking for files named 1 and 2, with no extension, in the Verbs folder within @ScriptDir), where are they (in relation to your script), and have you done any errorchecking on the file handle you get back? M23 A1: According to the help file, first you write the function (Func), and afterwards you call it (Call). The problem here is that the main file refuses to accept the fact the function it's looking for is in a different file. I just F5'd both of those files to be sure, and still, despite removing the Call, it still claims that Practice1() is undefined. Practice1 is VERY MUCH DEFINED in a different file, and despite the inconvenience of keeping it in two files, i'd prefer having it that way. this proggy is going to be frigging huge. A2: the two files are 1.txt and 2.txt. a small modification was made to that line, yet still same result. $file=FileOpen("Verbs\"&$RFileName&".txt", 4) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 17, 2009 Moderators Share Posted December 17, 2009 GodForsakenSoul,Q1. There is no need to use Call unless the function name is in a string variable. I have many scripts which call functions in #include files and I have yet to use Call to make it work. Could you please post the file which you are #includeing and which contains the function Practice1 - strip the content if you would prefer not to show it, but please leave the Func and EndFunc lines in!Q2. What about the rest of the info: "where are they (in relation to your script), and have you done any errorchecking on the file handle you get back?".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...
GodForsakenSoul Posted December 17, 2009 Author Share Posted December 17, 2009 here's a more defined version of my problem. i ;'ed all the unused things. expandcollapse popup;Main file #include "GuiInclude\GUIConstants.au3" #include "GuiInclude\GUIPracticeConjucagtion.au3" ;#include "GuiInclude\GUIPracticeKana.au3" ;#include "GuiInclude\GUIOptions.au3" GUICreate("Basic Japanese Training", 550,200) ;Master gui control Opt("GuiCoordMode", 0) ;right left corner + relative to last controll created $button1=GUICtrlCreateButton("Practice Conjugation",20,30,250,20) ;$button2=GUICtrlCreateButton("Practice Kana", 0,30,250,20) ;$button3=GUICtrlCreateButton("Options", 0,30, 250,20) ;$button4=GUICtrlCreateButton("Exit", 0,70,250,20) ;$logo=GUICtrlCreatePic("GuiInclude\Graphic\LOGO.BMP", 300, -150, 200, 150) GUISetState() ;Actually shows the GUI while 1=1 $msg = GUIGetMsg() Select Case $msg=$GUI_EVENT_CLOSE ExitLoop Case $msg=$button1 Practice1() ; Case $msg=$button2 ; Call("P2") ; Case $msg=$button3 ; Call("Options") ; Case $msg=$button4 ExitLoop EndSelect Wend ;======== ;GUIPracticeConjugation ;#include "GuiInclude\GUIVar.au3" Global $RFileName=0 Global $RFileLine=0 Func Practice1 $RFileName=Random(1,2,1) $RFileLine=Random(1,2,1) ; $file=FileOpen("Verbs\1.txt", 4) $line=FileReadLine("Verbs\"&$RFileName&".txt",$RFileLine) MsgBox(1,"",$line) EndFunc IDEALLY i would also use GUIVar.au3 to store all the variables i'll ever use in the proggy. XD Right now i managed to successfully link the two files without autoit yelling SYNTAX ERROR!!!!1 at me. but now i'm back at the problem where i'm getting an empty msgbox when i run the thing. this time, however, s*** gets complicated: when i run it from MainGui, i get an empty msgbox, however, when i run PracticeConjugation BY ITSELF, it works fairly well. i'm out of ideas o.o Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 17, 2009 Moderators Share Posted December 17, 2009 (edited) GodForsakenSoul,Does it work if you add () after the Func Practise1 declaration? It does for me! M23Edit: speeling Edited December 17, 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...
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