Jump to content

Recommended Posts

Posted (edited)

Not sure if this is what you wanted but this is my version..

#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 by Jayson
  • Replies 55
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Moderators
Posted

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. :unsure:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • Moderators
Posted

Ritzky,

Do you ever look at the Help file or do you just expect us to provide all the code for you? :unsure:

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

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!"

Posted (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 by Ritzky
  • Moderators
Posted

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. :unsure:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • Moderators
Posted

Ritzky,

So reassign the variable! :unsure:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

How? Even if I rename times.ini to times2.ini, it will still save as times2.ini :unsure:

$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 Gude
How 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
Posted

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? :unsure:

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 one

If 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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

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
Posted

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. :unsure:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (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 by Jayson
Posted

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.

Posted (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 by monoscout999
Posted

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!

Posted (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 programmers

So 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 by Jayson
Posted (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 by monoscout999
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...