Velnes 0 Posted March 3, 2011 hi again im here with a different topic umm i cant figure out how to do this : this is example dont mind all code $gui = guicreate("") $button = guictrlcreatebutton("", xx,xx,xx,xx) while 1 switch guigetmsg() case $button #include <my other file.au3> endswitch wend so when pressing button... the #include file would create an input box or something in this current $gui not in the other file... i dont know how else to explain ... i tryed this #include thing few ways but everytime i just get error at that line Share this post Link to post Share on other sites
willichan 220 Posted March 3, 2011 (edited) case $button #include <my other file.au3> endswitch I made this same mistake before. You can't put an #include statement within a block statment (case, func, if-then, etc...), and there is no way to do a conditional #include. All #include statements will be replaced by the contents of the include file BEFORE any code is executed. Edited March 3, 2011 by willichan Join me in supporting Pediatric Therapy Network through Amazon Smile. My UDFs: Barcode Libraries, Automate creation of any type of project folder, File Locking with Cooperative Semaphores, Inline binary files, Continue script after reboot, WinWaitMulti, Name Aggregator Share this post Link to post Share on other sites
GEOSoft 67 Posted March 3, 2011 (edited) You put the code that creates the inputbox (or Whatever) in a function in the include file. The include file should have the line #Include-Once at the top of it. Now you move that #Include line to the top of the script. If it's a local file and not one in your AutoIt\Include\ folder then use the Quote method. #Include "<path>\my other file.au3" Where you now have the #Include<my other file.au3> line, replace it with a function call to bring up the inputbox. EDIT: I should have mentioned that #Include is a pre-processor directive so you can't call it in a loop like you did. Edited March 3, 2011 by GEOSoft GeorgeQuestion about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else."Old age and treachery will always overcome youth and skill!" Share this post Link to post Share on other sites
water 2,387 Posted March 3, 2011 Move the #include line to the top of the script. When the script is started the file is included. AutoIt does not support conditional includes.In your case statement you have to call a function thas is included with <my other file.au3> My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
Velnes 0 Posted March 3, 2011 ok thank you all i got it now thnx very much Share this post Link to post Share on other sites
Velnes 0 Posted March 3, 2011 hmm i tryed with calling func and put in func the #include but not working at all maybe i understood u wrong but isnt there anyway to do sumtin like that? coz i want like when u press button then add into the $gui an edit box or inputbox or anything Share this post Link to post Share on other sites
GEOSoft 67 Posted March 3, 2011 (edited) You DO NOT put the #Include in the Include file You DO NOT use #Include in a loop. #Include is a pre-processor directive and the file must only be #Included once, preferably at the top of the script. Your include file can be as simple as this. #Include-Once Func _Run_InputBox() Local $sStr = InputBox("My Input Box", "Enter whatever you want") Return ($sStr) EndFunc Then Call the FUNCTION in the loop, NOT the file. #Include "C:\Some\Folder\my other file.au3" $gui = guicreate("") $button = guictrlcreatebutton("", xx,xx,xx,xx) While 1 Switch guigetmsg() Case $button $s_Rtn = _Run_InputBox() MsgBox(4096, "Result", $s_Rtn) EndSwitch WEnd All clear now? Edited March 3, 2011 by GEOSoft GeorgeQuestion about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else."Old age and treachery will always overcome youth and skill!" Share this post Link to post Share on other sites