AdmiralAlkex Posted May 12, 2007 Posted May 12, 2007 This is a copy of a part of my script, i have tried a few ways but i cant get the first one to execute, it is always the second one that is executed...... I cant find any useful info in the help-file..... plz give me some advice ... ElseIf $frga17 = 1 And $frga10= 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 7", "1") IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "0") Exit ElseIf $frga17 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "0") Exit ... .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Paulie Posted May 12, 2007 Posted May 12, 2007 (edited) Perhaps the variable called "$frga10" is not = 1. In reality, there is no way to tell without more of the script. Because this works for me: $frga10=1 $frga17=1 If $frga17 = 1 And $frga10= 1 Then MsgBox(0,"Test", "1st condition.") Exit ElseIf $frga17 = 1 Then MsgBox(0,"Test", "2nd condition.") Exit EndIf(Only the first condition appears) Edited May 12, 2007 by Paulie
Generator Posted May 12, 2007 Posted May 12, 2007 This is a copy of a part of my script, i have tried a few ways but i cant get the first one to execute, it is always the second one that is executed...... I cant find any useful info in the help-file..... plz give me some advice ... ElseIf $frga17 = 1 And $frga10= 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 7", "1") IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "0") Exit ElseIf $frga17 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "0") Exit ... oÝ÷ Ûú®¢×¯+aÆ®¶s`¢ââà¤VÇ6Tbb33c¶g&vrÒæBb33c¶g&vÒFVà æw&FR67&DF"fײgV÷C²b3#²gV÷C²fײgV÷C¶F÷66öÖÖæG6ÖVçW6WGFæw2æægV÷C²ÂgV÷Cµ&Vv7G'6WGFæw2gV÷C²ÂgV÷Cµ6WGFærrgV÷C²ÂgV÷C³gV÷C² æw&FR67&DF"fײgV÷C²b3#²gV÷C²fײgV÷C¶F÷66öÖÖæG6ÖVçW6WGFæw2æægV÷C²ÂgV÷Cµ&Vv7G'6WGFæw2gV÷C²ÂgV÷Cµ6WGFær2gV÷C²ÂgV÷C³gV÷C² W@¤VÇ6Tbb33c¶g&vrÒæBb33c¶g&vfÇC²fwC³FVà æw&FR67&DF"fײgV÷C²b3#²gV÷C²fײgV÷C¶F÷66öÖÖæG6ÖVçW6WGFæw2æægV÷C²ÂgV÷Cµ&Vv7G'6WGFæw2gV÷C²ÂgV÷Cµ6WGFær2gV÷C²ÂgV÷C³gV÷C² W@¢ââà
AdmiralAlkex Posted May 12, 2007 Author Posted May 12, 2007 (edited) EDIT=DONT WORK AT ALL, READ MY NEXT POST!! Edited May 12, 2007 by TzarAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
AdmiralAlkex Posted May 12, 2007 Author Posted May 12, 2007 (edited) Ehhhm ok I am officially stupid....... It actually doesn't work at all so i am posting all my code This app is supposed to read a few lines from an ini-file that another app create and then dependind on if you have the checkbox on or off and which button you press it should write new lines in the same ini-file so the other app can "do its work" expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $frga8 = IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 2", "0") $frga11 = IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 4", "0") $frga12 = IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 5", "0") $frga13 = IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 6", "0") $frga14 = IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 7", "0") $frga15 = IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 8", "0") $frga16 = IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 9", "0") $frga17 = IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 10", "0") If $frga11 = 1 & $frga8 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 1", "1") Exit EndIf If $frga13 = 1 & $frga8 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "1") Exit EndIf If $frga12 = 1 & $frga15 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 1", "0") Exit EndIf If $frga14 = 1 & $frga15 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "0") Exit EndIf $frga1 = GUICreate("Fråga...", 400, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetState() $frga2 = GuiCtrlCreateEdit("Att ändra något här innebär att registret ändras vilket kan vara farligt om något skulle bli fel.", 10, 10, 380, 75, BitOR($ES_MULTILINE, $ES_READONLY), $WS_EX_STATICEDGE) GUICtrlSetFont (-1, 16) $frga3 = GUICtrlCreateLabel("Är du säker på att du vill fortsätta??", 35, 95, 350, 25) GUICtrlSetFont (-1, 16) $frga4 = GUICtrlCreateButton("JA", 15, 130, 140, 60) GUICtrlSetFont (-1, 32) $frga5 = GUICtrlCreateButton("NEJ", 160, 130, 140, 60) GUICtrlSetFont (-1, 32) $frga10 = GUICtrlCreateCheckbox("Fråga inte igen", 305, 150) GUICtrlSetOnEvent($frga4, "frga6") GUICtrlSetOnEvent($frga5, "frga7") While 1 Sleep(1000) WEnd Func frga6() If $frga8 = 1 And $frga10<>1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 4", "1") IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 1", "1") Exit ElseIf $frga8 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 1", "1") Exit ElseIf $frga16 = 1 And $frga10<>1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 6", "1") IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "1") Exit ElseIf $frga16 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "1") Exit EndFunc Func frga7() If $frga15 = 1 And $frga10 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 5", "1") IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 1", "0") Exit ElseIf $frga15 = 1 And $frga10<>1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 1", "0") Exit ElseIf $frga17 = 1 And $frga10 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 7", "1") IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "0") Exit ElseIf $frga17 = 1 And $frga10<>1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "0") Exit EndIf EndFunc Func CLOSEClicked() Exit EndFunc Edited May 12, 2007 by TzarAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Generator Posted May 12, 2007 Posted May 12, 2007 Which part doesn't work? Also use Else at the end if ElseIf statement.
AdmiralAlkex Posted May 12, 2007 Author Posted May 12, 2007 Which part doesn't work?Also use Else at the end if ElseIf statement.It doesn't happen anything when the checkbox is marked!! I have modified to else at the end but there is no difference. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Moderators SmOke_N Posted May 12, 2007 Moderators Posted May 12, 2007 (edited) I hadn't really looked over your code, but in the first example, I'm not sure how you "know" that the second one is the only one firing considering it's exactly the same as the first ElseIf (with the exception that there is another IniWrite() there) (When I say exactly, it's because $frga10 never equals 1). Anyway, understand that IniRead() returns a "string" nothing else. So when you say: $frga11 = 1 then really, because $frga11 is a string and 1 is an integer/number, it will not actually be "equal" no matter how autoit lets you cheat at it. Coding properly tends to help in these situations ... such as: $frga11 = Int(IniRead('whatever.ini', 'section', 'key', '0')) Here we define $frga11 as an actual integer, so now we can compare $frga11 to the integer 1. As far as your checkbox, $frga10 holds the Control ID of the control you made, not what "state" it's in.... Might have a look at GUICtrlGetState() Edited May 12, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
AdmiralAlkex Posted May 12, 2007 Author Posted May 12, 2007 (edited) I have tried for hours now I am getting tired of this.... It's apparent i am not good enough to get this working.... I give up.... :D I will scrap this if not somebody cant fix whatever is wrong.... expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $frga8 = Int(IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 2", "0")) $frga11 = Int(IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 4", "0")) $frga12 = Int(IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 5", "0")) $frga13 = Int(IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 6", "0")) $frga14 = Int(IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 7", "0")) $frga15 = Int(IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 8", "0")) $frga16 = Int(IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 9", "0")) $frga17 = Int(IniRead(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 10", "0")) If $frga11 = 1 & $frga8 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 1", "1") Exit EndIf If $frga13 = 1 & $frga8 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "1") Exit EndIf If $frga12 = 1 & $frga15 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 1", "0") Exit EndIf If $frga14 = 1 & $frga15 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "0") Exit EndIf $frga1 = GUICreate("Fråga...", 400, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetState() $frga2 = GuiCtrlCreateEdit("Att ändra något här innebär att registret ändras vilket kan vara farligt om något skulle bli fel.", 10, 10, 380, 75, BitOR($ES_MULTILINE, $ES_READONLY), $WS_EX_STATICEDGE) GUICtrlSetFont (-1, 16) $frga3 = GUICtrlCreateLabel("Är du säker på att du vill fortsätta??", 35, 95, 350, 25) GUICtrlSetFont (-1, 16) $frga4 = GUICtrlCreateButton("JA", 15, 130, 140, 60) GUICtrlSetFont (-1, 32) $frga5 = GUICtrlCreateButton("NEJ", 160, 130, 140, 60) GUICtrlSetFont (-1, 32) $frga10 = GUICtrlCreateCheckbox("Fråga inte igen", 305, 150) GUICtrlSetOnEvent($frga4, "frga6") GUICtrlSetOnEvent($frga5, "frga7") $frga18 = GUICtrlGetState($frga10) While 1 Sleep(1000) WEnd Func frga6() If $frga8 = 1 And $frga18 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 4", "1") IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 1", "1") Exit ElseIf $frga8 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 1", "1") Exit ElseIf $frga16 = 1 And $frga18 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 6", "1") IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "1") Exit ElseIf $frga16 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "1") Exit Else Exit EndIf EndFunc Func frga7() If $frga15 = 1 And $frga18 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 5", "1") IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 1", "0") Exit ElseIf $frga15 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 1", "0") Exit ElseIf $frga17 = 1 And $frga18 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 7", "1") IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "0") Exit ElseIf $frga17 = 1 Then IniWrite(@ScriptDir & "\" & "doscommandsmenusettings.ini", "Registrysettings", "Setting 3", "0") Exit Else Exit EndIf EndFunc Func CLOSEClicked() Exit EndFunc Edited May 12, 2007 by TzarAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Developers Jos Posted May 12, 2007 Developers Posted May 12, 2007 (edited) Is the & supposed to be AND ? If $frga11 = 1 And $frga8 = 1 Then ..and you want to do GUICtrlRead($frga18 ) when you want to get its Value.. Edited May 12, 2007 by JdeB 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.
AdmiralAlkex Posted May 12, 2007 Author Posted May 12, 2007 Is the & supposed to be AND ?If $frga11 = 1 And $frga8 = 1 Then..and you want to do GUICtrlRead($frga18 ) when you want to get its Value..thx for the tip but the checkbox is still not working!! .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
kaz Posted May 12, 2007 Posted May 12, 2007 To test the checkbox : BitAND(GUICtrlRead($frga10),$GUI_CHECKED) = $GUI_CHECKED it work for me
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