Hiya! is there anyway to auto capitalize the titles when typing? Or an action to do that to all titles?
All the best
Hiya! is there anyway to auto capitalize the titles when typing? Or an action to do that to all titles?
All the best
Sorry i shoul dof been clearer… To bulk edit, as i have a couple thousand.
All the best
If you are already using GarageSale 9, pasting this script into the Script Editor Window should do the trick for all selected listings:
function titleCase(str) {
var splitStr = str.toLowerCase().split(' ');
for (var i = 0; i < splitStr.length; i++) {
splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);
}
return splitStr.join(' ');
}
function run(){
for (const listing of selectedListings) {
listing.title = titleCase(listing.title);
}
}
that function works perfectly. thank you
Did you re-type it manually for some reason? You missed at least one dot, when you called str.toLowerCase()
.
When the syntax error alert appears, the editor highlights the closest token it can find to the error. You can see the problem is somewhere before the highlighted dot.
I cut and pasted what was above in ilja’s post
Wait, now I’m actually looking at your screen cap. What Ilja posted was Javascript, not AppleScript. It goes in the JS scripts window within GarageSale, not in the AppleScript Editor app.
Also you seem to have pasted it into… another AppleScript? Something that changes the BIN prices of listings? Those are two different programming languages.
Well, that would explain it. The BIN prices of listings apple script is a second tab
Ok, I found where to put the javascript. It does work perfectly. Thanks Vaguery for the help for a coding novice.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.