Winter's back... which means I'm gonna be indoors for a good 4 or 5 months. Which means I'm excited to brush off the rust and spend some more time scripting with AHK (yay)..and of course try and re-familiarise myself with everything haha.
Which brings me to my question.
I'm trying to remove a number of characters from a string. And I was able to do this earlier, but for some reason I can't get it going any more. Here's part of the code:
Code: Select all
winactivate, ahk_class Photoshop
winwaitactive, ahk_class Photoshop
wingettitle, title, A
;at this point, %title% will be something like Untitled-1 @ 24% (Layer 1, RGB/8) *
Untitled-1
So basically I need to get rid of the @ and everything after it, as well as the empty space before it.
So, I tried all of this:
Code: Select all
winactivate, ahk_class Photoshop
winwaitactive, ahk_class Photoshop
wingettitle, title, A
title_trimmed=
string = %title%
Loop, parse, string
{
If ( A_LoopField = "@")
{
Break
}
}
title_trimmed .= A_LoopField
;next, remove the resulting trailing empty space which was left over in the trimmed_title variable:
vText = %title_trimmed%
result := % "" RTrim(vText) "" ;this trims the ending empty spaces only
title_trimmed=%result%
Would anyone happen to have any ideas how to tweak this? Thanks in advance