Crossbow Posted February 29, 2008 Share Posted February 29, 2008 (edited) Hello all, I'm new to this au3 thingy I been doing some stuff to practice I have a problem with this code, I need it to write to an .ini file but first it has to do a multiplication as you can see but it doesnt .... help! #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Opt("GUICloseOnESC", 1) GUICreate("test", 300, 300) $iniread = IniRead("myini.ini", "section", "key", "") $input = GUICtrlCreateInput($iniread, 30, 30, 50, 20) $readgui = GUICtrlRead($input) $num = 1000 $mult = $num * $readgui $bot = GUICtrlCreateButton("save", 10, 80, 110, 30) GUICtrlSetOnEvent($bot, "bot") $bot2 = GUICtrlCreateButton("result", 120, 80, 110, 30) GUICtrlSetOnEvent($bot2, "bot2") GuiSetState( ) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseProgram") While 1 WEnd Func CloseProgram( ) Exit EndFunc Func bot() IniWrite("myini.ini", "section", "key", $mult) EndFunc Func bot2() MsgBox(0, "result", $mult) EndFunc Edited February 29, 2008 by Crossbow Link to comment Share on other sites More sharing options...
martin Posted February 29, 2008 Share Posted February 29, 2008 (edited) Hello all, I'm new to this au3 thingy I been doing some stuff to practice I have a problem with this code, I need it to write to an .ini file but first it has to do a multiplication as you can see but it doesnt .... help! #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Opt("GUICloseOnESC", 1) GUICreate("test", 300, 300) $iniread = IniRead("myini.ini", "section", "key", "") $input = GUICtrlCreateInput($iniread, 30, 30, 50, 20) $readgui = GUICtrlRead($input) $num = 1000 $mult = $num * $readgui $bot = GUICtrlCreateButton("save", 10, 80, 110, 30) GUICtrlSetOnEvent($bot, "bot") $bot2 = GUICtrlCreateButton("result", 120, 80, 110, 30) GUICtrlSetOnEvent($bot2, "bot2") GuiSetState( ) GUISetOnEvent($GUI_EVENT_CLOSE, "CloseProgram") While 1 WEnd Func CloseProgram( ) Exit EndFunc Func bot() IniWrite("myini.ini", "section", "key", $mult) EndFunc Func bot2() MsgBox(0, "result", $mult) EndFunc You need to read the input before you show the multiplication result. Here's one way to do it. expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Opt("GUICloseOnESC", 1) GUICreate("test", 300, 300) $iniread = IniRead("myini.ini", "section", "key", "") $input = GUICtrlCreateInput($iniread, 30, 30, 50, 20) $mult = 0 $lastReadGui = 0 $num = 1000 $bot = GUICtrlCreateButton("save", 10, 80, 110, 30) GUICtrlSetOnEvent($bot, "bot") $bot2 = GUICtrlCreateButton("result", 120, 80, 110, 30) GUICtrlSetOnEvent($bot2, "bot2") GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "CloseProgram") While 1 $readgui = Number(GUICtrlRead($input)) If $readgui <> $lastReadGui Then $lastReadGui = $readgui $mult = $num * $readgui EndIf Sleep(50) WEnd Func CloseProgram() Exit EndFunc ;==>CloseProgram Func bot() IniWrite("myini.ini", "section", "key", $mult) EndFunc ;==>bot Func bot2() MsgBox(0, "result", $mult) EndFunc ;==>bot2 Welcome to AUtoIt forums Edited February 29, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Crossbow Posted February 29, 2008 Author Share Posted February 29, 2008 yay it works! thx alot Link to comment Share on other sites More sharing options...
Crossbow Posted February 29, 2008 Author Share Posted February 29, 2008 does anyone know where can I learn how to write code correctly, put stuff where it goes lol I dunno how to say it I'm new to all this Link to comment Share on other sites More sharing options...
Oldschool Posted February 29, 2008 Share Posted February 29, 2008 does anyone know where can I learn how to write code correctly, put stuff where it goes lol I dunno how to say itI'm new to all thishttp://www.autoitscript.com/autoit3/docs/functions.htmOne of my favorites... Link to comment Share on other sites More sharing options...
martin Posted February 29, 2008 Share Posted February 29, 2008 (edited) does anyone know where can I learn how to write code correctly, put stuff where it goes lol I dunno how to say it I'm new to all this As well as the link Oldschool gave, this one is useful. I think you are already going about it the right way though. Read the help, try to do something, struggle, then if stuck search and that doesn't work ask for help, then try to understand why, try something else. While $Scripting ReadHelp() if $confused then $Result = Experiment() if $Result = $AllGoneWrong then if searchFor examples() = 0 then AskForHelp() endif WriteSomeCode() Wend Edited February 29, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
rasim Posted February 29, 2008 Share Posted February 29, 2008 (edited) CrossbowHi and wellcome! When i begin to learn AutoIt, i was don`t know english and nothing about AutoIt, but due to this forum and nice members i was learn very many.1. Help file - knowledgebase.2. This wonderful forum.3. More practice.Good luck! Edit:@Martin nice code Edited February 29, 2008 by rasim 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