_Kurt Posted November 4, 2006 Share Posted November 4, 2006 I will take Valuater's advice and start a new topic with a better title. So, this is just an example of what I want to do: the user presses button, he gets banned for one day, after the day passed it 'unbans' him (sorry if it's not the proper term . Could someone tell me if I am doing something wrong? If there is a better or different way to do this? Any advice or suggestions will be highly appreciated #include <GUIConstants.au3> #include <String.au3> #include <Date.au3> ;-----------Check If User Is Banned----------- $startdate = _StringEncrypt(0, RegRead("HKCU\Software\Microsoft\Windows\Current Version", "Example1"), @ComputerName) If NOT $startdate = "" Then If _DateDiff("D", $startdate, _NowCalc()) < 1 Then MsgBox(0, "", "You have been banned.") Exit EndIf EndIf ;If User finished his ban, delete it so the user will be able to be banned again If _DateDiff("D", $startdate, _NowCalc()) > 1 AND Not $startdate = "" Then RegDelete("HKCU\Software\Microsoft\Windows\Current Version", "Example1") EndIf ;--------Create GUI with button-------- $GUI = GUICreate("Example", 250, 120) $Button = GUICtrlCreateButton("Ban Me", 15, 10, 100, 50) GUISetState() While 1 $msg = GUIGetMsg();Check for any clicks on the following Select Case $msg = $Button RegWrite("HKCU\Software\Microsoft\Windows\Current Version", "Example1", "REG_SZ", _StringEncrypt(1, _NowCalc(), @ComputerName)) SetError(0) GUIDelete($GUI) MsgBox(0, "", "You are now banned" & @CRLF & "for one day.") Exit EndSelect WEnd Thanks for ANY help!! Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 4, 2006 Moderators Share Posted November 4, 2006 Just put the Valik button to the left of the Larry modification. 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...
_Kurt Posted November 4, 2006 Author Share Posted November 4, 2006 Huh? I don't understand what you're saying. Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
spyrorocks Posted November 4, 2006 Share Posted November 4, 2006 Hes just fooling around with you LOL. [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center] Link to comment Share on other sites More sharing options...
_Kurt Posted November 4, 2006 Author Share Posted November 4, 2006 Oh, okay well have fun Smoke_N. Any real comments or advice or ANYTHING? Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 4, 2006 Moderators Share Posted November 4, 2006 Oh, okay well have fun Smoke_N.Any real comments or advice or ANYTHING?I was having fun... thanks A comment? Advice?I've never liked the idea that people rely on date udf's for this type of thing. What happens when the end user changes their clock to avoid it?I personally would use a universal time for all of them. Using _InetGetSource() and a world time site, then parse to get the date and time. Or use TCP to call your server, and get the date and time from your server. Otherwise, even my 7 yr old knows how to reset the clock on a computer.I've also never really liked the fact that people write to the registry for this type of stuff. One of the easiest things monitored for changes. Even though you are using _StringEncrypt() you still only have 2 constants. Banned or Not Banned. So if they see they are able to use the program, they can look at the registry, find out what you are using for "Not Banned", and then keep that on record, then when they are not able to use it any longer, they can see what changes you've made, and see what you are using for "Banned", and in about 2 seconds become "Unbanned".Though I've not given direct answers, only concerns, I hope it gets you to thinking of a deeper level of checking these types of things. 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...
_Kurt Posted November 4, 2006 Author Share Posted November 4, 2006 Thanks alot for the reply! You've given me alot to think about, Smoke_N. Now I have to re-think the whole idea, which is good because I'm making the ban alot harder to get around. Thanks again for the concerns, I was waiting for some! Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
_Kurt Posted November 4, 2006 Author Share Posted November 4, 2006 >< I'm not experienced enough to understand the use of _InetGetSource, or how to connect to my server using TCP. Perhaps a small example (if that's not too much to ask )? or I think I'll just stick with my original idea and instead of writing to the registry, i write to a file @tempdir. Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
Lakes Posted November 4, 2006 Share Posted November 4, 2006 >< I'm not experienced enough to understand the use of _InetGetSource, or how to connect to my server using TCP. Perhaps a small example (if that's not too much to ask )? or I think I'll just stick with my original idea and instead of writing to the registry, i write to a file @tempdir. Kurt#include <INet.au3> $NotePad = "Untitled - Notepad" $NPad = "Edit1" $LF = Chr(10) $CR = Chr(13) Run("notepad.exe"); < ----------- Open NotePad WinWait("Untitled - Notepad") $Source = _INetGetSource('http://www.timeanddate.com/worldclock/full.html') NotepadWrite($Source) ;View Source $StrPos = StringInStr ( $Source, "Glasgow") ;Locate the word Glasgow for UK time MsgBox(0,"Time in the UK is..",StringMid ( $Source, $StrPos ,41 )) Exit Func NotepadWrite($String) ControlCommand("Untitled - Notepad", "", "Edit1", "EditPaste", $String &$CR &$LF) EndFunc Needs some extra parsing to filter out the tags, but you get the basic idea from this. 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 4, 2006 Moderators Share Posted November 4, 2006 #include <INet.au3> $NotePad = "Untitled - Notepad" $NPad = "Edit1" $LF = Chr(10) $CR = Chr(13) Run("notepad.exe"); < ----------- Open NotePad WinWait("Untitled - Notepad") $Source = _INetGetSource('http://www.timeanddate.com/worldclock/full.html') NotepadWrite($Source) ;View Source $StrPos = StringInStr ( $Source, "Glasgow") ;Locate the word Glasgow for UK time MsgBox(0,"Time in the UK is..",StringMid ( $Source, $StrPos ,41 )) Exit Func NotepadWrite($String) ControlCommand("Untitled - Notepad", "", "Edit1", "EditPaste", $String &$CR &$LF) EndFunc 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...
Lakes Posted November 4, 2006 Share Posted November 4, 2006 #include <INet.au3> $sSource = _INetGetSource('http://www.timeanddate.com/worldclock/full.html') $aArray = StringRegExp($sSource, '(?i)(?s)Glasgow\<\/a\>\<\/td\>\<td class\="r"\>(.*?)\<', 3) If IsArray($aArray) Then MsgBox(0,"Time in the UK is..", $aArray[0])Can`t find StringRegExp in the helpfile, could have sworn I`ve seen it there... 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 4, 2006 Moderators Share Posted November 4, 2006 Can`t find StringRegExp in the helpfile, could have sworn I`ve seen it there... Beta 3.2.1.8 or higher. 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...
_Kurt Posted November 4, 2006 Author Share Posted November 4, 2006 Thank you for the replies! I'll be experimenting and testing so I fully understand the concepts and functions. Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
Lakes Posted November 4, 2006 Share Posted November 4, 2006 Beta 3.2.1.8 or higher.Ah.. time to get the lastest one then... 2015 - Still no flying cars, instead blankets with sleeves. 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