WildByDesign Posted June 29, 2024 Posted June 29, 2024 Hi there, I have a variable that gets the Windows theme DisplayName successfully. The variable is $idDisplayName and the text could be a theme name in all text such as: Windows spotlight Glow Or it could also contain a DLL resource identifier such as: @%SystemRoot%\System32\themeui.dll,-2114 @%SystemRoot%\System32\themeui.dll,-2060 I already have a method to obtain the DisplayName base on those resource identifiers. The part where I am stuck right now is I want to continue the function if $idDisplayName only contains text characters. But if $idDisplayName contains the @ symbol, I want to move to another function to parse the DisplayName. Rough example: If $idDisplayName contains @ Then strip everything except for the resource number only, no characters or minus symbol So for example, if $idDisplayName contains the @ symbol, I want the following: @%SystemRoot%\System32\themeui.dll,-2114 To simply return into another variable as: 2114 This way I can move onto my other function that I already have functioning to obtain the resource identifier string (DisplayName) based on that number. I am guessing that this may require regex, but either way I am stuck on this part. Thank you for your time.
Solution Andreik Posted June 29, 2024 Solution Posted June 29, 2024 Read in help file about StringInStr().
WildByDesign Posted June 30, 2024 Author Posted June 30, 2024 @Andreik Thank you for leading me in the right direction. I used StringInStr to determine whether DisplayName had an @ symbol or not. Then I used StringRight to grab the 4 digits on the right. Everything works now. I appreciate it.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now