Jayson Posted April 27, 2011 Posted April 27, 2011 (edited) Not sure if this is what you wanted but this is my version.. expandcollapse popup#include <GUIConstantsEx.au3> #include <array.au3> HotKeySet( "{F1}", "StartMainScript") HotKeySet( "{F2}", "StopMainScript") HotKeySet( "{F3}", "Terminate") Global $Data = "Info.ini" $GUI = GUICreate("Conversion Calculator", 235, 190) GUICtrlCreateLabel("Set Time", 99, 8, 58, 17) GUICtrlCreateLabel("East Time :", 25, 35, 55, 21) $East = GUICtrlCreateInput("", 95, 32, 105, 21) $Updown = GUICtrlCreateUpdown(-1) GUICtrlCreateLabel("Central Time :", 12, 64, 65, 17) $Central = GUICtrlCreateInput("", 95, 64, 105, 21) $Updown1 = GUICtrlCreateUpdown(-1) $Save = GUICtrlCreateButton("Save", 5, 160, 73, 25) $Help = GUICtrlCreateButton("Help", 81, 160, 73, 25) $Load = GUICtrlCreateButton("Load", 157, 160, 73, 25) $Convert = GUICtrlCreateButton("Convert", 81, 132, 73, 25) GUISetState() While 1 Switch GUIGetMsg() Case $Help ShellExecute("http://www.google.com") Case $GUI_EVENT_CLOSE Exit Case $save IniWrite($Data, "Info", "East Time", GUICtrlRead($East)) IniWrite($Data, "Info", "Central Time", GUICtrlRead($Central)) Case $Load $IniRead = IniReadSection($Data, "Info") If $IniRead <> 1 Then For $i = 1 To $IniRead[0][0] _arraydisplay($iniread) ; you can disable this GUICtrlSetData($East, $IniRead[1][1]) GUICtrlSetData($Central, $IniRead[2][1]) Next EndIf Case $Convert StartMainScript() EndSwitch WEnd Func StartMainScript() ConsoleWrite("Your script is running." & @LF) EndFunc Func StopMainScript() ConsoleWrite("Your script has stopped." & @LF) EndFunc Func Terminate() Exit EndFunc And for the .ini : [Info] East Time=7:50 Central Time=9:25 Edited April 27, 2011 by Jayson
Moderators Melba23 Posted April 27, 2011 Moderators Posted April 27, 2011 Ritzky,Use FileOpenDialog and Windows produces a dialog like that for you! Then you would need to use IniRead on the returned file to get your values and GUICtrlSetData to put them into your inputs.Try it yourself - it is really easy. 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
Moderators Melba23 Posted April 27, 2011 Moderators Posted April 27, 2011 Ritzky,Do you ever look at the Help file or do you just expect us to provide all the code for you? As I posted above:; use IniRead on the returned file to get your values $iValue = IniRead ($var, "Times", "EST", "") ; and GUICtrlSetData to put them into your inputs GUICtrlSetData ( $input1, $iValue)If you wanted a really short line you could do this:GUICtrlSetData ( $input1, IniRead ($var, "Times", "EST", ""))but then you can do no errorchecking.Seriously, 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 - you will find other tutorials in the Wiki (the link is at the top of the page). There are even video tutorials on YouTube if you prefer watching to reading.If you get a better handle on how AutoIt syntax works, you (and we ) will find your coding a much less frustrating experience. 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
GEOSoft Posted April 27, 2011 Posted April 27, 2011 Take a look at GUICtrlRead() in the help file. You have had enough code provided for you and you don't seem willing to help yourself. George Question 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!"
Ritzky Posted April 27, 2011 Author Posted April 27, 2011 (edited) oo nvm thanks i got it working lol. hey how do i add another button ontop of the gui? like there is a X close button and a minimize button, so i wanna add another one o and how to let user change the name of the save file? it always saves as times.ini, but i want ppl to be able to change the save name thanks to everyone! Edited April 27, 2011 by Ritzky
Moderators Melba23 Posted April 27, 2011 Moderators Posted April 27, 2011 Ritzky,This thread explains how to add a button to the title bar of a GUI. Use InputBox to get the user to give you a name for the ini or perhaps FileSaveDialog to let them choose an existing name or enter a new one. 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
Moderators Melba23 Posted April 27, 2011 Moderators Posted April 27, 2011 Ritzky, So reassign the variable! 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
Ritzky Posted April 27, 2011 Author Posted April 27, 2011 How? Even if I rename times.ini to times2.ini, it will still save as times2.ini
BrewManNH Posted April 27, 2011 Posted April 27, 2011 How? Even if I rename times.ini to times2.ini, it will still save as times2.ini $Data = InputBox("title", "prompt") If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
Moderators Melba23 Posted April 27, 2011 Moderators Posted April 27, 2011 Ritzky,Do you actually take the time to read the responses you get and look at the functions they suggest, or do you just wait for code to be written for you? As I posted above:Use InputBox to get the user to give you a name for the ini or perhaps FileSaveDialog to let them choose an existing name or enter a new oneIf you use InputBox you need to reassign the variable in code and then save the file - with FileSaveDialog the user does the work themselves to save the file but you still need to reassign post-save.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
Ritzky Posted April 27, 2011 Author Posted April 27, 2011 also whenver i start the main script, i cant exit the applicatino by pressing the X button. i click the X and it does nothing. but only after i start main script, i even tried stopping main script, but it still doesn't exit. i have to press the ESC button for it to exit, becuz i set the hotkey to terminate when i press ESC. how do i fix this
Moderators Melba23 Posted April 27, 2011 Moderators Posted April 27, 2011 Ritzky,OK, I give in - you have worn me down: ; Initial assignment Global $Data = "times.ini" ; Get new name $sNewName = InputBox("New name", "Choose a new name for the ini file") ; A bit of errorchecking If StringRight($sNewName, 4) = ".ini" Then $Data = @ScriptDir & "\" & $sNewName Else $Data = @ScriptDir & "\" & $sNewName & ".ini" EndIf ; And here is the name MsgBox(0, "Renamed", $Data) ; Another way to do it $sAnotherName = FileSaveDialog("Choose another name", @ScriptDir, "ini files (*.ini)", 2) ; Some errorchecking again If StringRight($sAnotherName, 4) = ".ini" Then $Data = $sAnotherName Else $Data = $sAnotherName & ".ini" EndIf ; And another name MsgBox(0, "Renamed again", $Data)If you want help with the [X] problem, post the code you have written (or had written for you) so far. 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
Jayson Posted April 27, 2011 Posted April 27, 2011 (edited) Seriously.. don't you think posting your full code will be better than replying 50 times ? How we should know where the fucking problem is ? At least show us where u ran into problem with your code..For closing the GUI by X i've already posted the code in the first page and you even said it was working. Read help files sometimes it has great example. Edited April 27, 2011 by Jayson
Ritzky Posted April 27, 2011 Author Posted April 27, 2011 no the x button does work. but only when i haven't yet started the main script. after i start main script, and try to press x button, it doesn't work.
monoscout999 Posted April 27, 2011 Posted April 27, 2011 (edited) also whenver i start the main script, i cant exit the applicatino by pressing the X button. i click the X and it does nothing. but only after i start main script, i even tried stopping main script, but it still doesn't exit. i have to press the ESC button for it to exit, becuz i set the hotkey to terminate when i press ESC. how do i fix this Ritzky.. put your code in a format which we can read easily .. use the forum buttons to do that "[code!]code between[/code!]" without the "!" This is getting disapointing for many of us... if you want help.. first HELP US YOU!! to understand... use the abyable format to read the code well... i ´m not already in mood for this.... you are not helping us to understand. EDIT: Until you don´t help us to understand.. i´m not help you... -.- mayabe someone with better english than me can explaint to you better Edited April 27, 2011 by monoscout999
Ritzky Posted April 27, 2011 Author Posted April 27, 2011 i dont get it. only thing wrong is save button dont work, and thats it. it shouldn't be hard to fix for you programmers i press the save button, then it opens the fileopendialog, then i enter esttimes.ini, but yet it saves as times.ini. i just want it to save as esttimes.ini! i no understand what u ask of me! the rest of code work good!
Jayson Posted April 27, 2011 Posted April 27, 2011 (edited) It will always save as Times.ini because you writed the $Data to use this ini file so use the example that Melba said earlier. As the main part you dont need two While 1 Wend so remove the second one. GUISetIcon ?? The $message in FileOpenDialog is wrong as it clearly stated in the help file Title text of the Dialog GUI so put there your variable used for the GUI creation. Take of the GUICreate("") from the FileOpenDialog also.You have added WEnd for nothing in your StartMainScript() as for StopMainScript() or you just don't have posted your full code like i said ?Where's your GUI info ? Have you ever tried to run your code ?i dont get it. only thing wrong is save button dont work, and thats it. it shouldn't be hard to fix for you programmersSo you saying us to write everything for you ?Sorry but I won't help you anymore since ur not helping urself at all. I've posted many example and you keep adding your errors back in it. Edited April 27, 2011 by Jayson
monoscout999 Posted April 27, 2011 Posted April 27, 2011 (edited) Ritzky what you want to do is soooo easy if you know a little more... but you don´t help us... you don´t put the code in a way to understand it... you want to us to be magican scripters and do a jub totaly blindness and you expect from us to answer you... repeat what you want to do is sooo easuly but i refuse to help a person who doens´t know how to put a code in a forum.. and don´t take the bother to learn.. asn expect magical results from the more experinced programers... i learned autoit in three months and still learning more and more, but my acttitude is the same, respet the other people time.... you don´t Edited April 27, 2011 by monoscout999
Recommended Posts