Copy link to clipboard
Copied
I'm interested in developing a front end search and cataloging application in LiveCode which would use use Bridge as a helper app to view files in folders. This is all on Mac OSX. (well actually it woudl work on Windows too...)
the bottom line simple question is simply this:
Can anyone give me a script to open a folder in Bridge, where that script has the path to that folder embedded in the script itself? And, for this "OpenFolder.js" be an external file that is fired by Mac OSX itself?
---------- Details
My LiveCode's app'sjob is pretty simple: look things up using "locate" from the shell to access the locate database. When the user finds a file that he or she wants, then we want to offer the option to have the enclosing folder be opened in Bridge. My LiveCode Desktop app is kind of like an uber traffic manager, search widget, with Bridge server as the primary catalog/viewing mechanism. I don't see the need to re-invent the wheel and build a whole new catalog viewer app in LiveCode when Bridge is there already doing a superior job filling this function.
In the past my interapp communications have all been done with apple script. "open folder" "reveal in finder" etc. are the typical things we call from LiveCode with Applescript
But Bridge will only do Java script. My methodis typically to store the script as a custom property in my LiveCode app. with a replacement string..
So my app gets a path to a folder... typically on our digital assets, archives server. e.g.
put "/Volumes /OSXServer/Digital Photos/2013/June Archives/" into tPath
Now, where the Finder is my help app, I would call this property into a variable:
put the uAppleScriptOpenDbaseRecord of this stack into tAppleScript
Where tAppleScript is a string:
tell application "Finder"
reveal alias "###Folder###"
activate
end tell
then, in LiveCode
replace "###Folder###" with tPath in tApplescript
do tAppleScript as AppleScript
But... Bridge only uses Javascript and LiveCode cannot execute Javascript, but he can launch files in the default app that is bound to the file extension. So, I think (hope) if the Javascript is stored as an external file I can write out the required script dynamically to /tmp with the path and then, I hope, do this
Launch "/tmp/openInBridge.js" and Mac OSX will (if the JS requests it correctly) run the java script and open the folder in Bridge.
So again, I'm looking for a simple JS that launches a folder in Bridge where the script has the path to that folder. I want to write this script out dynamically from one app, and have OS X take over fire it to open in Bridge.
Any one have such a script?
1 Correct answer
If you are using AppleScript you will be happy to find the Bridge does have a single command that you can make use of…
set myPath to POSIX path of (path to documents folder as text)
set openFolder to "app.browseTo( '" & myPath & "');"
tell application "Adobe Bridge CS5"
activate
do javascript openFolder
end tell
Copy link to clipboard
Copied
If you are using AppleScript you will be happy to find the Bridge does have a single command that you can make use of…
set myPath to POSIX path of (path to documents folder as text)
set openFolder to "app.browseTo( '" & myPath & "');"
tell application "Adobe Bridge CS5"
activate
do javascript openFolder
end tell
Copy link to clipboard
Copied
Jai Ganesha! Fantastic... tested and it works
set myPath to POSIX path of ("/Volumes/Varuna/TAKA/Bangalore-Iraivan-July-2013/2013_07_16_Iraivan_05")
set openFolder to "app.browseTo( '" & myPath & "');"
tell application "Adobe Bridge CS6"
activate
do javascript openFolder
end tell
And here I thought I was going to have to go download the SDK for Bridge JS scripting for this simple task. Thank you!
Copy link to clipboard
Copied
I think it was introduced with CS5… You would need to check if you need this for anything earlier… You could also write *.jsx file on the fly and try execute it but this soloution is much easier IMO… If you need to do anything with Bridge then you will need to learn some ExtendScript… Glad it helped anyhows…

