I’ve cheated again, but I hope this is ok and won’t cause any problems:
tell application "Finder" to move (every file of folder source_location whose name contains ".out.") to folder target_location
tell application "Finder" to move (every file of folder source_location whose name contains "xlf") to folder target_location
tell application "Finder" to move (every file of folder target_location whose name contains "xlf.src") to folder source_location
Not very graceful, probably, but does seem to work.
tell application "Finder" to move (every file of folder source_location whose name contains "xlf" and name does not contain "xlf.src") to folder target_location
But this might be the same
tell application "Finder" to move (every file of folder source_location whose name ends with "xlf") to folder target_location
I’ve added one last refinement to this XLIFF creation script so that you can choose the source and target language listings in the XLIFF file itself:
# Create XLIFF files from files in project source directory
set src_lang to {"German", "Dutch"}
set src_langSelect to (choose from list src_lang with prompt "Make Source Language Selection:" without multiple selections allowed) as text
if src_langSelect is "German" then
set sourceLanguage to {"de-de"}
else if src_langSelect is "Dutch" then
set sourceLanguage to {"nl-nl"}
end if
set trg_lang to {"EN-GB", "EN-US"}
set trg_langSelect to (choose from list trg_lang with prompt "Make Target Language Selection:" without multiple selections allowed) as text
if trg_langSelect is "EN-GB" then
set targetLanguage to {"en-gb"}
else if trg_langSelect is "EN-US" then
set targetLanguage to {"en-us"}
end if
set default_folder_Location to (path to home folder as text) & "01 Translations:03 Projects:"
set project_location to (choose folder with prompt "Folder :" default location alias default_folder_Location) as text
set project_location_POSIX to POSIX path of project_location -- POSIX path representation of project_location
set source_location to project_location & "source:"
set source_location_POSIX to POSIX path of source_location -- POSIX path representation of source_location
do shell script "cd " & quoted form of source_location_POSIX & " ; java -jar /Applications/okapi-apps/lib/tikal.jar -x -sl " & sourceLanguage & " -tl " & targetLanguage & " *.*"
display alert "XLIFF file created"
This works fine, but I’d like to add a default answer for both the source and target language code selections (German and EN-GB respectively). The problem I’m having, however, is that no matter where I put in and entry for default answer, I get an error about expecting one thing but getting another. Here is an example:
set src_langSelect to (choose from list src_lang with prompt "Make Source Language Selection:" default answer "German" without multiple selections allowed) as text
Again, a syntax error on my part, but I’ve tried to follow the analogy of how folders are referenced in the script such as:
set project_location to (choose folder with prompt "Folder :" default location alias default_folder_Location) as text
But obviously this isn’t correct in this instance.
The reference needs to be “default items” and yes, it has to be “items” (plural) even though it’s a singular choice:
set src_langSelect to (choose from list src_lang with prompt "Make Source Language Selection:" default items "German" without multiple selections allowed) as text