Write data to the Source folder

I'm trying to change part of a script that I use for work he entered into the source of a file folder, run on rather than to a specific folder (in this case, the office).  Can someone help me understand how to change and/or by adding the code below?

create the reference to the csv file

var file = new file (Folder.desktop + "/ Data.csv");

Open the csv file in Add mode

leader. Open ("e", "TEXT", "?");

jump to the operating system in use on the line set

($.os.search(/windows/i)! = -1 ? file.lineFeed = 'windows': file.lineFeed = "macintosh";

at the end of the file

leader. Seek (0.2)

write all the information required for the csv file

Name of the document, Date1, database2, donnees3, etc.

file.writeln (decodeURI (activeDocument.Name) + ","Data1","Data2","data3"," + data4. ") ToString()', '+ Data5.toString ());

Close the csv file

leader. Close();

Now, I'm assuming that the part to change here is Folder.Desktop.  And I think I will need to change this option to be Folder.getFolderName.  getFolderName is a variable used in other code that checks the source directory of the current file.  This code of source directory, it's what I do not know how.  The script itself would have to do the check whenever it is running as I want him to be able to work with included subfolder of batch runs, make a new file in the subfolder when working with these files.  Anyone has any ideas, how to proceed?  Any help is very appreciated!

dgolberg

Edit: I forgot to mention; It would be nice if it can also store the name of the folder in which the source file is in a variable, so it can be written to the file as .csv.  This is not as important as the code mentioned above, but it would be helpful none-the-less, if possible.

No problem, I was able to solve it on my own all the time.  I thought it would be much harder than it actually was. but has been able to do by simply changing

var foldLoc = new File ("C:\\Temp\\");

var file = new file (foldLoc + "/ Data.csv");

TO

var foldLoc = app.activeDocument.path;

var file = new file (foldLoc + "/ Data.csv");

and now, it records the data and the .csv file in the same folder as the currently open project.  Thanks for trying to help; It is much appreciated.

dgolberg

Tags: Photoshop

Similar Questions

  • Write access to the active folder? Possible or not?

    Hello

    I have several JSON files in the app/native/assets/data folder that contain the data for my application. In the sources of the application, they are in the current folder / data. I read that the runtime only access to the data of the root folder will be allowed. However Simulator and device of DevAlpha I am able to write to the folder data/assets. This will be different for the production machines or has that changed?

    You can read about the various issues that are available and the restrictions on them: http://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.devguide/com.qnx.do...

    The fact that you can write in the folder now is because your application is built with a true indicator of "mode of development". Once you export as a release and sign, this indicator is disabled and that your application is installed with the application / files read-only, as described in the above page.

  • Somehow, I deleted my index.dat in the Cookies folder.

    Somehow, I deleted my index.dat in the Cookies folder.  How do I get it back and I really need?

    Hello

    • What was the location of the folder where you deleted it go?
    The index.dat file is a database file. This is a repository of information such as web URLS, search queries, and files recently opened. Its purpose is to allow quick access to the data used by Internet Explorer. For example, all visited web addresses are stored in the index.dat file, which allows to find quickly the AutoComplete match as long as the user types an Internet Explorer web address. The index.dat file is specific to the user and is open as long as a user is connected Windows. Separate index.dat files exist for the history, cache and cookies in Internet Explorer.
    The index.dat file is never resized or deleted. A large index.dat file can affect the performance.
     
    Note: The .dat extension is commonly used for data files (files that are not readable by humans and not to hold a binary based on documents). It is possible to find named "index.dat" files that are not used by Internet Explorer.
  • Can I write data to the memory of the Machine (not SD card)?

    Can I write data to the memory of the Machine no SD card?

    I know that I add data using FileConnection like this

    FileConnection fc = (FileConnection) Connector.open ("file:///SDCard/"+"da.txt", Connector.READ_WRITE);

    This is the code that write to the SD card.

    But if I want to write in the memory of BlackBerry, what path will be in the FileConnection?

    Or is it impossible to add files in the memory of BlackBerry?

    It will be something like "file:///store/home/user/".

  • Generic procedure to load the data from the source to the table target

    Hi all

    I want to create a generic procedure to load data of X number of the source table to X number of the target table.

    such as:

    Source1-> Target1

    Source2-> Target2

    -> Target3 Source3

    Each target table has the same structure as the source table.

    The indexes are same as well. Constraint are not predefined in the source or target tables.there is no involved in loading the data from the business logic.

    It would simply add.

    This procedure will be scheduled during off hours and probably only once in a month.

    I created a procedure that does this, and not like:

    (1) make a contribution to the procedure as Source and target table.

    (2) find the index in the target table.

    (3) get the metadata of the target table indexes and pick up.

    (4) delete the index above.

    (5) load the data from the source to the target (Append).

    (6) Re-create the indexes on the target table by using the collection of meta data.

    (7) delete the records in the source table.

    sample proc as: (logging of errors is missing)

    CREATE or REPLACE PROCEDURE PP_LOAD_SOURCE_TARGET (p_source_table IN VARCHAR2,

    p_target_table IN VARCHAR2)

    IS

    V_varchar_tbl. ARRAY TYPE IS VARCHAR2 (32);

    l_varchar_tbl v_varchar_tbl;

    TYPE v_clob_tbl_ind IS TABLE OF VARCHAR2 (32767) INDEX OF PLS_INTEGER;

    l_clob_tbl_ind v_clob_tbl_ind;

    g_owner CONSTANT VARCHAR2 (10): = 'STG '.

    CONSTANT VARCHAR2 G_OBJECT (6): = 'INDEX ';

    BEGIN

    SELECT DISTINCT INDEX_NAME BULK COLLECT

    IN l_varchar_tbl

    OF ALL_INDEXES

    WHERE table_name = p_target_table

    AND the OWNER = g_owner;

    FOR k IN l_varchar_tbl. FIRST... l_varchar_tbl. LAST LOOP

    SELECT DBMS_METADATA. GET_DDL (g_object,

    l_varchar_tbl (k),

    g_owner)

    IN l_clob_tbl_ind (k)

    FROM DUAL;

    END LOOP;

    BECAUSE me IN l_varchar_tbl. FIRST... l_varchar_tbl. LAST LOOP

    RUN IMMEDIATELY "DROP INDEX ' |" l_varchar_tbl (i);

    DBMS_OUTPUT. PUT_LINE (' INDEXED DROPED AS :'|| l_varchar_tbl (i));

    END LOOP;

    RUN IMMEDIATELY ' INSERT / * + APPEND * / INTO ' | p_target_table |

    ' SELECT * FROM ' | '. p_source_table;

    COMMIT;

    FOR s IN l_clob_tbl_ind. FIRST... l_clob_tbl_ind LAST LOOP.

    EXECUTE IMMEDIATE l_clob_tbl_ind (s);

    END LOOP;

    RUN IMMEDIATELY 'TRUNCATE TABLE ' | p_source_table;

    END PP_LOAD_SOURCE_TARGET;

    I want to know:

    1 has anyone put up a similar solution if yes what kind of challenges have to face.

    2. it is a good approach.

    3. How can I minimize the failure of the data load.

    Why not just

    create table to check-in as

    Select "SOURCE1" source, targets "TARGET1", 'Y' union flag double all the

    Select "SOURCE2', 'TARGET2', 'Y' in all the double union

    Select "SOURCE3', 'Target3', 'Y' in all the double union

    Select "SOURCE4', 'TARGET4', 'Y' in all the double union

    Select 'Source.5', 'TARGET5', 'Y' in double

    SOURCE TARGET FLAG
    SOURCE1 TARGET1 THERE
    SOURCE2 TARGET2 THERE
    SOURCE3 TARGET3 THERE
    SOURCE4 TARGET4 THERE
    SOURCE.5 TARGET5 THERE

    declare

    the_command varchar2 (1000);

    Start

    for r in (select source, target of the archiving of the pavilion where = 'Y')

    loop

    the_command: = "insert / * + append * / into ' |" r.Target | ' Select * from ' | '. r.source;

    dbms_output.put_line (the_command);

    -execution immediate the_command;

    the_command: = 'truncate table ' | r.source | "drop storage."

    dbms_output.put_line (the_command);

    -execution immediate the_command;

    dbms_output.put_line(r.source ||) 'table transformed');

    end loop;

    end;

    Insert / * + append * / into select destination1 * source1

    truncate table SOURCE1 drop storage

    Treated SOURCE1 table

    Insert / * + append * / to select TARGET2 * in SOURCE2

    truncate table SOURCE2 drop storage

    Treated SOURCE2 table

    Insert / * + append * / into select target3 * of SOURCE3

    truncate table SOURCE3 drop storage

    Treated SOURCE3 table

    Insert / * + append * / into TARGET4 select * from SOURCE4

    truncate table SOURCE4 drop storage

    Table treated SOURCE4

    Insert / * + append * / into TARGET5 select * from source.5

    truncate table source.5 drop storage

    Treated source.5 table

    Concerning

    Etbin

  • How to validate the data in the source

    Hi all


    I am new to ODI, in my process could be called in 2 modes of Validation and load

    a. validation - V - should perform validation on the data from the source according to the filter criteria
    b. load - L - could make a mandatory check and load the data into the target table

    My concern is how do only validation on data sources, please share any ideas on this...


    Thanks in advance...

    Dragging data store in the package in order to apply the static control, you are doing your validation without loading.
    This validation step will copy the invalid data in the table of errors (E$) and you can also decide if you want to remove from the source (and keep the data only in the error table).

  • Plan the work that runs according to max date in the source to create table

    Hi all

    I am trying to create an automation in my sql. Basically, I have a table I do reporting and analysis on which is a subset of records from a source table. For the purposes of this example, I called the source table "src_table" and my table as the target table, "tgt_table." Essentially the source table gets updated with a value again months from date (founded order_dt) and I have a procedure I call when the source table is updated to load the value of the new month of records in my target table. So let say June 2012 data is loaded in the source table, I call my procedure that has a date parameter and enter June 2012 as the point of departure date so that it looks for new records in the source table from June 1, 2012 and load it into my target table. For variety reasons I won't get in, my goal in a position is not a view, there must be a stand alone table. The problem is that the source never table gets updated at the same speed interval... sometimes they will load a new months of data at the beginning of the following month, sometimes medium of the month... sometimes I have to wait a few months to get another month of data. So, whenever I get a email notification telling me another month of data is loaded in the source table, I have a windows batch file that runs my setting... I just have to change the start date (based on the order_dt column) and run it. I want to do is automate the process so that I did not yet do. What do I think creates a task that runs every day or even at the end of each month, this work has basically seized the date of maximum order of the source table and if the date of the order is greater than the maximum order date in my target table, it runs my procedure that loads the new month with a value of data in my target table. Thus, for example, my maximum order of my target table date is May 31, 2012. The work runs at a certain period of time and check the maximum date on the source table, if the maximum date is May 31 nothing happens... new data has not been loaded so does not perform the procedure. If the maximum date on the source table is June 30, 2012, the maximum date is greater than the maximum in my table target date so that the procedure runs. I need also the procedure to insert records into the table in the source where the order date in the source table is > = at the time of maximum order in the target table.

    In a Word, this is what I need but I'm not sure how to put in place. The procedure works fine... all I need is an interim procedure that runs as a scheduled task every x number of days and the date of maximum order check on the source table if it exceeds the maximum order on my table of target date it runs my procedure. My procedure is called "insert_new_orders" and when I run it I run it like:

    execute insert_new_orders('01-jun-2012');

    If anyone can help me with what would be great :-)

    Thank you
    Ed

    To start:
    You must remove the EXECUTE keyword.

  • Write access to the assets folder

    I have DB SQLite file liabilities. When I deploy I simply open the connection in the current folder.

    In the docs it says assets folder is a single reading file and app must copy the files that need to be writable in the application data directory in the current folder.

    However on Simulator and dev alpha I simply open the connection to db file in the current folder and are able read/change data in the db file and the changes are persisted between application restarts.

    Will be this change in behavior on an actual release or am I missing something?

    What you see is only a convenience for certain types of use during development. Signed apps do NOT have writing anywhere inside their "app" folder, which includes the current folder. You * must * copy of data / first launch, if you want to make changes to these files. Alternatively, implement a mechanism of "copy on write" if only the files that have been changed in fact never get copied, of course, which is more complicated.

  • Limit the data in the source.

    Hi all

    I want to use the "Sample" oracle on my Db source clause, which is an oracle db. I want to limit the amount of data that I bring this moment in my target, which is another source of Oracle.

    I don't know where I have to specify this condition "Sample (10)", while only 10% of the sample source data is extracted? Can I do this using ODI?

    Kindly let me know.

    Kind regards
    John

    Ok...

    It's so simple as:

    (1) duplicate the LKM

    (2) rename the double (I named my as LKM SQL for SQL - sample)

    (3) right-click on the LKM and choose "insert."

    (4) use the following values in the new window option:

    Name: USE_SAMPLE
    Value type:
    Description: write the simple value of % (for example: 35)

    Do not write to the "Default value" TextBox. The other fields are informative.

    (5) change step 31 (Load Data) since the LKM and go to the tab "Source on command.

    (6) add the following code as the last line of pending order:

    <% if (!odiRef.getOption("USE_SAMPLE").equals("")) {%> SAMPLE (<%=odiRef.getOption("USE_SAMPLE")%>) <%}%>

    (7) in the interface, edit the real LKM to the new

    8) go to USE_SAMPLE option and set the value you want.

    It works for you?

    Cezar Santos
    http://odiexperts.com

  • How to write data from the acquisition of data in NetCDF format?

    I connect to a set of data from the sensor through the DAQ assistant and want to write all data in NetCDF format. I have the required plugins installed, but still can not find how to do this.

    Or the labview can only read the netcdf files, but cannot write it! Please let me know if there is any other way out. I have looked everywhere but could not find something useful!

    Thank you

    Hey,.

    Sorry, the sheet in effect only allows to read NetCDF files, not writing to the NetCDF format.

    Kind regards

    -Natalia

  • write data to the cell in excel

    Hello

    I am trying to write data to a cell in excel. When I'm looking in sample program, I felt a bit difficult to understand.

    I have written code to read data from a particular cell that works well. I am facing difficulties in writing data in the cell. pls help someone.

    to read a data cell that works

    status is Excel_RangeGetItem (rangeHandle, NULL, CA_VariantInt (i + 1), CA_VariantInt (j + 1), & MyVariant);.
             
    Get the pointer of SHIPPING
    status = CA_VariantGetDispatch (& MyVariant, & MyDispatch);
               
    Create a Range object pointer for SHIPPING
    status = CA_CreateObjHandleFromIDispatch (MyDispatch, 0, & ExcelSingleCellRangeHandle);
               
    Get the value of the range of simple cells
    status = Excel_GetProperty (ExcelSingleCellRangeHandle, NULL, Excel_RangeValue2, CAVT_VARIANT, & MyVariant);
              
    status = CA_VariantGetCString (& MyVariant, &val);)
    strcpy (CellValue, Val);

    to write data in a cell

    status is Excel_RangeSetItem (rangeHandle, NULL, CA_VariantInt (i + 1), CA_VariantInt (j + 1), MyVariant);.
             
    status = CA_VariantSetDispatch (& MyVariant, & MyDispatch);
               
    status = CA_CreateObjHandleFromIDispatch (MyDispatch, 0, & ExcelSingleCellRangeHandle);
       
    status = Excel_SetProperty (ExcelSingleCellRangeHandle, NULL, Excel_RangeValue2, CAVT_VARIANT, & MyVariant);
             
    status = CA_VariantSetCString (& MyVariant, writedata);

    I know I made a mistake in the code above.

    Thank you very much, Roberto. You have solved my problem.

  • How do you use the freqout as the sample clock to write data on the of 6224 PCI

    Using PCI-6224, I try currently to export data using the freqout as a reference clock sample to a digital output channel. I plug the scope to see the clock on the freqout PIN. However, the data seem to be missing. How can I output the data correctly using the reference for timing? What am I missing that connects the two signals together? Any help would be greatly appreciated. I am writing this code in MS VS C++ and here's what I've done so far:

            int32       error=0;
            TaskHandle  taskHandle=0;
            TaskHandle  taskHandleFRQ=0;
            char        errBuff[2048]={'\0'};
        uInt8       data[8]={1,0,1,1,1,0,1,0};
    
        /*********************************************/
        // DAQmx Configure Clock
        /*********************************************/
        DAQmxErrChk (DAQmxCreateTask("",&taskHandleFRQ));
        DAQmxErrChk (DAQmxCreateCOPulseChanFreq(taskHandleFRQ,"Dev2/freqout","",DAQmx_Val_Hz/*Units*/,DAQmx_Val_Low/*IdleState*/,0/*Delay*/,10000/*Freq*/,0.5/*DutyCycle*/));
        DAQmxErrChk (DAQmxCfgImplicitTiming(taskHandleFRQ,DAQmx_Val_ContSamps,8));
    
        /*********************************************/
        // DAQmx Configure Digital Output
        /*********************************************/
        DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
        DAQmxErrChk (DAQmxCreateDOChan(taskHandle,"Dev2/port0/line0","",DAQmx_Val_ChanPerLine));
        DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"/Dev2/PFI14",10000,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,8));
    
        /*********************************************/
        // DAQmx Write Code
        /*********************************************/
        DAQmxErrChk (DAQmxWriteDigitalLines(taskHandle,8,0,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL));
    
        /*********************************************/
        // DAQmx Start Code
        /*********************************************/
        DAQmxErrChk (DAQmxStartTask(taskHandleFRQ));
        DAQmxErrChk (DAQmxStartTask(taskHandle));
    

    I think that the original code was operational. However, given that the data transmission has been set to finished, I had a hard time to visualize the data on my scope. By changing the value of DAQmx_Val_FiniteSamps to DAQmx_Val_ContSamps, I could easily see the data.

    My mistake. I'm still learning here. Thanks for the time.

  • When I add a new file in a subfolder (folder in a folder) by using Solution Explorer, the 'date modified' in the subfolder is updated, however the "modification date" in the main folder is not changed.

    Is it possible to have the update of the main folder his "change date" when I change the contents of a subfolder?  I use VISTA.

    I don't know how to program so if you have a solution, I need step by step instructions.

    Thank you very much for your help.

    Donaldo

    This forum is dedicated to the issues of Windows 7.  To ask a question of Windows Vista, go to this page:

    http://answers.Microsoft.com/en-us/Windows/default.aspx#tab=3

    Furthermore, the parent folder (and her mother and so on) are not changed when the contents of a grandchild (or below) is updated, so their timestamp will not change.

    If it solves your problem, click on the link "Propose as answer" below and vote as useful by clicking on the green triangle for the lelft. Thank you!

  • How to write data to the XML in VBA 6

    Hello

    I am using vba 6

    I have different data like strings, integer etc I get the object group tag.

    I want to write data of XML on the button click.

    and save this file on the way to my pc.

    Bad forums. Message here:

    MSDN - MSDN forums - Microsoft

  • How to write data at the end of the doc in sense the other way around? [CS6 - jsx]

    I need to move all the entries in my texts spec at He end of the doc. To keep the correct reference overall found entries that I have to deal with in reverse order

    for (i = mFound.length - 1; i > = 0; i--) {}

    .. .etc

    but to invent, how to place entries cannot write off at the end.

    String:

    mStory.insertionPoints.item(-1).select ();

    App.Paste ();

    does not work properly (of course). It does this:

    10.

    9.

    8.

    7.

    6.

    .. .etc

    How to get

    1.

    2.

    3.

    4.

    .. .etc

    ?

    Dmitry,

    Well, I've been basically dealing with moving the notes at the end of the story in the correct order. Anyway, concerning the figures by exposing, there no need to choose things and remove these selections. She considered more safe, like Vamitul too mentioned, to work on the objects. To manage numbers superscript, I would do this:

    app.findGrepPreferences = null;
    // Search just the note contents: lookaround leaves the braces in the text
    app.findGrepPreferences.findWhat = /(?<=\{\{\{).+?(?=\}\}\})/.source;
    found = app.documents[0].findGrep();
    
    for (i = 0; i < found.length; i++){
        found[i].parentStory.insertionPoints[-1].contents = '\r' + String (i+1) + '.\u2003';
        found[i].move (LocationOptions.after, found[i].parentStory.insertionPoints[-1]);
    }
    
    // Now search {{{}}}
    app.findGrepPreferences.findWhat = /\{\{\{\}\}\}/.source;
    found = app.documents[0].findGrep();
    for (i = found.length-1; i >= 0; i--){
        found[i].contents = String (i+1);
        found[i].position = Position.SUPERSCRIPT;
    }
    

    Then first move the notes at the end of the story, leaving behind all the triples of braces. Then, after you have moved the notes, do you a new search on the sextets of braces. Only select and delete, just redefine the content of what you have found and apply an in shape.

    Peter

Maybe you are looking for