Skip to main content
Participating Frequently
July 25, 2013
Question

Expression Get Project Path or Name

  • July 25, 2013
  • 3 replies
  • 11466 views

Hi,

I am new to After Effects as in I have just seen it for the first time today!

What I'd like to know is, is it possible to write an expression to return either the current project name or file path?

I'm assuming no as I cannot find any reference to this in the language reference. How would I go about integrating a script with the project to return the project name?

I have tried something basic like:

Expression code:

var currpath = $.evalFile(filepath);

filepath is the path to my script file, the script is like the below:

GetPath()

function GetPath() {

return app.project.name;

}

With this I get an error similar to method name 'Global' not found - not at my work computer so can't remember the exact message.

Any help would be appreciated.

Thanks,

Mark

This topic has been closed for replies.

3 replies

Giu Camblor
Participant
November 17, 2021

I think this must work... (on Mac 😉 )

 

projectPath = thisProject.fullPath.split("/").length;

projectName = thisProject.fullPath.split("/")[projectPath - 1];

 

Cheers!

Exuberant_inventor0D4E
Participating Frequently
July 28, 2022

Yes!
And for Windows replace

"/" with "\\"

Thank you!

Inspiring
July 25, 2013

Simple !

app.project.file

Legend
July 25, 2013

I thought he was trying to do so through an expression though.

Participating Frequently
July 26, 2013

Hi,

Yes I'm trying to do it through an expression.

Essentially what I am doing is creating videos on the fly with bits of information being added to placeholders throughout the video, AE only allows absolute paths for these though.

If it can't be done as an expression, how would I get a script to return the project name to an expression? I have tried running a script using the evalFile() method but this seems to execute the script WITHIN the expression and hence fails as expressions don't have such functions as app.project etc etc. Is it possible to include a script in a project and call it directly in the expression. So if I had a script with a method called getFile(), could I add that script to the project and call it within an expression?

Mark

Legend
July 25, 2013

Doesn't look like it's directly accessible. The top level properties and methods came back as:

PROPERTIES:

          name

          numEntries

          numProperties

          propertyIndex

          active

          enabled

>Global

          this_comp

          this_layer

          this_property

          thisComp

          time

          color_depth

          colorDepth

<

>Vector Math

>Random Numbers

>Interpolation

>Color Conversion

>Other Math

>--------

>Layer

>Sub-objects

          source

>General

          width

          height

          index

          parent

          has_parent

          in_point

          out_point

          start_time

          has_video

          has_audio

          hasParent

          inPoint

          outPoint

          startTime

          hasVideo

          hasAudio

          audio_active

          audioActive

>Properties

          anchor_point

          anchorPoint

          position

          scale

          rotation

          opacity

          audio_levels

          time_remap

          audioLevels

          timeRemap

          marker

>3D

          orientation

          rotationX

          rotationY

          rotationZ

          castsShadows

          casts_shadows

          lightTransmission

          light_transmission

          acceptsShadows

          accepts_shadows

          acceptsLights

          accepts_lights

          ambient

          diffuse

          specularIntensity

          specular

          specularShininess

          shininess

          metal

>Space Transforms

          __proto__

METHODS:

propertyGroup

comp

footage

posterize_time

posterizeTime

timeToFrames

framesToTime

timeToTimecode

timeToNTSCTimecode

timeToFeetAndFrames

timeToCurrentFormat

add

sub

mul

div

clamp

dot

cross

normalize

length

look_at

lookAt

seed_random

seedRandom

random

gauss_random

gaussRandom

noise

linear

ease

ease_in

ease_out

easeIn

easeOut

rgb_to_hsl

hsl_to_rgb

rgbToHsl

hslToRgb

degrees_to_radians

radians_to_degrees

degreesToRadians

radiansToDegrees

sourceTime

effect

mask

sampleImage

to_comp

from_comp

to_world

from_world

to_comp_vec

from_comp_vec

to_world_vec

from_world_vec

from_comp_to_surface

computePSDRoll

world_position_to_psd

world_rotation_to_psd

world_scale_to_psd

toComp

fromComp

toWorld

fromWorld

toCompVec

fromCompVec

toWorldVec

fromWorldVec

fromCompToSurface