Jump to content

Adding Code To Button


Recommended Posts

That's not even the same code you posted above. You don't have any way for your code to change the name of the ini file it saves to. Either you're being deliberately stupid or you're a complete idiot, either way, you're pretty much on your own here as you refuse to post your REAL code. I'm starting to suspect you're trolling to see how long this farce is going to last before you disappear from the boards. Good luck with your game, I'm out.

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

Link to post
Share on other sites
  • Replies 55
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

That's not even the same code you posted above. You don't have any way for your code to change the name of the ini file it saves to. Either you're being deliberately stupid or you're a complete idiot, either way, you're pretty much on your own here as you refuse to post your REAL code. I'm starting to suspect you're trolling to see how long this farce is going to last before you disappear from the boards. Good luck with your game, I'm out.

It is same code, i just remove the functions. And i change the box names.

Link to post
Share on other sites

Whenver i press the save button, i name it " test.ini" but it saves as "times.ini" i know its because i have the default $data to automatically save as times.ini but how do i change it while still making my code work.

if i change the $data value, it messes up the whole code, and I don't know how to fix it.

omg after i get this done, i won't need no more help, ill just use this code as reference to my new programs.

Link to post
Share on other sites

It is same code, i just remove the functions. And i change the box names.

That's bull, here's the code you posted before. It's totally different to what you just posted. Not just function names changed/removed, totally different. You even changed the code in regards to how you're saving the ini files. Like I said, you're on your own from here as far as I'm concerned.

#include <ButtonConstants.au3>
 #include <GUIConstantsEx.au3>
 #include <StaticConstants.au3>
 #include <WindowsConstants.au3>
 #include <array.au3>
 $Form1 =
GUISetIcon
 $Label1 =
 $Label2 =
 $Label3 =
$Label4 =
$Label5 =
$Save =
$Load =
 $input1 =
$updown1 =
 $input2 =
$updown2 =
$input3 =
$updown3 =
$input4 =
$updown4 =
$message =

GUISetState()
 #EndRegion ### END Koda GUI section ###

Global $Data = "Times.ini"

While 1

 $nMsg = GUIGetMsg()
 Switch $nMsg
 Case $Save
 FileSaveDialog( "Times", @WorkingDir, "Times (*.ini)")
 If @Error Then
; Do Nothing
 Else
IniWrite ($data, "Times", "0", GUICtrlRead($input1))
 IniWrite ($data, "Delays", "1", GUICtrlRead($input2))
 IniWrite ($data, "Delays", "2", GUICtrlRead($input3))
 IniWrite ($data, "Delays", "3", GUICtrlRead($input4))
 EndIf

 Case $GUI_EVENT_CLOSE
 Exit
 Case $Load

$var = FileOpenDialog($message, @WorkingDir & "\", "Time File (*.ini)", 1 + 2, "", GUICreate(""))

If @error Then
 ; Do Nothing
 Else
 GUICtrlSetData ( $input1, IniRead ($var, "Times", "0", ""))
 GUICtrlSetData ( $input2, IniRead ($var, "Times", "1", ""))
 GUICtrlSetData ( $input3, Iniread ($var, "Times", "2", ""))
 GUICtrlSetData ( $input4, IniRead ($var, "Times", "3", ""))
 EndIf


EndSwitch

WEnd


While 1
 Sleep( 1000 );Idle
 WEnd

Func StartMainScript( )

My Code Goes Here I guess...


WEnd
 EndFunc

Func StopMainScript( )
 While 1
 Sleep( 100000 )
 WEnd
 EndFunc

Func Terminate( )
 Exit
 EndFunc

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

Link to post
Share on other sites

That's bull, here's the code you posted before. It's totally different to what you just posted. Not just function names changed/removed, totally different. You even changed the code in regards to how you're saving the ini files. Like I said, you're on your own from here as far as I'm concerned.

#include <ButtonConstants.au3>
 #include <GUIConstantsEx.au3>
 #include <StaticConstants.au3>
 #include <WindowsConstants.au3>
 #include <array.au3>
 $Form1 =
GUISetIcon
 $Label1 =
 $Label2 =
 $Label3 =
$Label4 =
$Label5 =
$Save =
$Load =
 $input1 =
$updown1 =
 $input2 =
$updown2 =
$input3 =
$updown3 =
$input4 =
$updown4 =
$message =

GUISetState()
 #EndRegion ### END Koda GUI section ###

Global $Data = "Times.ini"

While 1

 $nMsg = GUIGetMsg()
 Switch $nMsg
 Case $Save
 FileSaveDialog( "Times", @WorkingDir, "Times (*.ini)")
 If @Error Then
; Do Nothing
 Else
IniWrite ($data, "Times", "0", GUICtrlRead($input1))
 IniWrite ($data, "Delays", "1", GUICtrlRead($input2))
 IniWrite ($data, "Delays", "2", GUICtrlRead($input3))
 IniWrite ($data, "Delays", "3", GUICtrlRead($input4))
 EndIf

 Case $GUI_EVENT_CLOSE
 Exit
 Case $Load

$var = FileOpenDialog($message, @WorkingDir & "\", "Time File (*.ini)", 1 + 2, "", GUICreate(""))

If @error Then
 ; Do Nothing
 Else
 GUICtrlSetData ( $input1, IniRead ($var, "Times", "0", ""))
 GUICtrlSetData ( $input2, IniRead ($var, "Times", "1", ""))
 GUICtrlSetData ( $input3, Iniread ($var, "Times", "2", ""))
 GUICtrlSetData ( $input4, IniRead ($var, "Times", "3", ""))
 EndIf


EndSwitch

WEnd


While 1
 Sleep( 1000 );Idle
 WEnd

Func StartMainScript( )

My Code Goes Here I guess...


WEnd
 EndFunc

Func StopMainScript( )
 While 1
 Sleep( 100000 )
 WEnd
 EndFunc

Func Terminate( )
 Exit
 EndFunc

There is no GUI in this script, and the Stop/Start/Terminate Mainscript functions are still there.

I don't think you're looking at it right...

Everything else is still the same other than renamed buttons. Have you even launched the new code?

Link to post
Share on other sites

This thread is ridiculous. Have you even read the documentation for FileSaveDialog? You're usage is wrong - YOU ARE NOT SAVING THE FUNCTION RETURN VALUE. You're just writing to the INI path stored in the $data variable, but you are NEVER UPDATING ITS VALUE. Take some time, learn the language, RTFM!!!!!

A mod should lock this thread for a while until the OP takes some time to educate himself.

Link to post
Share on other sites

He's not even able to copy back his function... $IniWrite ("$data.ini", "Times", "EST", GUICtrlRead($input1)) and few lines under it has it right and he wants help.. God ur a tool so i'm done with this crap.

I've reported this thread to be locked as the OP doesn't help itself.

Edited by Jayson
Link to post
Share on other sites

Oh! I understand now! Here is code. Sorry!

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Conversion Calculator", 301, 226, -1, -1)
$Save = GUICtrlCreateButton("Save!", 10, 184, 81, 25)
$Load = GUICtrlCreateButton("Load!", 110, 184, 81, 25)
$Convert = GUICtrlCreateButton("Convert!", 207, 184, 81, 25)
$TimeLabel = GUICtrlCreateLabel("Set your times here!", 104, 8, 105, 17)
$EST = GUICtrlCreateLabel("EST", 36, 36, 19, 17)
$PT = GUICtrlCreateLabel("PT", 36, 71, 18, 17)
$CST = GUICtrlCreateLabel("CST", 36, 106, 22, 17)
$MT = GUICtrlCreateLabel("MT", 36, 141, 27, 17)
$input1 = GUICtrlCreateInput("5:00", 77, 35, 160, 21)
$updown1 = GUICtrlCreateUpdown($input1)
$input2 = GUICtrlCreateInput("6:00", 77, 70, 160, 21)
$updown2 = GUICtrlCreateUpdown($input2)
$input3 = GUICtrlCreateInput("7:00", 77, 105, 160, 21)
$updown3 = GUICtrlCreateUpdown($input3)
$input4 = GUICtrlCreateInput("8:00", 77, 140, 160, 21)
$updown4 = GUICtrlCreateUpdown($input4)
$message = "Conversion Calculator"

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Save
            FileSaveDialog( "Conversion Calculator", @WorkingDir, "Conversion Calculator (*.ini)")
            If @Error Then
                ;Do Nothing
            Else 
            IniWrite ("Times.ini", "Times", "EST", GUICtrlRead($input1))
            IniWrite ("Times.ini", "Times", "CST", GUICtrlRead($input2))
            IniWrite ("Times.ini", "Times", "PT", GUICtrlRead($input3))
            IniWrite ("Times.ini", "Times", "MT", GUICtrlRead($input4))
        EndIf
    Case $Load

$var = FileOpenDialog($message, @WorkingDir & "\", "Conversion Calculator (*.ini)", 1 + 2, "", GUICreate(""))

If @error Then
    ; Do Nothing
Else
    GUICtrlSetData ( $input1, IniRead ($var, "Times", "EST", ""))
    GUICtrlSetData ( $input2, IniRead ($var, "Times", "CST", ""))
    GUICtrlSetData ( $input3, Iniread ($var, "Times", "PT", ""))
    GUICtrlSetData ( $input4, IniRead ($var, "Times", "MT", ""))
EndIf

Case $Convert
    MsgBox(4096, "Not Finished!", "My Script Will Go Here!", 10)
            

    EndSwitch
WEnd

What I want it to do is allow a person to save ini file as whatever name they want.

well this is a lot diferent.... now

if you press F1 key when the cursor is on top of the text function you will see the help of that function... let see what about FileSaveDialog() function says

Valor de Retorno

Con Éxitos Devuelve la ruta completa del archivo escogido. Los resultados para múltiple selección son mostrado como : "Directory|file1|file2|..."

Al Fallar Establece @error a:

@error: 1 - Selección errónea del fichero.

2 - Filtro erróneo.

:S i have the spanish help file XDD well the return value is the route and the filename of the saved file... os if you want to catch that filename you have to save it in a variable.. to do that you just have to put the variable on fron the function call and an = symbol

$filesaved = FileSaveDialog( "Conversion Calculator", @WorkingDir, "Conversion Calculator (*.ini)")

then you don´t use your predeffined name ... you should use the name saved in the variable... so...

$savedfilename = FileSaveDialog("Conversion Calculator", @WorkingDir, "Conversion Calculator (*.ini)")
            If Not @error Then ; Is more easier this way... ;)
                IniWrite($savedfilename, "Times", "EST", GUICtrlRead($input1))
                IniWrite($savedfilename, "Times", "CST", GUICtrlRead($input2))
                IniWrite($savedfilename, "Times", "PT", GUICtrlRead($input3))
                IniWrite($savedfilename, "Times", "MT", GUICtrlRead($input4))
            EndIf

i hope this will help you... in the future use the help and look the return of the function you use... and if you have to use that return in the future save it in a variable in that way $variable = _Myfunction()

Link to post
Share on other sites

You can save variables to an .ini like this

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <array.au3>

Global $Data = "Info.ini"
Global $iniRead = IniRead($Data, "Info", "Times", "7:40") ; this make 7:40 default value in case the key doesn't exists

$GUI = GUICreate("Saving data", 150, 50)
$input = GUICtrlCreateInput($iniread, 5, 5, 50, 20)
$save = GUICtrlCreateButton("Save", 60, 5, 50, 22)
GUISetState()

If GUICtrlRead($input) <> "7:30" Then
    MsgBox(64, "Error !", "Your script won't start with this value !")
Else
    StartMainScript()
EndIf

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $save
            IniWrite ($data, "Info", "Times", GUICtrlRead($input))
    EndSwitch

WEnd

Func StartMainScript()
    ConsoleWrite("Your script is running")
EndFunc

Then you can check if the value the user entenred is right and you can start your script.

And the Info.ini look like this

[Info]
Times=7:40

He's not even able to copy back his function... $IniWrite ("$data.ini", "Times", "EST", GUICtrlRead($input1)) and few lines under it has it right and he wants help.. God ur a tool so i'm done with this crap.

I've reported this thread to be locked as the OP doesn't help itself.

YOU gave me the code!
Link to post
Share on other sites

well this is a lot diferent.... now

if you press F1 key when the cursor is on top of the text function you will see the help of that function... let see what about FileSaveDialog() function says

:S i have the spanish help file XDD well the return value is the route and the filename of the saved file... os if you want to catch that filename you have to save it in a variable.. to do that you just have to put the variable on fron the function call and an = symbol

$filesaved = FileSaveDialog( "Conversion Calculator", @WorkingDir, "Conversion Calculator (*.ini)")

then you don´t use your predeffined name ... you should use the name saved in the variable... so...

$savedfilename = FileSaveDialog("Conversion Calculator", @WorkingDir, "Conversion Calculator (*.ini)")
            If Not @error Then ; Is more easier this way... ;)
                IniWrite($savedfilename, "Times", "EST", GUICtrlRead($input1))
                IniWrite($savedfilename, "Times", "CST", GUICtrlRead($input2))
                IniWrite($savedfilename, "Times", "PT", GUICtrlRead($input3))
                IniWrite($savedfilename, "Times", "MT", GUICtrlRead($input4))
            EndIf

i hope this will help you... in the future use the help and look the return of the function you use... and if you have to use that return in the future save it in a variable in that way $variable = _Myfunction()

thank you thank you !!! it worked! i do not understand english very well, and spanish help good. :unsure: everything works now. :> ok how give u money.

jayson i give u money 2 cuz u helped before

Edited by Ritzky
Link to post
Share on other sites
  • Developers

Are you blind or just fucking stupid ? For this time and all the others one when you ran into a freaking problem POST YOUR CODE.

Not sure what is wrong with you but what about calming down and not hitting the report button for trivial stuff like this especially when only your own emotions are the issue ......OK?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

Not sure what is wrong with you but what about calming down and not hitting the report button for trivial stuff like this especially when only your own emotions are the issue ......OK?

Jos

Read this page and you will understand how that guy is making fun of us by providing false code and putting his error back in it when we actually posted it good.

Btw I'm sorry about how I reacted but hes playing with us.

Edited by Jayson
Link to post
Share on other sites
  • Developers

Read this page and you will understand how that guy is making fun of us by providing false code and putting his error back in it when we actually posted it good.

Btw I'm sorry about how I reacted but hes playing with us.

Let us do our work and simply walk away when you get irritated by these type of questions.

I am generally ignoring these type of threads as they are "begging for code" by members not willing to put in any time for research.

@Ritzky: Hope you get the message now so do not post any thread or post any more without having done some work yourself first.

You clearly pissed of several people and are totally ignoring that fact... I won't when you continue like this.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...