The usual way to handle this would be to set a variable in the script once, e.g.:
$set(_albumartist,$if2(%albumartist%,%artist%))
And then use %_albumartist% in place of the above.
But to be honest I don't think there should be a special case just for this. There are a lot more commonly used scripting snippets, but adding variables for all of these does not seem very useful. There is a reason why we have the scripting to make it flexible to customize this. I could see however how there could be a plugin providing common shortcuts.
> Package: picard
> Version: 0.9.0-4
> Severity: wishlist
>
> When setting up my rename rules, I've used the string
> '$if2(%albumartist%,%artist%)' twice for each entry. It seems like there should
> be a short hand for this option, to make working out what's going on easier.
>
> -- System Information:
> Debian Release: lenny/sid
> APT prefers unstable
> APT policy: (500, 'unstable')
> Architecture: i386 (i686)
>
> Kernel: Linux 2.6.26-1-686 (SMP w/2 CPU cores)
> Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/bash
>
> Versions of packages picard depends on:
> ii libavcodec51 3:20080706-0.2 library to encode decode multimedi
> ii libavformat52 3:20080706-0.2 ffmpeg file format library
> ii libavutil49 3:20080706-0.2 avutil shared libraries
> ii libc6 2.7-14 GNU C Library: Shared libraries
> ii libdiscid0 0.1.0-1 Library for creating MusicBrainz D
> ii libfftw3-3 3.1.2-3.1 library for computing Fast Fourier
> ii libgcc1 1:4.3.2-1 GCC support library
> ii libofa0 0.9.3-3 Library for acoustic fingerprintin
> ii libogg0 1.1.3-4 Ogg Bitstream Library
> ii libraw1394-8 1.3.0-4 library for direct access to IEEE
> ii libstdc++6 4.3.2-1 The GNU Standard C++ Library v3
> ii libtheora0 1.0~beta3-1 The Theora Video Compression Codec
> ii libvorbis0a 1.2.0.dfsg-3.1 The Vorbis General Audio Compressi
> ii libvorbisenc2 1.2.0.dfsg-3.1 The Vorbis General Audio Compressi
> ii python 2.5.2-2 An interactive high-level object-o
> ii python-ctypes 1.0.2-5 Python package to create and manip
> ii python-mutagen 1.14-1 audio metadata editing library
> ii python-qt4 4.4.2-4 Python bindings for Qt4
> ii python-support 0.8.6 automated rebuilding support for P
>
> picard recommends no packages.
>
> picard suggests no packages.
>
> -- no debconf information
>
>
>