Path to the current Script

Is there a way to return the pathname of the script that is running?

In the instance that you want to be able to run a script from anywhere outside of a hard drive or network by double-clicking it, but have to load files from and the Save to subfolders of the folder which the script is run, instead of hard-coding paths?

That you will get the folder of the currently executing script...

alert(File($.fileName).parent);

Tags: Photoshop

Similar Questions

  • Problem with the path of the current script and applescript

    Work in cs3 here

    Here's what I'm trying to achieve. I wrote a script in javascript, but I need the support of shell for some features. I can only run applescript shell so I'm able to run the shell script quite easily to applescript, as long as I have hard the path of the code in the applescript.

    It stops working when I get the activeScript path and then try and pass it in applescript.

    Here's what works

    < code >

    "myScript = 'do shell script \"/users/my_username/myScript.sh\' &------"------" & point 1 of arguments and return. "

    myParams = ['param1'];

    var result is doScript (myScript, ScriptLanguage.applescriptLanguage, myParams);.

    < code >

    It works fine, however I would like to have the shell script live in the same folder as the scripts Panel, so it is easier for others to install

    So here's what I tried to do

    < code >

    myScript = app.activeScript var;

    var thisPath = myScript.path + "/ myShellScript.sh";

    "' myScript =" do shell script------"" + thisPath + "------" &------"------" & point 1 arguments and return. "

    myParams = ['param1'];

    var result is doScript (myScript, ScriptLanguage.applescriptLanguage, myParams);.

    < code >

    It produced an error that says: Indesign can't find the file.

    So I tried to escape all spaces with a replacement of the chain, as follows:

    < code >

    scriptPath var = "\" "+ thisPath.replace(/%20/g,"%5C%5C%20") +" "-" '; "

    < code >

    It still does not work. I also tried to make an object file

    < code >

    scriptPath var = File (thisPath);

    < code >

    Couple other things I've tried include POSIX path in applescript, removing the additional quotes, enveloping the path in quotes.

    It did not work also. Any help would be greatly appreciated that I do not understand what I am doing wrong.

    UPDATE:

    Just after posting, I have corrected this problem. For anyone who wants to know, that's what I did

    scriptPath var = ""' + thisPath.replace(/%20/g,"\\\") "+ '" '; "

  • Get the path to the current document. Automation plugin

    How to get the path to the current document? (C++ Plugin)

    I used headset and getter - but I do not see that information.

    I understand that there is something in the opposite direction of:

    FullPathToAlias ('... filename.psd ', aliasValue);

    error = sPSActionDescriptor-> PutAlias (someDesc, keyFileReference, aliasValue);

    But how to someDesc so there is a lot of open document

    I'm sorry.

    the answer is:

    logfilename Char [MAX_PATH];

    Manage aliases.

    error = PIUGetInfo (classDocument, keyFileReference, & alias, NULL);

    AliasToFullPath (alias, & filename [0], MAX_PATH);

  • How can we get the path of the current document?

    Hello

    I want to store the path of the current document file in a string, I tried the AIDocumentSuite, and

    AIAPI AIErr(* AIDocumentSuite::GetDocumentFileSpecification) (ai::FilePath & file).

    His ended in prameter conversion error (c 2664). Can someone guide me to get the current path.

    Thanks in advance

    Farida kaid

    file ai::FilePath.

    Error AIErr is sDocument-> GetDocumentFileSpecification (line);.

    If (error! = kNoError) {}

    There was a problem
    }

  • Property path to the current step running

    Hello
    I see an "access point" error for a step property path, only when the step is a sequence that is a subsequence call.  When these properties of the stage are access from the sequence of high level (the one that is open when the pass is started), I don't get the error.  These are the same steps, copy / pasted.  The code of step module is actually labview, write values of teststand using the tool 'set the value of property.  The property path that I use is:

    ThisContext.RunState.Sequence.Main ["" "].

    When executing the step of a sous-suite called by the sequence of high level, I can put a breakpoint on the market, made a right click Navigate to the property of the step and copy / paste the above path.  If the property does not exist whether the top-level or a sous-suite.  When breakpointing in labvew on the error, I can browse the above property at the same time I get the error on also.  I see that there is, but still, I get an error.
    I guess my question is, is there a property path that can reference always reliable for the current step, no matter where it is in the hierarchy of the sequence?  I went through and all I can find is the path of the above property.

    Thank you
    David Jenkinson

    Hi Dave,.

    After talking with a co-worker of mine, we came up with a way to get the current context of the sequence in your code module.  Basically, we have the frame of the sequence of when the code module was called initially.  Then, you can use the context of the sequence to get running, allowing you to get the current thread.  Of this, you can get the context of the sequence of this thread and have access to everything you need from there.  We have created an example program that has a sequence that launches a VI that passes just a while loop and displays the current name of the sequence.  Here is a screenshot of the code module:

  • How to create editable text on the path of the perl script

    Hello

    I'm lost. I have exhausted all possible ways but nothing works. My problem is easy to describe: I have a Perl script that creates a design, and the design should be editable in artificial intelligence. Drawing text on a path (curved text - drawing is an access plan).

    Now I don't like how I do - I want to just make it work. I can create all types of file with Perl if someone tells me what it should look like.

    I tried to create a SVG file with text on a path. It works and the resulting file can be edited in an editor like Inkscape SVG, including the full text on the editability of the path. But if I import this file into Illustrator (AI 10 and CS3), the individual letters still sitting on the road, but all of them are facing up (instead of regardless of the direction of the path is). If it does not work. Then I said ok, because the SVG looks fine in Inkscape, let me just export EPS form Inkscape and use in artificial intelligence. Now the file looks good in artificial intelligence, but the text has been converted by trace himself, with each letter on its own session - not editable. Next thing I've tried generates directly from Perl, using a PathText function that I found in the Cookbook of Adobe PostScript EPS. Once again the EPS resulting looks good in artificial intelligence and the text is correct, no curves - but still a time, all the letters is its own, so if you go there with the text and tool removes a letter, it leaves a blank spot, and if you insert a letter, it replaces the next letter. Duh!

    So I tried the opposite: make a text on a path in artificial intelligence and save, with the plan to look at the file and generate what is there with my Perl script later. Unfortunately, the file saved by HAVE contains a chunk of binary garbage (be they saved as editable SVG or as file) that does not lend itself to facilitate the interpretation of yours really.

    I'm really not much. And I'm willing and able to create any type of file. Everything I need is something that I read, and which translates a text on a path that is editable in artificial intelligence.

    Does anyone have a pointer to a documentation, or existing in any programming language, source code that could help me in creating such a file?

    Thank you

    DZ

    I think you should look in the AI7FileFormat.pdf file (available many places online), specifically the pages 85 to 87 and 105 page, who speak of the operators of text, including text on a path.

    If we exclude the 4000 lines or so of boilerplate prolog and procsets, the code base for a text on a path is as simple as that:

    2 to
    1 0 0 1 - 4013.5 4715,5 0.4 Tp
    0 m 0
    0 200 400 200 400 0 c
    TP N
    0 tr
    TF/_Myriad-Roman 12
    (This text is in the path of access. \r) TX
    TO

    Record cleaning (first use cleaning brush/Style/Swatch action) file eps, version 6, and you shouldn't get any binary stuff.

  • Run the current script on computer only

    Hi all

    I am trying to build a script that is running on the active publication only... Is it possible to do?

    Thanks in advance

    I don't know what you're asking. app.project.activeItem will give you the active model (if it exists). Is that what you mean?

    Dan

  • How can I get the path to the current report of TestStand.

    I need to automatically print a report of failure of TestStand. I have implemented an automatically generated file name in TS Report Options and send it to a default directory on the hard drive. The reports are generated correctly, but on a test failure, that I want to find the name of the last file so I can print it. Does anyone know how to do?

    Thank you

    Dave

    There is a way to print until execution ends.

    http://zone.NI.com/DevZone/CDA/EPD/p/ID/5889

  • How to get the current path of file (jsx) running?

    Hello.

    I want to be saved in the path of the current running jsx file.

    Is there a way?

    Thank you.

    Hi, is it ok for you?

    It seems "app.activeScript" or "$.filename ' is what you wanted.

    #target indesign
    try {
      // not active in ESTK
      // return script path if run from ScriptPanel
      alert(app.activeScript);
    }
    catch(e){
      alert(e);
    }
    
    // return bridgetalk if run with double clicking jsx
    // return script path if run from ScriptPanel
    alert($.fileName);
    
    alert($.includePath);
    

    Thank you

    mg.

  • Get the current name of the Run Script

    Hello

    I'm looking for the name of the current script that runs in DIadem.

    So I would like to call a script, and then everything is running I would record the name of the script (file name on disk) a text box on a report that I am generating.

    I know how to pass values to the report that I am not sure to get the name of the script that runs underway.

    Thank you

    Hi Tim

    You can use the CurrentScriptName and CurrentScriptPath variables.

    I hope this helps.

    Winfried

  • additional folder added based on the current path of the vi when compiled in executable

    I found a new problem (for me) with the 'current path of vi' work today. When I compile the source code into an executable, I get a strange response from the service.

    I expect to see 'application.exe\application.vi '.  What I see is "application.exe\folder\application.vi. It's ruining my normal routines that address automatically step of removal of additional path that is required when moving between executable files and source code. I understand that I can use the "Application Directory" function and it does not solve this problem. However, as a test, I created a separate program with only the 'path of vi current' function and it worked again normally (application.exe\application.vi). There seems to be something specific to this one application that I don't understand.

    I tried a force all recompile (ctrl-shift-run arrow) and this did not help. I created a new project with the same source, and this did not help. I recorded the source under a different file name file and created a new project for this new source file and it did not help. I was using the function of the path of the current vi twice in top level vi, then I changed to use it only once and it did not help.

    I'm running out of ideas, and it is a project big enough that I really don't want to start over. The extra folder is the path to the file source vi. Any ideas on what would cause additional file information to be inserted in the path returned by the function of the current path of the vi?

    I use LV2012

    Generally, you shouldn't care how exactly screw are stored inside the EXE. If you care, this means that your code relies on it, which is a problem. What follows is general and can be inaccurate, simply because I don't like enough to actually check OK how it is:

    1. The EXE file is basically a folder zipped with the screw and the runtime of LV simply loads and works.
    2. If you use the indicator 8.x, you get a flat structure in the EXE. This is not your case, and I would not recommend it in any case.
    3. If the flag is set to false, LV basically takes all the screws that must go into the exe (static libraries dependencies and included screws) and places them in the EXE file using the same exact folder structure as code. This allows to undress and to build paths and having the code works the same way.
    4. Code that is located in the LV folder (such as the vi.lib code) is placed in a top-level called 1abv1ew folder, so it can be found.
    5. If you need to get the path of the folder, use the app dir VI.
    6. If you need to get a path to VI, use a static reference to the VI and a property node to get its path property. It works in dev and EXE.
    7. Virtual folders are not relevant (that they are not paths). AutoFill files are linked on the disk, so they do not reflect the path, but it's not really relevant. Jeff was simply pointing out that this may reflect the path and that he does not like them.
    8. Most likely your problem (since you say that something is changing) is that you are sometimes a VI that is not in the same top-level VI folder hierarchy, which then changes the top-level folder in the EXE (I'm guessing a VI of another project?). It's pretty easy to check by going to the project files tab and see if you have screws to another folder.

    I hope this helps explain, but as I said, you should generally not care on this issue. The only good reason I can think to need to know is if the paths inside the EXE exceed the limit on the length of path of the operating system, and then you start dealing with that. Except that just use the golden rule that screws inside the EXE will have the same structure as they did before, and to put you outside the EXE should use the app dir VI.

  • Windows path on the desktop of the current user

    Under MacOS ' ~ / Desktop "is the path to the current user's desktop. I would use in Windows? I tried Folder("%username%/Desktop"), but that has not worked. Any suggestions?

    You would use neither Extendscript allows instant access to the office of the current user through the predefined folder class member:

    Alert (Folder.desktop);

    Folder.Desktop is a fully functional pointer in a regular folder, as seen with

    Alert (Folder.desktop.getFiles().join("\r"));

    (see http://jongware.mit.edu/idcs5js/pc_Folder.html#desktop)

  • Open all documents in the current source Active doc

    Hey all,.

    I am writing my first script using ExtendScript. What I would like is for the script open the reference documents for all cards in the current active document.

    I think I'm pretty close, but I'm unable to find the right method to call to obtain the path to the current insert. So far, I have:

    function main()

    {

    var doc is app. ActiveDoc;

    If (! doc.) ObjectValid())

    {

    Alert ("no active document in short");

    return;

    }

    medallion of var = doc. FirstTiInDoc;

    While (in Medallion. ObjectValid())

    {

    Open the source document

    var Cheminaccesfichiersource = insert. InsetFile;           < <-this does not work

    openFile (sourceFilepath);

    move to the next box

    inset = insert. NextTiInDoc;

    }

    return ("Script complete");

    }

    function openFile (filename)

    {

    var openParams = GetOpenDefaultParams();

    var i = GetPropIndex (openParams, Constants.FS_FileIsOldVersion);

    .propVal.ival = constant .FV_DoOK openParams [i];

    I have = GetPropIndex (openParams, Constants.FS_FontNotFoundInDoc);

    openParams [i].propVal.ival = Constants.FV_DoOK;

    I have = GetPropIndex (openParams, Constants.FS_FileIsInUse);

    openParams [i].propVal.ival = Constants.FV_OpenViewOnly;

    I have = GetPropIndex (openParams, Constants.FS_AlertUserAboutFailure);

    openParams [i].propVal.ival = Constants.FV_DoCancel;

    I have = GetPropIndex (openParams, Constants.FS_LockCantBeReset);

    openParams [i].propVal.ival = Constants.FV_DoOK;

    var returnParams = new PropVals();

    var fileObj = Open (filename, openParams, returnParams);

    Return fileObj;

    }

    I tried inset. InsetFile and inset.filePath, but none work. Can someone tell me the correct syntax? Thank you!

    Try TiFile

    -Rick

  • Pass the current sequence as an argument in customize tool Menu

    Is it possible to spend the full path and file name as argument in the Menu Tools Customize?

    Basically, I have an external tool that works with a movie file, and I would like to call from the Tools menu.  It is a type of order, but I don't know what to put in the arguments.  I found a post where someone said to use '% FILE execute%', but it does not work.

    In addition, if there are other available keywords, where is this list?

    Thank you.

    Hi Richard,

    It seems that it is not a way to do it using the command type.  The problem is that you can't use an expression to specify the arguments for the executable and you use an expression to get the path of the current sequence file.

    However, you can wrap your executable in a sequence file that has only a single step; the call of your executable file.  If you place a not executable call in your sequence, you can specify the argument as the current path by using the expression RunState.InitialSelection.SelectedFile.Path.

    Add a new item in the Tools menu, and then select your sequence of wrapper.

    See you soon,.

  • set a path to the report manually by using &lt; clientfiledir &gt;

    Hi all

    I'm pretty new to teststand so please forgive me if this is an easy question.

    BACKGROUND

    I'm running a sequence (TestGroup) that contains several sequences (tests) that work as a new execution.  It allows me to produce an individual report for each test (the top-level sequence produces a summary report only).

    QUESTION

    I want each of the reports to be stored in a single folder. I have setup report options to calculate the path of the report by using the following expression "\\Reports\\\\SummaryReport [] []".".

    This works very well for the top level, but that this also applies to the subsequences path is recalculated and is different from that of the upper level.

    CURRENT SOLUTION

    I'm currently moving the report path as a parameter to test sequences, but I find the value of the macro (from the sequence of high level) to build the report path.  Can someone tell me how to get this?

    Another solution is for me to take the path of the current report and the name of the file of this band.  It's a better solution?

    Any help would be great.  Thank you

    G

    Hi Jack,

    I use a whole test sequence (seq) group and a running each of my tests as a new execution.  This means that I can apply a different template to each test (which is needed to support the old style of the previous tests developed by my client) and produce a report of individual test for each test.  Then I clear the list of results when the report was drafted and replace it with a link to the report for the test (I hope that this reduces the risk of running out of memory on long series of tests).

    Each of my 'tests' is indeed a full sequence.

    I was hoping to use something similar to macros to move the report path to each of my tests (or model for the test), but have not been able to find these values anywhere in the report options window.  Ultimately I have to now take the string generated for high level sequence 'group' and make a formatted string and then pass it as a parameter testing (an another headache that had some problems).

    I'm not really a fan of this and think it should be possibel to configure the report options different for each model, that I had to do it manually by hardcoding stuff like path .xsl etc names.

    can someone tellme if it seems like the right approach?

    G

Maybe you are looking for