Jump to content

Problem with create trial version.


jmp
 Share

Recommended Posts

i want to create 3 days trial version of my copmlied script, after reached 3 days it want to ask some key and it send to the registry, the key has been already entered in my script.

Here is my code :

#RequireAdmin
#include <Date.au3>
#include <IE.au3>
#include <MsgBoxConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
HotKeySet("{ESC}", "Quit")

$endDate = "2020/04/28"
$skey = "PF0BVXS" 
$regKey = "18241454598"

$oIE = _IEAttach ("My webpage")
Local $oTds = _IETagNameGetCollection($oIE, "AB")
For $oTd In $oTds
    If $oTd.className = "header-btn 3" Then
        $sDate = StringSplit($oTd.NextElementSibling.InnerText, " ")[3] ;Get date from webpage
        ExitLoop
    EndIf
Next
$findkey = RegRead("HKEY_CURRENT_USER\Software\Mycode" , "softwarekey")
$nowdate = StringRegExpReplace($sDate, "(\d\d)/(\d\d)/(\d\d\d\d)", "$3/$2/$1")
Local $datediff = _DateDiff('D', $nowdate, $endDate)
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$colSMBIOS = $objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure")
For $objSMBIOS in $colSMBIOS
Next
$FsKey = $objSMBIOS.SerialNumber


If $datediff > 0 And $FsKey = $skey Then
;continue my script

ElseIf $datediff < 0 Then
    MsgBox($MB_ICONWARNING, "", "program expired", 15)
    Exit
ElseIf not ($FsKey = $skey) Then
    MsgBox($MB_ICONWARNING, "", "Serial not match", 15)
    Exit
ElseIf ($datediff < 363) And ($FsKey = $skey) And Not ($regKey = $findkey) Then
$guiCreate = GUICreate("Code", 400, 200, -1, -1)
GUICtrlCreateLabel("Enter your Key : ", 10, 20, 100)
$Input1 = GUICtrlCreateInput("", 10, 50, 300, 25)

$Button1 = GUICtrlCreateButton("Save", 130, 100, 75, 25)
GUICtrlSetTip(-1, "Save...")
$Button2 = GUICtrlCreateButton("Exit", 230, 100, 75, 25)
GUICtrlSetTip(-1, "Exit...")
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ClipPut ("")
            Exit
        Case $Button1
            OK()
        Case $Button2
            Close()
    EndSwitch
WEnd
EndIf

Func OK()
     $rCode = GUICtrlRead($Input1)
$verify = MsgBox(68, "", "Do you want to register with this serial key ?" &@crlf& $rCode)
                    Select
                        Case $verify = 6
RegWrite ("HKCU\Software\MyScript" , "ScriptWontWorkWithoutThisKey", "REG_SZ" , $rCode)
                        ClipPut ("")
                            Exit
                        Case $verify = 7
                          ClipPut ("")
                            Exit
                    EndSelect
EndFunc
Func Close()
    ClipPut ("")
    Exit
EndFunc

But, it was not ask for key and continue running.

Sorry for my bad english.

Edited by jmp
Link to comment
Share on other sites

  What kind of debugging effort have you put to solve your issue.  You know that the lines that cause your problem are :

If $datediff > 0 And $FsKey = $skey Then
;continue my script

ElseIf $datediff < 0 Then
    MsgBox($MB_ICONWARNING, "", "program expired", 15)
    Exit
ElseIf not ($FsKey = $skey) Then
    MsgBox($MB_ICONWARNING, "", "Serial not match", 15)
    Exit
ElseIf ($datediff < 363) And ($FsKey = $skey) And Not ($regKey = $findkey) Then
...

So you should be able to find out the problem yourself.  What you should do is place a few msgbox or consolewrite just before the start of the "If" and look inside all variables implied in that section.  It should become clear what is the issue.  You can also msgbox a whole condition like :

MsgBox (0,"Test",($datediff < 363) And ($FsKey = $skey) And Not ($regKey = $findkey))

So you can know the real end result.  One piece of advise, replace not ($a = $b) by $a <> $b, it is more readable...

Edited by Nine
Link to comment
Share on other sites

2 hours ago, Nine said:

  What kind of debugging effort have you put to solve your issue.  You know that the lines that cause your problem are :

If $datediff > 0 And $FsKey = $skey Then
;continue my script

ElseIf $datediff < 0 Then
    MsgBox($MB_ICONWARNING, "", "program expired", 15)
    Exit
ElseIf not ($FsKey = $skey) Then
    MsgBox($MB_ICONWARNING, "", "Serial not match", 15)
    Exit
ElseIf ($datediff < 363) And ($FsKey = $skey) And Not ($regKey = $findkey) Then
...

So you should be able to find out the problem yourself.  What you should do is place a few msgbox or consolewrite just before the start of the "If" and look inside all variables implied in that section.  It should become clear what is the issue.  You can also msgbox a whole condition like :

MsgBox (0,"Test",($datediff < 363) And ($FsKey = $skey) And Not ($regKey = $findkey))

 So you can know the real end result.  One piece of advise, replace not ($a = $b) by $a <> $b, it is more readable...

Msgbox showing False.

and it was not asking for key after reaching 3 days and Script continues work without key.

Edited by jmp
Link to comment
Share on other sites

How is this any different from your last thread? Why open a new one when you're still getting help in the previous one?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

4 hours ago, FrancescoDiMuro said:

Already reported the thread since he seems to be @naru/@iamtech, who are already banned from the forum.

are you sure it isnt just another brother?

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
EndIf

"Yeah yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results  |  SciTE4AutoIt3 Editor Full Version

Link to comment
Share on other sites

4 hours ago, alienclone said:

are you sure it isnt just another brother?

Yeah, I am brother of naru, iamtech is not my account. He was used both account. So, He is not my business partner, but we have same types business.

Naru's mistake now seems to be punishment for me, because i feel that my account will banned of his mistake. 

Link to comment
Share on other sites

  • Moderators

jmp,

At the moment I am prepared to give you the benefit of the doubt over this "brother" claim. Woe betide you if you are not being honest.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

32 minutes ago, Melba23 said:

jmp,

At the moment I am prepared to give you the benefit of the doubt over this "brother" claim. Woe betide you if you are not being honest.

M23

Okay Sir, I am not known English well as my brother, But i will trying to understand you. 

Can we now discuss about my post? 

Edited by jmp
Link to comment
Share on other sites

  • Moderators

It was mentioned two days ago that you didn't have any debugging in your script, and an example of the debugging you should be doing was given to you. Have you implemented this? What are the results? Rather than just asking for someone else to fix it for you, how about showing some effort yourself

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

1 hour ago, JLogan3o13 said:

It was mentioned two days ago that you didn't have any debugging in your script, and an example of the debugging you should be doing was given to you. Have you implemented this? What are the results? Rather than just asking for someone else to fix it for you, how about showing some effort yourself

it was not asking for key after reaching 3 days and Script continues work without key.

Link to comment
Share on other sites

you sure don't like answering questions do you? A Moderator asked you a very important question. Why should anyone help you if you refuse to take help advice? It makes some people angry to see code-begging.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

1 minute ago, Earthshine said:

you sure don't like answering questions do you? A Moderator asked you a very important question. Why should anyone help you if you refuse to take help advice? It makes some people angry to see code-begging.

Okay Sorry Sir, But i am new on autoit and i don't know why my code is not working properly ?

Link to comment
Share on other sites

what code? you've posted NONE of yours!

no excuses either--that is rather pathetic, we were all new at some point. difference is we read help files and do research. And when you are given help in other threads but don't implement it, who could possibly know but you why it doesn't work?!?

I'm out, you are now on Ignore. bye.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

  • 2 weeks later...

I Exchanged line 31 with line 40, and line 40 with line 31, and now it was asking key after 3 days.

Now my Code is :

#RequireAdmin
#include <Date.au3>
#include <IE.au3>
#include <MsgBoxConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
HotKeySet("{ESC}", "Quit")

$endDate = "2020/04/28"
$skey = "PF0BVXS"
$regKey = "18241454598"

$oIE = _IEAttach ("My webpage")
Local $oTds = _IETagNameGetCollection($oIE, "AB")
For $oTd In $oTds
    If $oTd.className = "header-btn 3" Then
        $sDate = StringSplit($oTd.NextElementSibling.InnerText, " ")[3] ;Get date from webpage
        ExitLoop
    EndIf
Next
$findkey = RegRead("HKCU\Software\Mykey" , "WontWorkWithoutMyKey")
$nowdate = StringRegExpReplace($sDate, "(\d\d)/(\d\d)/(\d\d\d\d)", "$3/$2/$1")
Local $datediff = _DateDiff('D', $nowdate, $endDate)
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$colSMBIOS = $objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure")
For $objSMBIOS in $colSMBIOS
Next
$FsKey = $objSMBIOS.SerialNumber


If ($datediff < 363) And ($FsKey = $skey) And Not ($regKey = $findkey) Then
$guiCreate = GUICreate("Code", 400, 200, -1, -1)
GUICtrlCreateLabel("Enter your Key : ", 10, 20, 100)
$Input1 = GUICtrlCreateInput("", 10, 50, 300, 25)

$Button1 = GUICtrlCreateButton("Save", 130, 100, 75, 25)
GUICtrlSetTip(-1, "Save...")
$Button2 = GUICtrlCreateButton("Exit", 230, 100, 75, 25)
GUICtrlSetTip(-1, "Exit...")
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ClipPut ("")
            Exit
        Case $Button1
            OK()
        Case $Button2
            Close()
    EndSwitch
WEnd
ElseIf $datediff > 0 And $FsKey = $skey Then
;continue my script

ElseIf $datediff < 0 Then
    MsgBox($MB_ICONWARNING, "", "program expired", 15)
    Exit
ElseIf not ($FsKey = $skey) Then
    MsgBox($MB_ICONWARNING, "", "Serial not match", 15)
    Exit

EndIf

Func OK()
     $rCode = GUICtrlRead($Input1)
$verify = MsgBox(68, "", "Do you want to register with this serial key ?" &@crlf& $rCode)
                    Select
                        Case $verify = 6
RegWrite ("HKCU\Software\Mykey" , "WontWorkWithoutMyKey", "REG_SZ" , $rCode)
                        ClipPut ("")
                            Exit
                        Case $verify = 7
                          ClipPut ("")
                            Exit
                    EndSelect
EndFunc
Func Close()
    ClipPut ("")
    Exit
EndFunc

Now my question is : 1) why it was not working before ?

2) Does it have any Bug ?

3) Does it stopped run after 365 days ?

Link to comment
Share on other sites

  • Moderators

1) Because you were doing something wrong

2) Almost certainly because you're still doing zero error checking

3) We'll let you know in 366 days, stay tuned

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

33 minutes ago, JLogan3o13 said:

1) Because you were doing something wrong

2) Almost certainly because you're still doing zero error checking

3) We'll let you know in 366 days, stay tuned

1) I agree, but my question is why autoit not recognize second if/elseif statement ?

2) can you tell me what is bug in my code? 

3) If I could wait, why would I ask you here?

Link to comment
Share on other sites

  • Moderators

1) Because it was formatted incorrectly, and if you had some error checking you would have figured that out.

2) See above, you want us to spoon-feed it to you. How about adding the error checking as suggested multiple times by multiple people, and figuring it out for yourself?

3) My point exactly - you're asking the community to peer into our collective crystal balls and determine whether your script will still be running a year from now. How do you expect a concrete answer to that? Best guess? Maybe...

If the answers you are getting are frustrating, realize they are a reflection of the teeth-pulling people have had to do to get information from you, as well as the community's frustration at you wanting to sit back and have everyone do it all for you line by line. Put in some additional effort, and you will receive additional assistance.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...