Finder renaming script?

Jun 17, 2011 13:36

Hey all ( Read more... )

Leave a comment

Comments 19

kiodane June 17 2011, 15:56:01 UTC
I use bash to script my Minecraft server. I still have to update ( ... )

Reply

kiodane June 17 2011, 16:04:47 UTC
Ugh, some of those lines got wrapped... I'm not on my computer and it looks like the formatting got a tad messed up.

https://files.me.com/kioarthurdane/sdekbg

Reply

xv June 17 2011, 16:07:12 UTC
Hey dude. :)

Reply

kiodane June 17 2011, 17:41:20 UTC
Long time no see, my brotha'

I posted my response on applescript for exactly the reason they said on their cross-post that there was virtually no activity over here.

Reply


xv June 17 2011, 16:05:35 UTC
I have to agree bash is the way to go here, Applescript file handling is ... odd. That said, though, sometimes you want to handle files in an odd, esoteric, way. So, to get your script to compile (maybe function, I dunno) you would first want to translate from posix notation by changing "set this folder to ..." to "set this folder to posix file ... " You can run that as a script by itself to see what the result is. Assuming that translates well, finder might accept it, might not, you just have to fiddle with it. It might need to also have an "... as alias" tacked on the end ( ... )

Reply

johncoxon June 17 2011, 17:54:12 UTC
I don't know if Automator can handle if statements, can it? That's why I was attempting to do it via AppleScript as opposed to Automator (I actually basically understand how to use Automator, as opposed to being a complete newbie with AppleScript).

Reply

xv June 17 2011, 20:18:56 UTC
Ah, they told me they were going to add those. Looks like they just added variables and loops in my copy, no conditionals to be found, just filters. Well, you can still put them in by using the AppleScript action, but at that point it's more trouble than it's worth.

So, have we sorted your script yet? (haven't read the comments above)

Reply

try this xv June 17 2011, 20:59:52 UTC
tell application "Finder"
get the home as alias as text
set thisFolder to the result & "Dropbox:Minecraft:minecraft:bin:" as alias
if the name of thisFolder's folders contains "minecraft-mods.jar" then
set the name of folder "minecraft.jar" of thisFolder to "minecraft-original.jar"
set the name of folder "minecraft-mods.jar" of thisFolder to "minecraft.jar"
else
set the name of folder "minecraft.jar" of thisFolder to "minecraft-mods.jar"
set the name of folder "minecraft-original.jar" of thisFolder to "minecraft.jar"
end if
end tell

Reply


Leave a comment

Up