Paulie Posted July 12, 2006 Posted July 12, 2006 I am writing a script to become a screen saver, but i want it to be configurable when not actually used as a screen saver here it the INI part of my code,for some reason, it never writes ini values in a way other than numbers expandcollapse popup#Include <GuiConstants.au3> opt('WinTitleMatchMode', 4) Global $window_[2000], $x, $y, $int, $label_[2000],$text, $Speed, $speed If StringInStr($CmdLineRaw, "/S") Then SaverWindow() ElseIf StringInStr($CmdLineRaw, "/P") Then Exit Else ConfigWindow() Endif Func ConfigWindow() $config = GUICreate("Screen Saver Configurations", 200, 150, -1, -1) GUICtrlCreateLabel("Text: ", 10, 10) $text = GUICtrlCreateInput("", 10, 30) GUICtrlCreateLabel("Speed: ", 10, 60) $speed= GUICtrlCreateInput("", 10, 90) $go = GUICtrlCreateButton("Apply", 10, 120) GuiSetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $go then FileMake() Wend EndFunc Func FileMake() If not FileExists(@ScriptDir&"\SaverConfig.ini") Then FileOpen(@ScriptDir&"\SaverConfig.ini", 2) IniWrite("SaverConfig.ini", "Configs", "1", $text) IniWrite("SaverConfig.ini", "Configs", "2", $speed) Else IniWrite("SaverConfig.ini", "Configs", "1", $text) IniWrite("SaverConfig.ini", "Configs", "2", $speed) EndIf EndFunc Any clue why? TY
MHz Posted July 12, 2006 Posted July 12, 2006 (edited) FileOpen for IniWrite? Remove that line as you are opening a handle which could prevent the IniWrite. IniWrite does not use handles. IniWrite will create the file if it does not exist. And besides, you never actually use the handle as a variable in your code to close the handle. Edited July 12, 2006 by MHz
HardCopy Posted July 12, 2006 Posted July 12, 2006 Just a hunch But do you need the FileOpen for OverWrite??? HardCopy Func FileMake() If not FileExists(@ScriptDir&"\SaverConfig.ini") Then ;;;; FileOpen(@ScriptDir&"\SaverConfig.ini", 2) IniWrite("SaverConfig.ini", "Configs", "1", $text) IniWrite("SaverConfig.ini", "Configs", "2", $speed) Else IniWrite("SaverConfig.ini", "Configs", "1", $text) IniWrite("SaverConfig.ini", "Configs", "2", $speed) EndIf EndFunc Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad
Paulie Posted July 12, 2006 Author Posted July 12, 2006 (edited) Just a hunch But do you need the FileOpen for OverWrite??? HardCopy Func FileMake() If not FileExists(@ScriptDir&"\SaverConfig.ini") Then ;;;; FileOpen(@ScriptDir&"\SaverConfig.ini", 2) IniWrite("SaverConfig.ini", "Configs", "1", $text) IniWrite("SaverConfig.ini", "Configs", "2", $speed) Else IniWrite("SaverConfig.ini", "Configs", "1", $text) IniWrite("SaverConfig.ini", "Configs", "2", $speed) EndIf EndFunc Yeah that was why i put the fileopen in there, so it would overwrite the thing and create it but when i got rid of it, it still just wrote both key values to 4 and 6 i don't know why Edited July 12, 2006 by Paulie
HardCopy Posted July 12, 2006 Posted July 12, 2006 Yeah that was why i put the fileopen in there, so it would overwrite the thing and create itbut when i got rid of it, it still just wrote both key values to 4 and 6i don't know whyOk, now if you actually GuiCtrlRead the controls $text and $speedand save the contents u may get what you need..currrently it is just saving your ControlIDs 6 + 4 respectivelyHardCopy Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad
Paulie Posted July 12, 2006 Author Posted July 12, 2006 Ok, now if you actually GuiCtrlRead the controls $text and $speedand save the contents u may get what you need..currrently it is just saving your ControlIDs 6 + 4 respectivelyHardCopyLOL missed that, whoops, thanks thats what i needed
HardCopy Posted July 12, 2006 Posted July 12, 2006 LOL missed that, whoops, thanks thats what i needed You're WelcomeBeen there , done that! Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad
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