ARGHH!! Maybe its just late?!?!

What type of scripts do you need?

Moderator: byronnash

Post Reply
pfmurphy
Posts: 6
Joined: February 18th, 2007, 3:30 am
Location: Los Angeles, CA

Lua wasn't as frustrating as this has been. Here is the deal - maybe someone can help...

In its simplest most primitive form, the script I am working on needs to access a project file stored on a server (this project would be a 'template' project of sorts for a particular show. It would include charts, mattes, LUTS etc., specific to the project. None of which has any bearing on this matter).

I have segmented and simplified the issue to a point where I can use an example from the scripting guide that will produce the same (err... actually, no result) results. See below:

[/code]
var my_file = new File ("F:\RESOURCES\compositing\SRIPTS_MACROS_PLUGINS\ae_scripts\GLOBAL\project.aep");
if (my_file.exists){
new_project = app.open(my_file);
if (new_project){
alert(new_project.file.name);
}
}

Code: Select all


Nothing happens. Heck, if I just call a function created to execute just the first if statement, nothing happens.

Occasionally, ExtendsScript spits an error saying something to the effect "F:\a completely different path\project.aep" can not be found, or is not a folder or file object. I must state that those errors are intermitent. Usually nothing happens.

What's the deal!? This should be a no brainer. Heck, what do I have to look forward to when I try and have a dynamically updated dropdownlist!!!! I'm going to bed, cauze "...if Bonnie comes home [and I am still futzin with this]... I gonna get f&%king divorved! And I don't want to get f#@king divorced!"

Assistance appreciated!
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

You could try using this script to check if you're getting the path right. This works ok for me and gives me a valid path works.

Code: Select all

{
	//var my_file = new File ("F:\RESOURCES\compositing\SRIPTS_MACROS_PLUGINS\ae_scripts\GLOBAL\project.aep"); 

	var my_file = File.openDialog("");

	if (my_file.exists){ 
		alert(my_file.absoluteURI);
		var new_project = app.open(my_file); 
		if (new_project.file != null){ 
			alert(new_project.file.name); 
		} 
	}
}
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

Would it make any difference to use forward slashes" "/" instead of the backslashes "\"? I normally stick to forward slashes with paths.
pfmurphy
Posts: 6
Joined: February 18th, 2007, 3:30 am
Location: Los Angeles, CA

Thank you! I have now created a check absolute URL function from your script. I often forget to build all the little bricks I'm going to need (or could need) before attempting to construct the house.

Regardless, your script - which is far cleaner and efficient, has enabled me to move forward. Thanks for your assistance!

RE: Byron - I can't tell you how many times in the past week your posts have saved me. Thank you for sharing your knowledge. With regards to path syntax, specifically forward vs. back slashes - I failed to mention that I am on a pc (although it is not limited to a path definition as needing to contain back slashes - eventhough this is a fairly recent development as of XP). So, I guess I have another question...are you scripting on a windows or os X platform, and if on the former (win), do you define paths with forward slashes? If so, has this been a determining factor in whether those scripts worked?

Thanks again!
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

Glad to help pfmurphy, the people on here have definitely helped me through many a job! I pretty much always keep aenhancers open when I'm scripting.

I script on WinXP but most of my scripts need to run cross platform so I end up having to build in a lot of error handling. I use forward slashes all the time since both platforms can read them. There have been a few occasions when I have to use backslashes and then it's for a dos command or something. You'll need to use double backslash it you are ever writing a batch file that needs to have a file path in it. "C:\\Directory\\file.ext"
Post Reply