Setting an Active Document

I am trying to set a particular doc as the active document after it and another one is opened after the user browses for two files.
Below I have a function that occurs when a button is pressed. Most of the code is for the file browser that is platform specific. In the middle of this block of code, the document that is chosen will set the path of a variable that is declared outside of the function. That outside-declared variable is called "singTemp". At the very last line of the code below, I added the code that I have seen in an example. The active document property is set to the value of the variable "singTemp". Thanks for your help.
var singTemp;
defineVars.inputDataPnl.singleTemplateBtn.onClick = function singleTemplateSelect() {
var SingleTemplate = getDocFile();
if (SingleTemplate == null) return;
function getDocFile() {
// cross-platform document file selector
if (File.fs == "Windows") {
var select = "Photoshop File :*.psd, *.PSD"
} else {
var select = filterFiles
SingleTemplate = File.openDialog("Choose the Single Mugshot Key Template", select);
if (SingleTemplate == null) {
// No further action
}else {
singTemp = new File(SingleTemplate);
return SingleTemplate;
function filterFiles(file) {
while (file.alias) {
file = file.resolve();
if (file == null) { return false }
if (file.constructor.name == "Folder") return true
var extn = file.name.toLowerCase().slice(file.name.lastIndexOf("."));
switch (extn) {
case ".psd" : return true;
case ".PSD" : return true;
default : return false;
app.activeDocument = singTemp;

Thanks very much! Now to try to get my head around all this...

Similar Messages

  • Is there a script to create a button to set an activated frame to document size + bleed?

    Please see my question above. Thanks in advance!

    Here is a script that creates a script that creates a button that sets an activated frame to document size + bleed.
    Why do you need a script to create a button that sets an activated frame to document size + bleed? You might as well have a script that sets an activated frame to document size + bleed, because you already need to double-click the script that sets an activated frame to document size + bleed and so there is no need to show another button that you can click to set an activated frame to document size + bleed in that.
    theScript = 'var w = new Window("dialog", "Reframe");\n'+
    'w.b = w.add("button", undefined, "Click me!");\n'+
    'w.b.onClick = function(){ w.close(3); };\n'+
    'if (w.show() == 3)\n'+
    '{\n'+
    'dp = app.activeDocument.documentPreferences;\n'+
    'app.selection[0].geometricBounds = [\n'+
    'app.layoutWindows[0].activePage.bounds[0]-dp.documentBleedTopOffset,\n'+
    'app.layoutWindows[0].activePage.bounds[1]-dp.documentBleedBottomOffset,\n'+
    'app.layoutWindows[0].activePage.bounds[2]+dp.documentBleedInsideOrLeftOffset,\n'+
    'app.layoutWindows[0].activePage.bounds[3]+dp.documentBleedOutsideOrRightOffset];\n'+
    writeFile = new File (app.activeScript.parent+'/new script.jsx');
    writeFile = writeFile.saveDlg( 'Save script', File.fs == "Windows" ? "Script:*.jsx,All files:*.*" : function(file) { return file instanceof Folder || (!(file.hidden) && file.name.match(/\.jsx$/i)); } );
    if (writeFile != null && writeFile.open("w"))
      writeFile.encoding = "utf8";
      writeFile.write (theScript);
      writeFile.close();

  • ALC-DSC-000-000 on a "Set Value" activity

    I have in my form some hidden  fields I want to set in the process, before user assignement. For this, I use the Set Value activity.
    But when I tried to set a field of my form with a value, I got this error:
    Internal error.: ALC-DSC-000-000: com.adobe.idp.dsc.DSCRuntimeException: Internal error.
         at com.adobe.idp.dsc.util.CoercionUtil.toDOMDocument(CoercionUtil.java:683)
         at com.adobe.idp.dsc.util.CoercionUtil.toDOMDocument(CoercionUtil.java:688)
         at com.adobe.idp.dsc.util.CoercionUtil.toType(CoercionUtil.java:974)
         at com.adobe.workflow.datatype.CoercionUtil.toType(CoercionUtil.java:168)
         at com.adobe.workflow.datatype.runtime.impl.pojo.POJODataTypeNode.getBoundValue(POJODataTypeNode.java:71)
         at com.adobe.workflow.datatype.runtime.impl.xml.XMLDataTypeNode.replaceContent(XMLDataTypeNode.java:267)
         at com.adobe.workflow.dom.InstanceElement.replaceContent(InstanceElement.java:241)
         at com.adobe.workflow.pat.service.PATExecutionContextImpl.setProcessDataValue(PATExecutionContextImpl.java:806)
         at com.adobe.workflow.pat.service.PATExecutionContextImpl.setProcessDataWithExpression(PATExecutionContextImpl.java:374)
         at com.adobe.idp.workflow.dsc.service.SetValueService.execute(SetValueService.java:54)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
         at java.lang.reflect.Method.invoke(Method.java:618)
         at com.adobe.idp.dsc.component.impl.DefaultPOJOInvokerImpl.invoke(DefaultPOJOInvokerImpl.java:118)
         at com.adobe.idp.workflow.dsc.invoker.WorkflowDSCInvoker.invoke(WorkflowDSCInvoker.java:153)
         at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor.java:140)
         at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
         at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(TransactionInterceptor.java:74)
         at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.execute(EjbTransactionCMTAdapterBean.java:342)
         at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.doSupports(EjbTransactionCMTAdapterBean.java:212)
         at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EJSLocalStatelessEjbTransactionCMTAdapter_caf58c4f.doSupports(Unknown Source)
         at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(EjbTransactionProvider.java:104)
         at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor.intercept(TransactionInterceptor.java:72)
         at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
         at com.adobe.idp.dsc.interceptor.impl.InvocationStrategyInterceptor.intercept(InvocationStrategyInterceptor.java:55)
         at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
         at com.adobe.idp.dsc.interceptor.impl.InvalidStateInterceptor.intercept(InvalidStateInterceptor.java:37)
         at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
         at com.adobe.idp.dsc.interceptor.impl.AuthorizationInterceptor.intercept(AuthorizationInterceptor.java:132)
         at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
         at com.adobe.idp.dsc.interceptor.impl.JMXInterceptor.intercept(JMXInterceptor.java:48)
         at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)
         at com.adobe.idp.dsc.engine.impl.ServiceEngineImpl.invoke(ServiceEngineImpl.java:115)
         at com.adobe.idp.dsc.routing.Router.routeRequest(Router.java:118)
         at com.adobe.idp.dsc.provider.impl.base.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:91)
         at com.adobe.idp.dsc.provider.impl.vm.VMMessageDispatcher.doSend(VMMessageDispatcher.java:215)
         at com.adobe.idp.dsc.provider.impl.base.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:57)
         at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:208)
         at com.adobe.workflow.engine.PEUtil.invokeAction(PEUtil.java:724)
         at com.adobe.workflow.engine.SynchronousBranch.handleInvokeAction(SynchronousBranch.java:465)
         at com.adobe.workflow.engine.SynchronousBranch.execute(SynchronousBranch.java:862)
         at com.adobe.workflow.engine.ProcessEngineBMTBean.continueBranchAtAction(ProcessEngineBMTBean.java:2773)
         at com.adobe.workflow.engine.ProcessEngineBMTBean.asyncInvokeProcessCommand(ProcessEngineBMTBean.java:704)
         at com.adobe.workflow.engine.EJSLocalStatelessadobe_ProcessEngineBMTEJB_7d3cbd67.asyncInvokeProcessCommand(Unknown Source)
         at com.adobe.workflow.engine.ProcessCommandControllerBean.doOnMessage(ProcessCommandControllerBean.java:156)
         at com.adobe.workflow.engine.ProcessCommandControllerBean.onMessage(ProcessCommandControllerBean.java:99)
         at com.ibm.ejs.container.MessageEndpointHandler.invokeMdbMethod(MessageEndpointHandler.java:1014)
         at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:747)
         at $Proxy0.onMessage(Unknown Source)
         at com.ibm.ws.sib.api.jmsra.impl.JmsJcaEndpointInvokerImpl.invokeEndpoint(JmsJcaEndpointInvokerImpl.java:201)
         at com.ibm.ws.sib.ra.inbound.impl.SibRaDispatcher.dispatch(SibRaDispatcher.java:768)
         at com.ibm.ws.sib.ra.inbound.impl.SibRaSingleProcessListener$SibRaWork.run(SibRaSingleProcessListener.java:584)
         at com.ibm.ejs.j2c.work.WorkProxy.run(WorkProxy.java:419)
         at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
    Caused by: ALC-DSC-119-000: com.adobe.idp.dsc.util.InvalidCoercionException: Cannot coerce object: [B@10e410e4 of type: [B to type: interface org.w3c.dom.Document
         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
         at com.adobe.idp.dsc.util.DOMUtil.parseDocumentFromString(DOMUtil.java:167)
         at com.adobe.idp.dsc.util.DOMUtil.parseDocumentFromString(DOMUtil.java:129)
         at com.adobe.idp.dsc.util.DOMUtil.parseDocumentFromStream(DOMUtil.java:235)
         at com.adobe.idp.dsc.util.CoercionUtil.toDOMDocument(CoercionUtil.java:670)
         ... 54 more
    It seems to be an xml parsing problem. Maybe a mistake in the xml schema of my form? For the moment, I don't see any mistake in my schema.
    Any idea?

    Here is a screenshort of the part of my workflow:
    In the mappings of the "Set Value" activity, I have one line with those properties:
    Location: /process_data/bonusValidationForm/object/data/xdp/datasets/data/BonusValidationForm/buMan agerID
    Expression: /process_data/currentUser/object/@userId
    Where:
    bonusValidationForm is a process variable of my workflow that point my xdp form
    buManagerID is the textfield I want to set
    currentUser is a process variable (type User) that was well setted by the task Find BU Manager

  • How to activate the illustrator active document?

    I have developed a javascript using pathItems for to validating the .eps file. If i run the script via "illustrator cs3", at the time of script(.js) running
    stage, the illustrator active document goes to deactivate mode(not visible like hanging). After running the script, the document comes to an active mode like default view. I need to activate that illustrator active document(like default view) during the script running stage. Kindly advise me the possibilities and solution via scripting. This is for windows operating system.

    You probably set up your main dialog window in "dialog" mode - dialogs are modal which means that they are exclusive and block everything else. You probably want a "window" type. See JavaScript tools guide CS3 page 97
    example:
         var mainWindow = new Window("window",undefined,"This is the window title");
         mainWindow.add("statictext",undefined,"this is some static text inside the window");
    Cheers,
    Mike

  • Archive an Activity document using Status

    HI All,
       In my project we are creating segmentation based on the activity created date. We generate call list of all customers who has an activity document.if the activity status is set to cancelled  the system should not select the document when creating the segmentation based on activity created date.
    with regards,
    Selvam T

    Hi Lashan,
    This error is mostly related to ADS configuration.
    Refer below thread to confirm the same.
    http://scn.sap.com/thread/3504365
    Regards,
    Ravi

  • Move Files from one document set to another document set using workflow

    Hi All,
    Env : SP 2013 Server - SPD 2013.
    I'm trying to make a SPD Workflow that must copy a  files from one Document Set to another Document set in the same library other document library  
    Does Someone already get success for Copy  files from one Document Set to another Document set?
    Thanks for your help.

    Hi,
    According to your post, my understanding is that you wanted to move Files from one document set to another document set using workflow.
    I recommend to use the custom workflow activity  Copy List Item Extended Activityto
    copy files to another document set.
    You can do this with codeless SharePoint Designer workflows as long as you can install the
    Codeplex Custom SharePoint Designer Workflow Activities. 
    These activities are also built-in to SPD2013. However, you can only use the custom activities in the SharePoint 2010 Platform.
    To install the custom activities, please follow the steps as below:
    Download the solution file form
    Useful Sharepoint Designer Custom Workflow Activities
    Copy the wps file to the Disk C.
    Open the SharePoint 2013 Management Shell.
    Run the command: add spsolution c:\ dp.sharepoint.workflow.wsp
    Open the Center Administration, click System Setting->Manage Farm Solution-> dp.sharepoint.workflow.wsp->Deploy to one or more Web Application.
    Open the SharePoint designer, create SharePoint 2010      Platform workflow, add action from Custom Actions.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Set the orgin document on a Journal Entry

    I don't see this exposed in the DI has anyone been able to set the orgin document on a Journal Entry (baseref field)

    ...when you go to the database documentation in SDK Help Center you will find all "valid values" - if any - for the fields.
    For BaseRef you should IMHO only find other "Marketing Documents" listed - and only the reference to the last referenced (remember that e.g. you can have multiple Delivery Notes for a single Sales Order).
    I never heard that Journal Entries could be actively linked to "Marketing Documents" - it works just "vice versa":
    When you post an A/R Invoice this will automatically generate a Journal Entry and link it to the Invoice - but via the field JrnlMemo - not BaseRef!
    However, you could add a UDF to fill in such information if you need it.
    HTH,
    Frank

  • How can I print ONLY the active document?

    Whenever I go to File/Print the darn PSE 9 program sends all of the working files in the bin to the printer. I've searched online for 2 hours now looking for an answer.
    I like to work with having several to many files in the 'bin' and prefer to only print the active file I'm currently working on without having to close the 'working files' before I can print. How can I print ONLY the active document or file in the project bin? Please help, I've upgraded from PSE 3 to PSE 9 and really like the updated features, but this one pain in the neck default is getting the best of me.

    Thanks for your help, that works nicely. It is good to have control of the printer again.

  • How to get the filename of the current active document in InDesign CS4?

    Hi,
    If I open a document from File->Open, I can get the document's file name using IOpenedFileInfo->GetOpenedFilePath().
    But, if I create a new document and perform File->SaveAs, GetOpenedFilePath is returning invalid IDFile reference.
    What is the right way to get the active document's file name?
    Thanks,
    VSP

    You can try this:
         IDatabse * db = ::GetDatabase(theDoc);
         IDFile *  sysFile = db->GetSysFile();
         PMString docName = sysFile->GetFileName();
    Good luck

  • How do you change the default setting for RTF documents from TextEdit to MS Word

    How do you change the default setting for RTF documents from TextEdit to MS Word, I download forms from the Canadian government and they use RTF as a standard, they are supposed to open as MS Word documents (Yes I have Office for MAC 2011) but when download the document it goes to TextEdit which messes up the form format. I can down load it right click and go "open with" MS Word but how can I get the default chnaged to save this step.

    richr604 wrote:
    Thanks I knew this, I like Safari as I want to keep everything MAC, but if I use Firefox the documents open in MS Word straight away, I was just curious if there was some setting I could change?
    In Firefox > Preferences, click the Applications tab. If RTF is there, use the pulldown menu in the Action column to pick MS Word. If RTF is not there, there are instructions here for how to add file types.

  • Photosho CS Problem - Can't drag a layer set from one document to another one

    I have two documents open
    On the source document, i want to drag a layer set from this document to a new one, but its not letting me
    What would cause this.
    My structure for the source document is
    >Set 1 Layer Set
         >layer
         > Adjustment Layer
         >background
    Background
    Structure of the target document
    >Named Layer Set
         > Where I want to insert the Layer Set from source document
         >layer
         > Adjustment Layer
         >background
    Background

    No error message is given. I just can't drag it into the spot I want to drag the layer set to (its not an individual layer, its a layer set)
    Basically, this is all I can do (have to do a correction on how the layers and layer sets work, missing one level from the original post):
    I've attached images as well to illustrate
    On my target document, I want to have the layer set go where the red text is:
    >Content Layer Set
         >Named Layer Set
              > Where I want to insert the Layer Set from source document (Set 1)
              >layer
              > Adjustment Layer
              >background
    Background
    right now, I can only drag the layer set to this position:
    >Content Layer Set
          > This is where the Set 1 from the source document can go, I can't drag it into the layer set below
         >Named Layer Set
              >layer
              > Adjustment Layer
              >background
    Background
    First Image I attached shows the Set 1 Layer Set, above the layer set I want to drag it into
    Second Image I attached shows what happens when I try to drag the layer set into the named layer set; it comes up with the "no symbol"
    No Error message is given

  • I have a new iMac running OS 10.9 when I use the Command S shortcut it no longer saves the active document it speaks it instead.

    I have a new iMac running OS 10.9.  When I use the Command S shortcut in any of my apps (numbers, text edit etc), it no longer saves the active document it speaks it instead.  How can I revert to the save shortcut function?

    have you looked in
    system preference->Dictiation & speech if it's assigned there?
    or system preference->accessibility if it's assigned there?

  • I try to 'Print booklet' and receive an eror that "the active document uses multiple page sizes..."

    I try to 'Print booklet' and receive an eror that "the active document uses multiple page sizes..." but all the pages on my document are in the same size (as far as I know)
    How can I deal with this eror?

    This seems to be a bug, and so far the only workaround I know is  to copy/paste everything into a new file.

  • How to Select the Document just back of the Active Document

    If there are 5 documents open in photoshop I want to select the document just behind or back of the Active Document , using script.
    One of my friend suggested me the bleow script, but it is selecting the previous document, not exactly the document back of the active document.
    please help me.
    var id85 = charIDToTypeID( "slct" );
        var desc21 = new ActionDescriptor();
        var id86 = charIDToTypeID( "null" );
            var ref11 = new ActionReference();
            var id87 = charIDToTypeID( "Dcmn" );
            ref11.putOffset( id87, -1 );
        desc21.putReference( id86, ref11 );
    executeAction( id85, desc21, DialogModes.NO )

    I had the same problem. I did not want to go back to the "last viewed" doc but to the doc opened before the active one.
    I use this on F1 key to go back to the previous opened document (index order -1).
    It works great.
    #target photoshop
    // Go back to the last opened doc. If it is the oldest opened one it does not give error window and stays on it.
    if(documents.length>0) {
        var thisIndexImage = getActiveDocumentIndex();
        var theDocs = app.documents;
        if ( thisIndexImage != 0 ) {
            var openedBefore = theDocs[thisIndexImage - 1];
            } else {
            var openedBefore = theDocs[0];
        app.activeDocument = openedBefore;
    } else {
        alert ("You need to have any opened documents to apply this script.")
    // Functions
    function getActiveDocumentIndex(){
         var ref = new ActionReference();
         ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
         return desc = executeActionGet(ref).getInteger(stringIDToTypeID('itemIndex'))-1;

  • How can I get the windowRef of the active document window?

    Hello,
    Hou could I get the ADMWindowRef of the active Document window in Illustrator CS4- CS5? I can not use ADMWindowSuite1  because is On Mac OS only.
    Thank you very much to Everybody.

    There's no API for this, not if you want to make use of it in a useful way. You have to write Windows API code to do it. I reccommend using Spy++ to suss out the structure. Frankly, it's pretty annoying. It'd be extremely helpful if the API provided this, but it doesn't.

Maybe you are looking for

  • Error installing itunes 9 with windows xp

    Installed itunes 9 today, almost everything seems to work fine, i can access itunes and my music ... but when i open itunes i get this error message: The registry settings used by the itunes drivers for importing and burning CDs and DVDs are missing.

  • Can I back up the organizer, move my photos and still access them in PSE?

    I backed up my catalog to an external HD last night and there were about 20 disconnected files.  I was not able to locate them so I allowed the back up to continue without them.  Do you know what the consequences are for that? Also, several of my pho

  • Any suggestions why Internet Radio on Apple TV 2 is not working?

    Hi - I've had my Apple TV2 for over a year now. Everything has always worked fine without any issues until about a month ago when the Internet Radio feature simply stopped working. I have no idea why - all software is up to date, I've checked the net

  • Using an iTunes song as a ringtone on iPhone

    I had my iPhone set up to use a tune from iTunes as my ringtone.  That function has dissappeared and all I have are the Apple ringtones.  I presume this happened when I upgraded the IOS. Any ideas as to how I can restore my tune as a ringtone? Thank

  • Record displaying twice in View

    Hai all, I created a view like this : create view xxail_task as select distinct(peo.EMPLOYEE_NUMBER) "Employee_Number" ,peo.FULL_NAME "Employee_Name" , pac.SEGMENT1 "BADGE" , pac.SEGMENT2 "Status" , pac.SEGMENT3 "Remarks" , pac.SEGMENT4 "Remarks1" ,