Jump to content
BetaLeaf

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

Recommended Posts

BetaLeaf

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

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

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites
Tekk

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)

 

  • Like 2

Share this post


Link to post
Share on other sites
Jos

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

  • Like 1

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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

×