Relative file target paths in script

172 views
Skip to first unread message

simon.c...@gmail.com

unread,
May 5, 2021, 5:33:08 AM5/5/21
to QLab
Hi all. Im writing a script to create hundreds of cues with all the correct routing / patching etc. I have a simple loop to do this and I would like to set the file targets in the loop too. For instance, if the directory that my Qlab file is in also has a folder called Audio Files and in there there are a bunch of wav files named 1.wav, 2.wav etc Id like to target these.

I have tried :

set file target of cue myfileblahblah to "/Audio Files/1.wav"

just to try and get something working but this names the audio cue 1.wav but doesnt assign a target file.

Any ideas??

Rich Walsh

unread,
May 5, 2021, 10:06:04 AM5/5/21
to ql...@googlegroups.com
Assuming you have the folder structure a bundle would create, you can get the shared path to the enclosing folder by:

tell front workspace


-- Establish the path to the current workspace


set workspacePath to path
if workspacePath is missing value then
display dialog "The current workspace has not yet been saved anywhere." with title dialogTitle with icon 0 ¬
buttons {"OK"} default button "OK" giving up after 5
return
end if


-- Get the path that should prefix all media file paths


tell application "System Events"
set sharedPath to path of container of file workspacePath
end tell


end tell

See https://wiki.allthatyouhear.com/doku.php#import_files. There's a global (dialogTitle) in the snippet above which will break it a bit.

Rich

simon.c...@gmail.com

unread,
May 5, 2021, 10:09:57 AM5/5/21
to QLab
This makes total sense. Thanks Rich - your answers have helped me out a lot on other problems by searching this group!! Might you have an answer for me to the next stage that I have spent all afternoon googling? My audio folder is likely to be updated during the production period with new versions. I have a script that updates all the file targets (or at least looks in the audio folder for what it can find) but my issue is that say, for example, as above we have some files called 1.wav, 2.wav and 3.wav. Id like to be able to add a version name or description to the files. so the folder might actually contain "1 v3 a bit louder.wav" etc etc. Can you think of a way for Qlab to find this file just by specifying that we are looking for 1.wav. I hope this makes sense!

Rich Walsh

unread,
May 5, 2021, 10:24:04 AM5/5/21
to ql...@googlegroups.com
Have a look at this maybe: https://groups.google.com/g/qlab/c/i-QtVvvI0Os/m/7vzFiyJVAwAJ.

Also I had some stuff about shared prefixes in filenames in https://groups.google.com/g/qlab/c/q2s9myKkGF8/m/ux9TiYyuejoJ. It's very, very old and I haven't got time to fiddle with it in the near future. You may not even be able to access the code in that app release, so here's the raw script. Have a look at "Work out shared prefixes".

Rich
Batch wav interleaver v1.0.scpt
Reply all
Reply to author
Forward
0 new messages