1. GUI (using HTA).
2. INI writing (from GUI) and utilising it in script.
3. Including another file in script (without FileInstall) and generating it during output.
This script does not need any outside file. It also shows a way that I've discovered, to include and generate a file from a script without using FileAppend for 'every' line (its used just once!). This method of including file will only work with uncompiled scripts... for compiled ones, use fileinstall.
SetWinDelay, 0 SetBatchlines, 10ms ; a file has been attached at the end of the script ; more files can be attached by changing 'a' to b, c .... sec = a Loop, Read, %a_scriptfullpath%, GUI.hta { IfInString, A_LoopReadLine, %sec%*/, setenv, log, no IfEqual, log, yes, FileAppend, %A_LoopReadLine%`n IfInString, A_LoopReadLine, /*%sec%, setenv, log, yes ;*/ this line is just to correct syntax highlighting } ;now run the generated hta file run, GUI.hta WinWait, GUI Window WinMove, GUI Window, ,,, 300, 300 WinWaitClose, GUI Window ;read output IniRead, ainput, options.ini, Section, ainput IniRead, Selection, options.ini, Section, selection IniRead, check1, options.ini, Section, check1 IniRead, check2, options.ini, Section, check2 IniRead, check3, options.ini, Section, check3 ;show output msgbox,0, GUI output, Input = %ainput%`nSelection = %selection%`nCheckBox1 = %check1%`nCheckBox2 = %check2%`nCheckBox3 = %check3% ;cleanup FileDelete, GUI.hta FileDelete, Options.ini ;File sections below ;more files can be attached by changing 'a' to b, c .... /*a <HTML> <HEAD> <TITLE>GUI Window</TITLE> <HTA:APPLICATION BORDER = "thin" CAPTION = "yes" ICON = "app.ico" SHOWINTASKBAR = "yes" SINGLEINSTANCE = "yes" SYSMENU = "yes" WINDOWSTATE = "normal" SCROLL = "no" SCROLLFLAT = "yes" INNERBORDER = "yes" SELECTION = "no" MAXIMIZEBUTTON = "yes" MINIMIZEBUTTON = "yes" NAVIGABLE = "no" CONTEXTMENU = "yes" BORDERSTYLE = "normal" > <STYLE> BODY { background:buttonface; border:0px } </STYLE> </HEAD> <script> fso = new ActiveXObject("Scripting.FileSystemObject"); function ini(source){ frm=document.main; Selection=frm.Selection[frm.Selection.selectedIndex].value if(frm.Ainput.value==""){ alert("Please input something"); }else if(Selection==""){ alert("Please select something"); }else{ //The next line deletes original Options.ini, and creates a new one file=fso.CreateTextFile("Options.ini",1); file.WriteLine("[Section]"); file.WriteLine("Ainput="+frm.Ainput.value); file.WriteLine("Selection="+Selection); file.WriteLine("Check1="+(frm.Check1.checked?frm.Check1.value:"")); file.WriteLine("Check2="+(frm.Check2.checked?frm.Check2.value:"")); file.WriteLine("Check3="+(frm.Check3.checked?frm.Check3.value:"")); file.close(); window.close(); } } </SCRIPT> <BODY> <FORM ONSUBMIT="return false" NAME="main"> <p align="center"><font size="5" face="Tahoma">GUI in HTA</font></p> <p align="center"><font face="Tahoma">Input <INPUT TYPE="text" NAME="Ainput" SIZE="10"> <SELECT NAME="Selection"> <OPTION VALUE="">Please select <OPTION VALUE="1">Option1 <OPTION VALUE="2">Option2 <OPTION VALUE="3">Option3 </SELECT> CheckBox1 <INPUT TYPE="checkbox" VALUE="yes" NAME="Check1" UNCHECKED> CheckBox2 <INPUT TYPE="checkbox" VALUE="yes" NAME="Check2" UNCHECKED> CheckBox3 <INPUT TYPE="checkbox" VALUE="yes" NAME="Check3" UNCHECKED> <INPUT TYPE="button" VALUE="Submit" ONCLICK="ini()"> </font></p> </FORM> </BODY> </HTML> a*/