Open folder in script

How simple open folder with scripting
I tryed this - not workable

var file = new File(“C:/1”);
file.open(FileAccess.ReadOnly);

no access

tryed something like

DesktopServices.openUrl(“C:/1”);

can not understand how open folder with exploer

Method 1 using QT:

var mydialog = new QFileDialog;
mydialog.exec();

Method 2 (per the software documentation’s scripting section)

QFileDialog.getOpenFileName();

Hello. Can i open explorer folder (Window OS) with scene using scripts?

rkriz Thank You. But it is for open scene file.
I asked the wrong question, let me explain more.

I work in a small studio.
Working in the program we often use function “export QuickTime Movie (file_my_scene.mov)” to see and check the animation, because the function “Render and Play” is inconvenient for this. To run the file, I need to find it and open it in explorer.

Can i run “file_my_scene.mov” using script or open explorer window where i can run this file.

Hi !

To open a specific folder you can store the path in a variable and do :
"
var pth = “C:\Users\eAthis\Documents\TOONBOOM\bacAsable”; \ double the backslashes for Windows or simple slash for IOS
FileDialog.getExistingDirectory(pth);
"

You can also directly the open the exported .mov :

"
var start = Process2(“C:\Program Files (x86)\QuickTime\QuickTimePlayer.exe”, “C:\Users\UserName\Desktop\Export.mov”);
start.launchAndDetach();
"
First create a Process with the path of the application and the path of the file, then launch the process. I recommand you to “launchAndDetach” so that Harmony won’t focus on Quicktime. Means that you can still do something while waiting for Quicktime to open.
https://docs.toonboom.com/help/harmony-15/scripting/script/

Hope it helps

eAthis

eAthis Thank you very much!

but there is a small problem, if i use

var My_Path = scene.currentProjectpath();

var My_Mov = (My_Path+".mov");

var start = Process2(“C:\Program Files (x86)\QuickTime\QuickTimePlayer.exe”, My_Mov);

i get My_Mov = “C:/1/Test.mov” but it should be “C:\1\Test.mov”

how to get project path with double slash?

Hi,

I guess you can do something like :

var My_Path= scene.currentProjectPath();

var My_Correct_Path = My_Path.replace(///g, “\”);

var My_Mov = (My_Correct_Path +".mov");

var start = Process2(“C:\Program Files (x86)\QuickTime\QuickTimePlayer.exe”, My_Mov);

Tell me if it fixed it.

eAthis

Thank you eAthis! it fixed!

Glad it helped !

Enjoy and spread it !

eAthis