Does anyone know of a way to convert a set of strings into acronyms? I have a list of program names that I want to automatically convert their titles to acronyms. For example:
Photoshop
Internet Explorer
Google Chrome
Command Prompt
Device Manager
Calculator
Becomes:
P
IE
GC
CP
DM
C
More specifically, I'd like only capital letters to remain with no spaces. So that program shortcuts such as:
On-Screen Keyboard
Uninstall a Program
YouTube
Become:
OSK
UP
YT
It is currently April 25th, 2024, 4:01 pm
Converting strings into acronyms with regexp?
-
- Posts: 478
- Joined: February 26th, 2011, 10:22 pm
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Converting strings into acronyms with regexp?
Seems to be that you are actually saying the reverse. You want "PP" to be seen as "PowerPoint" or whatever, presumably so you can execute the associated application?
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Converting strings into acronyms with regexp?
If so, why isn't that simply [Variables]?
https://docs.rainmeter.net/manual/variables/nesting-variables/
Also note that variables are not case-sensitive, (very little in Rainmeter is) so "pp" is the same as "PP".
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
PP=PowerPoint
PS=PhotoShop
[MeterSearchBox]
Meter=Shape
Shape=Rectangle 1,1,202,25 | Fill Color 215,215,215,255 | Stroke Color 130,130,130,255
W=202
H=25
LeftMouseUpAction=[!CommandMeasure MeasureSearchInput "ExecuteBatch 1"]
[MeasureSearchInput]
Measure=Plugin
Plugin=InputText
X=1
Y=2
W=200
H=22
SolidColor=200,200,200,255
FontColor=47,47,47,255
FontSize=11
AntiAlias=1
FocusDismiss=1
UpdateDivider=-1
Command1=[!Log "[#$UserInput$]"]
Also note that variables are not case-sensitive, (very little in Rainmeter is) so "pp" is the same as "PP".
-
- Posts: 478
- Joined: February 26th, 2011, 10:22 pm
Re: Converting strings into acronyms with regexp?
To convert file and shortcut names in FileView into acronyms. The names are folder-dependant, so having set variables wouldn't work.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Converting strings into acronyms with regexp?
Yeah, sorry, don't follow.Virginityrocks wrote:To convert file and shortcut names in FileView into acronyms. The names are folder-dependant, so having set variables wouldn't work.
-
- Posts: 87
- Joined: March 18th, 2013, 1:59 pm
Re: Converting strings into acronyms with regexp?
Personally, my approach would use Lua. Loop through the string and copy off any capital letters into a new string. Since you're intending to rely on capital letters though, this will require proper case usage. Some programs like paint.net don't show capital letters in their name, while others sometimes use SCREAMING caps. Unless you've got a pre-processor to force captialization, then I think you're going to run into issues.