PantZ4 Posted September 2, 2006 Share Posted September 2, 2006 (edited) I have a script there should look and see about it has been installed Like: While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $passwordexit GUIDelete() Exit Case $msg = $passwordenter If GUICtrlRead($passwordtext) = $password Then if IniRead($installpath & "\test.ini", "test", "Installed ", " 0") Then ; Do something IniWrite($installpath & "\test.ini", "test", "Installed ", " 1") Else $iMsgBoxAnswer = MsgBox(8240,"Is Installed","test is installed on this computer.",3) EndIf Else If GUICtrlRead($passwordtext) = $removepassword then if IniRead($installpath & "\test.ini", "test", "Installed ", " 1") Then IniDelete($installpath & "\test.ini", "test", "Installed ") IniWrite($installpath & "\test.ini", "test", "Installed ", " 0") Else $iMsgBoxAnswer = MsgBox(8240,"Not Installed","test is not installed on this computer.",3) EndIf Else Endif EndIf EndSelect WEnd Oh and $installpath is @DesktopCommonDir But I can't see why it won't work... Any ideas? Thank you Edit: Oops title is worng (word = work) ~Mr. Zero Edited September 2, 2006 by Mr. Zero Link to comment Share on other sites More sharing options...
Helge Posted September 2, 2006 Share Posted September 2, 2006 There's a missing EndIf after your last Else. Link to comment Share on other sites More sharing options...
PantZ4 Posted September 2, 2006 Author Share Posted September 2, 2006 (edited) There's a missing EndIf after your last Else.A typo... Oops :">Edit: It still don't work... Edited September 2, 2006 by Mr. Zero Link to comment Share on other sites More sharing options...
Xenobiologist Posted September 2, 2006 Share Posted September 2, 2006 Hi, where is the rest of the script? So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
PantZ4 Posted September 2, 2006 Author Share Posted September 2, 2006 (edited) Hi, where is the rest of the script? So long, Mega The rest? There is only $ and exit in the "rest"... Here is a hole copy. expandcollapse popup#include <GuiConstants.au3> Global $passwordwindow Global $password = "1" Global $removepassword = "2" Global $msg Global $passwordenter Global $passwordexit Global $passwordtryies = 0 Dim $iMsgBoxAnswer Global $installpath = @DesktopCommonDir $passwordwindow = GUICreate("Test",190,120,(@DesktopWidth-190)/2, (@DesktopHeight-105)/2) $passwordtext = GUICtrlCreateInput("",20,30,150,20,$es_password) $passwordenter = GUICtrlCreateButton("Enter",15,70,75,20,$BS_DEFPUSHBUTTON) $passwordexit = GUICtrlCreateButton("Exit",100,70,75,20) GuiSetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $passwordexit GUIDelete() Exit Case $msg = $passwordenter If GUICtrlRead($passwordtext) = $password Then if IniRead($installpath & "\test.ini", "test", "Installed ", " 0") Then GUIDelete($passwordwindow) IniWrite($installpath & "\test.ini", "test", "Installed ", " 1") Exit Else $iMsgBoxAnswer = MsgBox(8240,"Is Installed","test is installed on this computer.",3) EndIf Else If GUICtrlRead($passwordtext) = $removepassword then if IniRead($installpath & "\test.ini", "test", "Installed ", " 1") Then IniDelete($installpath & "\test.ini", "test", "Installed ") IniWrite($installpath & "\test.ini", "test", "Installed ", " 0") Exit Else $iMsgBoxAnswer = MsgBox(8240,"Not Installed","test is not installed on this computer.",3) EndIf Else $passwordtryies = $passwordtryies + 1 if $passwordtryies = 3 Then GUIDelete() MsgBox(16,"Password Protection","Worng password three times. Closeing...",5) Exit Else $iMsgBoxAnswer = MsgBox(8240,"Wrong password","You have typed a worng password.",3) EndIf EndIf EndIf EndSelect WEnd Edited September 2, 2006 by Mr. Zero Link to comment Share on other sites More sharing options...
Xenobiologist Posted September 2, 2006 Share Posted September 2, 2006 Hi, okay now we've got the code, but where is the problem? So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 2, 2006 Moderators Share Posted September 2, 2006 Hi,okay now we've got the code, but where is the problem?So long,MegaI was thinking the same thing... It works as expected to me... But I do have a question... why are you putting a space in the IniRead()/Write()... " 0"/" 1"? 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. Link to comment Share on other sites More sharing options...
PantZ4 Posted September 2, 2006 Author Share Posted September 2, 2006 (edited) Hi, okay now we've got the code, but where is the problem? So long, Mega Well if you try the script you will see you can type 1 first time and selcet the button "Enter", so the script will "install" the .ini. After that you can run the program aging and type 1 aging and aging it will "install". But it is not that i want, I want the script tells me: "test is installed on this computer" so.... @SmOke N I did't like the way it was set up in the ini file Like: [test] Installed=(Number) I like with space... lol Edited September 2, 2006 by Mr. Zero Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 2, 2006 Moderators Share Posted September 2, 2006 Well if you try the script you will see you can type 1 first time and selcet the button "Enter", so the script will "install" the .ini. After that you can run the program aging and type 1 aging and aging it will "install". But it is not that i want, I want the script tells me: "test is installed on this computer" so.... @SmOke N I did't like the way it was set up in the ini file Like: [test] Installed=(Number) I like with space... lol Look at your logic... You Delete the GUI on the first go around, then you want it to GUICtrlRead() the 2nd time a GUI that isn't there anymore... Change up your logic to something different and it will work. 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. Link to comment Share on other sites More sharing options...
PantZ4 Posted September 2, 2006 Author Share Posted September 2, 2006 Look at your logic... You Delete the GUI on the first go around, then you want it to GUICtrlRead() the 2nd time a GUI that isn't there anymore... Change up your logic to something different and it will work.I meanRun the script then type 1 and press the enter button.When the script will "install" a ini file on your desktop and the program close it self.When run the script aging and type 1 and press the enter button.(And this is the part there is not working)It will "install" the ini file... Aging, and that is not what I want.Insted of "install" it aging, it should show a msgbox there says "Test is allready installed on this computer"and close the program...And you can do this to with the "remove" function. Even without have "installed" it, which should show a msgbox there say "Test is not installed on this computer"I'm sorry for being unclear in my first post... Link to comment Share on other sites More sharing options...
Zedna Posted September 2, 2006 Share Posted September 2, 2006 (edited) try to replace: if IniRead($installpath & "\test.ini", "test", "Installed ", " 0") ThenoÝ÷ Ú)ß»-q«Ýý²)©'"µê®ö¥z{m¡«¢+Ù¥%¹¥I ÀÌØí¥¹Íѱ±ÁÑ µÀìÅÕ½ÐìÀäÈíÑÍй¥¹¤ÅÕ½Ðì°ÅÕ½ÐíÑÍÐÅÕ½Ðì°ÅÕ½Ðí%¹Íѱ±ÅÕ½Ðì°ÅÕ½ÐìÀÅÕ½Ð줱ÐìÐìÅÕ½ÐìÅÕ½ÐìQ¡ which is not what you want, is it? Edited September 2, 2006 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
PantZ4 Posted September 3, 2006 Author Share Posted September 3, 2006 (edited) 1. if IniRead($installpath & "\test.ini", "test", "Installed ", " 0") = " 0" ThenoÝ÷ Ù8b²ÞÉè· +;§î¶+ZÊËÊÈÊ®¢Ø§²Ö¥çjºvjëh×6if IniRead($installpath & "\test.ini", "test", "Installed ", " 0") <> " 0" Then This one is not working too. aging dunno, this is the old problem aging... Maybe I'm a . and can't this to work . But thank you for helping. Maybe you got it to work? If please show how you did it ... Cause i'm a . Edited September 3, 2006 by Mr. Zero Link to comment Share on other sites More sharing options...
Zedna Posted September 3, 2006 Share Posted September 3, 2006 Maybe I'm a . and can't this to work . But thank you for helping. Maybe you got it to work? If please show how you did it ... Cause i'm a .But i'm still the of the world. I didn't tested anything, only gave you corrected bad syntax & logic of your script.My advice is: Look into AutoIt HelpFile for details about IniRead (and search forum for examples) and try some debugging - what values it gives you...Bye Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
PantZ4 Posted September 3, 2006 Author Share Posted September 3, 2006 I got it to work , but all I have done is put into a variable. Like: $installed = IniRead($installpath & "\test.ini", "test", "Installed ", " 0") if $installed = 0 Then So now it works... and I leved happily... And I have leaned some new things . 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