Jump to content
Sign in to follow this  
jimmyjmmy

to change strings of a script that is still running

Recommended Posts

jimmyjmmy

Hi,

I have this script and when I run this script, there are certain strings I want to change within this script that is still running, can this be done.

If this can be done, I am thinking of using regex to match and change the string, is this the best method?

Thanks

Share this post


Link to post
Share on other sites
PsaltyDS

Assuming the string is in a variable, of course you can do almost anything with it, including but not only by RegExp. Show us a short example of what you are talking about if you need to know more.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
jimmyjmmy

Assuming the string is in a variable, of course you can do almost anything with it, including but not only by RegExp. Show us a short example of what you are talking about if you need to know more.

:)

Thanks everybody.

The script is a password registration script.

Originally the script does not have any password and it will prompt user to enter the correct password, once the correct password is entered, it will not prompt the user anymore and so the scrip goes like this :-

Thanks

------------- script --------------

#include <Date.au3>

;to determine if s/w is registered or not registered

$SoftwareRegistration = 0 ;1 = yes or 0 = no, to change this variable to "yes" if correct password is entered

$RegistrationID = 1234

if $SoftwareRegistration = 0 Then

;do the things here

$regentry = InputBox ("Trial Version", _NowDate ( ) & " :- Please enter your registration code " )

If $RegistrationID = $regentry then

MsgBox (4 , "Thank You","Thank you! Your software is now registered", 4 )

;open this script and rewrite script

StringRegExpReplace ( $SoftwareRegistration, 0, 1); this part is wrong but I cant use FileOpen

; because it will erase content or write at the end of the file. So what must I do here to

; open this script and change the variable $SoftwareRegistration to "yes"

EndIf

Else

; do stuff here

EndIf

Share this post


Link to post
Share on other sites
PsaltyDS

Thanks everybody.

The script is a password registration script.

Originally the script does not have any password and it will prompt user to enter the correct password, once the correct password is entered, it will not prompt the user anymore and so the scrip goes like this :-

That's pretty awkward. You want to change the script inside the .exe after it has been compiled... :)

You would be much better off saving something outside the script. Like creating a registry key for your app. If the user provides proper authentication then you save an encrypted version of their "key" in the registry using _StringEncrypt() and RegWrite().

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
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
Sign in to follow this  

×