sw00n Posted December 2, 2010 Share Posted December 2, 2010 Before i go on to ask this question, yes i am a noob to AutoiT :] I have 2 menus so far... 1 with 3 options the other with 2 options. The First menu has a open, save as, and exit option. I would like the "users", to enter a text then after done be able to save it as either .shader or .txt to a location/directory of their choice, and the open option to open either a .shader or .txt. And last the Exit to exit the program completely. Source i have so far: #Include <GUIConstantsEx.au3> #Include <INet.au3> #Include <GuiButton.au3> #Include <GuiToolBar.au3> #InClude <StaticConstants.au3> GuiCreate("1up Shader Maker.v1",493,210,269,216) $input1 = GuiCtrlCreateInput(" ",7,39,150,20) $label1 = GuiCtrlCreateLabel("Enter Your Texture Path below",6,17,250,15) $menu1 = GUICtrlCreateMenu("File") $open = GUICtrlCreateMenuItem("Open",$menu1) $save = GUICtrlCreateMenuItem("Save As",$menu1) $exit = GUICtrlCreateMenuItem("Exit",$menu1) $help1 = GUICtrlCreateMenu("Help") $help = GUICtrlCreateMenuItem("Help",$help1) GuiSetState() While 1 $msg=GuiGetMsg() If $msg=-3 Then Exit Wend Link to comment Share on other sites More sharing options...
sw00n Posted December 2, 2010 Author Share Posted December 2, 2010 bump tried this but still cant get it to work...expandcollapse popup#Include <GUIConstantsEx.au3> #Include <INet.au3> #Include <GuiButton.au3> #Include <GuiToolBar.au3> #InClude <StaticConstants.au3> GuiCreate("1up Shader Maker.v1",500,210,269,216) $input1 = GuiCtrlCreateInput(" ",7,39,150,20) $label1 = GuiCtrlCreateLabel("Enter Your Texture Path below",6,17,250,15) $menu1 = GUICtrlCreateMenu("File") $open = GUICtrlCreateMenuItem("Open",$menu1) $save = GUICtrlCreateMenuItem("Save As",$menu1) $exit = GUICtrlCreateMenuItem("Exit",$menu1) $help1 = GUICtrlCreateMenu("Help") $help = GUICtrlCreateMenuItem("Help",$help1) $edit = GUICtrlCreateEdit("",200,10,270,150) GuiSetState(@sw_show) While 1 $msg=GuiGetMsg() If $msg=-3 Then Exit if $msg=$exit then exit1() if $msg=$help then help() if $msg=$open then open1() Wend func help() msgbox(0, "", "Enter the path or your texture, default is: textures/name here/name here") EndFunc func exit1() msgbox(0, "Exiting", "Now Exiting...") Exit EndFunc func open1() $message = ("Choose a .shader to open, if needed") $var = FileOpenDialog($message, @DesktopCommonDir & "\","List (*.txt") $file = $fileread($var) if @error Then MsgBox(0, "", "No File(s) were selected") Else Guictrlsetdata($open, $file) Endif EndFunc $Save = FileSaveDialog("Save Active Proxies",@DesktopDir,"Text Files (.shader)|All Files (*.*)",18,"YourSaveListName.shader") $xFile = FileOpen($Save,8+2) FileWrite($xFile,GuiCtrlRead($ Input1)) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 2, 2010 Moderators Share Posted December 2, 2010 sw00n,Please do not bump your posts within 24 hours. Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually. Like this! I have made a few changes to your script. It was working quite well - the biggest problem was that you were reusing the $save variable which gave you problems in your GUIGetMsg loop. You might like to look at the first part of the Variables - using Global, Local and ByRef tutorial in the Wiki to see how you can reuse the same names - although I would only do so for simple temporary variables, not ControlIDs. Here is the amended code:expandcollapse popup#include <GUIConstantsEx.au3> #include <INet.au3> #include <GuiButton.au3> #include <GuiToolBar.au3> #include <StaticConstants.au3> GUICreate("1up Shader Maker.v1", 500, 210, 269, 216) $input1 = GUICtrlCreateInput("", 7, 39, 150, 20) $label1 = GUICtrlCreateLabel("Enter Your Texture Path below", 6, 17, 250, 15) $menu1 = GUICtrlCreateMenu("File") $open = GUICtrlCreateMenuItem("Open", $menu1) $save = GUICtrlCreateMenuItem("Save As", $menu1) $exit = GUICtrlCreateMenuItem("Exit", $menu1) $help1 = GUICtrlCreateMenu("Help") $help = GUICtrlCreateMenuItem("Help", $help1) $edit = GUICtrlCreateEdit("", 200, 10, 270, 150) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $exit exit1() Case $help help() Case $open open1() Case $save save() EndSwitch WEnd Func help() MsgBox(0, "", "Enter the path or your texture, default is: textures/name here/name here") EndFunc ;==>help Func exit1() MsgBox(0, "Exiting", "Now Exiting...") Exit EndFunc ;==>exit1 Func open1() $message = ("Choose a .shader to open, if needed") $var = FileOpenDialog($message, @ScriptDir & "\", "List (*.shader)") $file = FileRead($var) If @error Then MsgBox(0, "", "No File(s) were selected") Else GUICtrlSetData($edit, $file) EndIf EndFunc ;==>open1 Func save() $file = FileSaveDialog("Save Active Proxies", @ScriptDir, "Text Files (.shader)|All Files (*.*)", 18, "YourSaveListName.shader") $xFile = FileOpen($file, 8 + 2) FileWrite($xFile, GUICtrlRead($Input1)) EndFuncPlease ask if you have any questions - but do not expect an answer too quickly! 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...
PsaltyDS Posted December 2, 2010 Share Posted December 2, 2010 (edited) First, organize your script with all the function declarations at the bottom. Then you can see that your FileSaveDialog() and FileWrite() never get executed because the only way out of the GuiGetMsg() loop is to exit the script. Edit: Well, rats. Melba23 beat me to it. Edited December 2, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 2, 2010 Moderators Share Posted December 2, 2010 PsaltyDS, Just do not PM me to complain! 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...
PsaltyDS Posted December 2, 2010 Share Posted December 2, 2010 I'm not brave enough to PM a grouchy old fart like you! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
sw00n Posted December 2, 2010 Author Share Posted December 2, 2010 ah sry mel and thank you for fixing it... 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