BetaLeaf

[Solved] Variable returning unexpected result (Can't append value to variable)

4 posts in this topic

#1 ·  Posted (edited)

So here's the script

$sBinaryVideoPath = RegRead("HKEY_CURRENT_USER\SOFTWARE\NVIDIA Corporation\Global\ShadowPlay\NVSPCAPS", "DefaultPathW") ;Value = 0x43003A005C00550073006500720073005C0062006500740061006C005C004F006E006500440072006900760065005C0044006F00630075006D0065006E00740073005C0056006900640065006F0073000000
$sVideoPath = BinaryToString($sBinaryVideoPath, 2)
$sVideoPath &= "\TEST"
InputBox("","",$sVideoPath)

This gets the folder that Nvidia ShadowPlay saves its videos to. Don't worry if you don't have ShadowPlay Installed, just replace $sBinaryVideoPath with the commented value.

Then it converts the binary string to a regular string so we can read and use it.

Then I append "\TEST" to the end of that string.

Finally I display the variable.

 

The problem is it won't append anything to the end of the variable once it is assigned. I can prepend something to this string but appending fails for some reason. Can someone help me figure out this issue?

Edited by BetaLeaf

My Scripts:

False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

AutoISO  - Automatic ISO Image creation using ImgBurn.

SoundBoard - Play any song or sound you want at the press of a hotkey

Share this post


Link to post
Share on other sites



BinaryToString is leaving the null character on the end of the path, you'll have to strip it away.
 

$sBinaryVideoPath = RegRead("HKEY_CURRENT_USER\SOFTWARE\NVIDIA Corporation\Global\ShadowPlay\NVSPCAPS", "DefaultPathW")
$sVideoPath = BinaryToString($sBinaryVideoPath, 2)
$sVideoPath = StringStripWS($sVideoPath, 2)
$sVideoPath &= "\TEST"
InputBox("","",$sVideoPath)

 

2 people like this

Share this post


Link to post
Share on other sites

The last character is the string is Hex 00, so you need to strip that:

$sBinaryVideoPath = Binary("0x43003A005C00550073006500720073005C0062006500740061006C005C004F006E006500440072006900760065005C0044006F00630075006D0065006E00740073005C0056006900640065006F0073000000")
$sVideoPath = BinaryToString($sBinaryVideoPath, 2)
$sVideoPath = StringTrimRight($sVideoPath, 1)
$sVideoPath &= "\TEST"
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sVideoPath = ' & $sVideoPath & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console

Jos

1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Got it. Thanks everyone.

1 person likes this

My Scripts:

False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

AutoISO  - Automatic ISO Image creation using ImgBurn.

SoundBoard - Play any song or sound you want at the press of a hotkey

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