Sign in to follow this  
Followers 0
pipiboy

about registry string values

2 posts in this topic

Registry content:

Name | Type | Date

=============================

TestKeyA | REG_SZ | 5.5.5.5555

TestKeyB | REG_SZ | 3.3.3.3333

=============================

Code:

$var1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE", "TestKeyA")

$var2 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE", "TestKeyB")

;$Result = Number($var1) - Number($var2)

;MsgBox(4096, "result:",$Result) ; Result = 2.2

=============================

But I need this value(2.2.2.2222):

Var1(5.5.5.5555) - Var2(3.3.3.3333) = Result (2.2.2.2222)

Please kindly help me with this situation,ths!

Share this post


Link to post
Share on other sites



REG_SZ is a string value - so you can't do a simple arithmetic operation on it. Use StringSplit with "." as separator, do your arithmetic on every item in the returned array and then us a _ArrayToString to create a string again.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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  
Followers 0