App.activeDocument no longer works right

In a different topic, I was explaining my use of app.documents[0] rather than app.activeDocument. I was going to elaborate some about the differences when I hit a snag. There was a dramatic change after CS3 and apparently nobody noticed. I didn't until today. Look at this simple script that expects there to be more than one document open:
docZero = app.documents[0];
activeDoc = app.activeDocument;
$.writeln("docZero: " + docZero.name);
$.writeln("activeDoc: " + activeDoc.name);
// move back document to front
app.activeDocument = app.documents[-1];
$.writeln("\ndocZero: " + docZero.name);
$.writeln("activeDoc: " + activeDoc.name + "\n");
$.writeln("docZero: "+ docZero.toSpecifier());
$.writeln("activeDoc: " + activeDoc.toSpecifier() + "\n");
In CC, I was astonished to discover that I got this result (after creating two untitled documents):
docZero: Untitled-2
activeDoc: Untitled-2
docZero: Untitled-2
activeDoc: Untitled-2
docZero: /document[0]
activeDoc: /document[@id=2]
That second docZero ought to say Untitled-1. Untitled-1 was definitely moved to the front by the app.activeDocument = app.documents[-1] statement. So looking at the docZero specifier, how come I got the wrong name?
I decided to check my sanity and went back to see what happens in CS3 -- the oldest InDesign I still have installed (actually, on two different computers, so I tried it on both). CS3 gives:
docZero: Untitled-2
activeDoc: Untitled-2
docZero: Untitled-1
activeDoc: Untitled-2
docZero: /document[0]
activeDoc: /document[@name="Untitled-2"]
There's two interesting things here:
The second docZero message has the correct name of the document that was moved to the front.
In those days, documents were identified by name, not id.
Point 2 is interesting but off topic.
So I tried CS4 (also on two machines). It gave:
docZero: Untitled-2
activeDoc: Untitled-2
docZero: Untitled-2
activeDoc: Untitled-2
docZero: /document[0]
activeDoc: /document[@name="Untitled-2"]
So this is when things started to go wrong. Interestingly, documents were still identified by name in CS4, so it wasn't that change that caused the change in behavior. It was CS5 (which produced exactly the same output as CC) where the specifier changed to using the id -- a property that had not previously existed for Document objects.
So, I guess the question is: Is this a bug? Looks like one to me. Looks like it stopped working after CS3.
Dave
Message was edited by: DaveSofTypefi -- minor formatting change

Hi Dave,
This is a typical specifier resolution problem, and indeed this is not related to id-based document specifiers introduced in CS5.
How specifiers are resolved is consistant since CS4—except for Text and Cell specifiers, but this another story.
Here is what happens:
Unlike activeDoc = app.activeDocument (which is instantly resolved), docZero = app.documents[0] remains an unresolved specifier until you hit some property on it, which is done at the next line, when you innocently display the name property:
$.writeln("docZero: " + docZero.name); // this code sends a command that resolves docZero
Then, whatever you do, docZero is internally resolved to an actual receiver (the Untitled2 document), even if the specifier string accessed from docZero.toSpecifier() still contains the original path "/document[0]". Ironically, if you didn't prompt docZero.name before sending the command app.activeDocument = app.documents[-1]; then docZero would have been properly resolved to the Untitled1 document! Remove the first $.writeln and you will see the change.
Now, the question is: how to force a new resolution of the specifier considering its formal path "/document[0]". The answer is getElements(). Just access this method and the magic happens:
docZero = app.documents[0];
alert("docZero: " + docZero.name);          // => Untitled-2
// move back document to front
app.activeDocument = app.documents[-1];
docZero.getElements();                      // resolve again!
alert("\ndocZero: " + docZero.name);        //  => Untitled1
alert("docZero: "+ docZero.toSpecifier());  // still /document[0]
See also: http://www.indiscripts.com/post/2010/07/on-everyitem-part-2
@+
Marc

Similar Messages

  • Many Apps are no longer working after webOS 1.4 update! - please help!

    Hi,
    Many of my previously working Palm Pre Apps are no longer working after the webOS 1.4 update.
    Here are the ones that just return a blank/white screen after launching so far:
    SplashID
    Daily Devo
    Daily Light (Love)
    Absolute Fitness (some options no longer work correctly & are returning a white screen and some options are working)
    These are just a few of the Apps that I am having problems with and there are probably many others.  I have also sent emails/posted to forums on the developer sites to advise. Hopefully I will hear something back soon.
    Anyone else experiencing this issue as well with any Apps?
    Thanks in advance for any help that you can provide.

    SplashID on my Sprint Pre is showing just a blank screen after starting it and entering my password.  I see no update for it in the App Catalog.
    EDIT: Never mind.  It appears that it only did that on the first launch.  I closed it and restarted it, and now the screen in SplashID is correct.

  • TS1702 My youtube app is no longer working on my iphone 3. Others, with the same phone, are not having the problem. It works occassionally, but it's unpredictable. I've updated phone software, deleted the app, re-downloaded the app, turned the phone off a

    My youtube app is no longer working on my iphone 3. Others, with the same phone, are not having the problem. It works occassionally, but it's unpredictable. I've updated phone software, deleted the app, re-downloaded the app, turned the phone off and on...nothing.

    You may have debris in your headphone jack blocking the sensor.  Try blowing hard on the jack, and inserting/removing your headphones quickly multiple times to clear it.

  • The app store no longer works since iOS 5.1 update?

    Ever since I did the most recent iOS Update for my iPod Touch 4G (purchased Dec 2010), the app store no longer works. I know for a fact it is NOT a billing problem with missmatched security code on my credit card. I had that before and resolved it.
    This time, it seems that when I download an update to an app or a new app, it starts to download and then says "Waiting..." but in eternity. The download doesn't commence. I already tried resetting the network, powering off and on, deleting the apps and readding them as new and using different WiFi networks (FOUR) to make sure that wasn't the issue. Nothing seems to fix this.
    Any suggestions?

    Just put you finger on the camera and drag it up and Lock screen will shift up.

  • Cannot download Kindle app for my iMacbook Pro from the Apple app store.  When I upgraded to 10.10.2 it told me my current app would no longer work.  How do I get Kindle back for my laptop?

    Just upgraded to iOS 10.10.2 on my MacBook Pro (late 2011) and was informed my Kindle app was no longer compatible and would be removed somewhere.  When I tried to install a new Kindle app from the Apple App store it appeared to download, but when I tried to open it nothing happened and it does not appear anywhere in my App list.  I see there have been problems like this in the past but nobody has reported having a problem for several months.  Any cure for this?

    iOS is the operating system for iOS devices like the iPhone and iPad. Your Mac runs on OS X. You have installed OS X 10.10.2 Yosemite.
    I have the most recent version of the Kindle app for Mac from the Mac App Store (MAS) v. 1.10.6 and it works fine. Look again in the MAS for the Kindle app, does it say Get or Open on the button?
    Are you confusing Kindle for Mac with Kindle for iOS. The iOS version won't run on your Mac.

  • I have what I think is the original Ipad, and it will no longer send out emails.  Is it possible to update it, or am I just stuck with a $500 electronic device that will no longer work the way I need it to.  Some of the original apps will no longer work

    I have what I think is the original Ipad, and suddenly it will no longer send out emails and some of the apps that worked prior to the newer Ipads coming out will no longer work.  Can this be updated, or am I stuck with an expensive electronic device that will no longer serve my needs?

    Did you already update to the latest iOS; http://support.apple.com/kb/HT4623

  • How do i get refunded for the apps that no longer work due to the fact i cant upgrade my phone?

    how do i get refunded for the apps that i purchased that no longer work due to the fact i cant upgrade my 3.1.3 iphone

    I have never bought an app but on all other things Apple  somewhere has in tiny print the system requirements for running the software.  If you're going to live in the world of outdated technology the way I do, you will quickly learn to always read system requirements.
    iTunes Customer Service Contact - http://www.apple.com/support/itunes/contact.html - Apple states all sales are final, but you can always try.

  • Adobe App Manager no longer works

    For some reason my Adobe App Manager does not work on my Macbook. It orginally did but one day it just would not launch. After numerous attempts of uninstalling and re-installing without success, the only workaround solution was to create another user on my Macbook and install the Application Manager on that user's account. I can then download the apps / programs and updates from there. When I log out of that user and back into my main account the Adobe programs work....well most of them. I have noticed that certain programs, like Muse will launch and work correctly under my second user account but it will not luanch without error on the main account.
    Everything worked fine one day, then its all messed up. Switching users is not an ideal solution at all. I have spent numerous attempts using Adobe chat but no one can seem to give me a solution that works.
    Does anyone have a suggestion for a solution?

    Kmonk9000 if you are facing so many issues under your original user account I would recommend migrating your documents and settings to a new user account.
    You are welcome to attempt to track down the numerous locations your file permissions for your current user account have become compromised however.  I would recommend you begin by looking at your installation logs to determine where you faced file permission failures.  Please see Troubleshoot with install logs | CS5, CS5.5, CS6 - http://helpx.adobe.com/creative-suite/kb/troubleshoot-install-logs-cs5-cs5.html for information on how to review the logs.

  • AIR for iOS 3.1 - App name no longer working?

    I have named my app "Someapp 123" and mysteriously the app continuously drops the "123" portion of the name. It used to appear just fine.
    Yesterday I noticed AIR3.1 was released and I overlayed that. Has anyone else overlayed AIR3.1? Notice your app name not completely working?
    FWIW it is an iPad-only app. The provision clearly states the name of the app is "Someapp 123". In AIR for IOS settings I have the "App Name" parameter set properly as well.

    My app name is a small word with a number after it, e.g. "Some 123". No ampersands or anything fancy.
    I did not know that it republished the XML if I published from the iOS panel but I even see hitting "OK" in that panel re-writes the XML file (because you need to put a password in for the p12 every time before publishing) and that overwrites it.
    I edited the re-created XML file, removed junk whitespace and changed my app name to a single word "Testapp". I publish with alt+shift+f12 typically which is the same as the file menu. I hit file->Publish anyhow and I can verify yes indeed it did not overwrite my XML file. Unfortunately the app was not named "Testapp", it was still named what I had named the SWF file. I verified the XML was not overwritten and it was not.
    I noticed there's a <name> and also a <filename>. The <filename> does not have SWF applied to it and there is also an attribute <content> which actually points to the SWF. I'm not sure why both <filename> and <content> exists but I went and changed the <filename> to the app title I wanted. So both <name> and <filename> are now "Testapp". I published with file->publish and low and behold, the name of the app is now "Testapp".
    Why would flash choose to use <filename> over <name>?
    Here is a full example of my XML file:
    <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <application xmlns="http://ns.adobe.com/air/application/3.1">
      <id>com.mycompany.AppID</id>
      <versionNumber>1.4</versionNumber>
      <filename>Testapp</filename>
      <description/>
      <name>Testapp</name>
      <copyright/>
      <initialWindow>
        <content>MyFile.swf</content>
        <systemChrome>standard</systemChrome>
        <transparent>false</transparent>
        <visible>true</visible>
        <fullScreen>true</fullScreen>
        <aspectRatio>landscape</aspectRatio>
        <renderMode>gpu</renderMode>
        <autoOrients>true</autoOrients>
      </initialWindow>
      <icon>
        <image29x29>AppIconsForPublish/29.png</image29x29>
        <image57x57>AppIconsForPublish/57.png</image57x57>
        <image114x114>AppIconsForPublish/114.png</image114x114>
        <image48x48>AppIconsForPublish/48.png</image48x48>
        <image72x72>AppIconsForPublish/72.png</image72x72>
        <image512x512>AppIconsForPublish/t512.png</image512x512></icon>
      <customUpdateUI>false</customUpdateUI>
      <allowBrowserInvocation>false</allowBrowserInvocation>
      <iPhone>
        <InfoAdditions>
          <![CDATA[<key>UIDeviceFamily</key><array><string>2</string></array>]]>
        </InfoAdditions>
        <requestedDisplayResolution>standard</requestedDisplayResolution>
      </iPhone>
    </application>
    Anything in there seem odd? Again I'm using the AIR 3.1 SDK so I'm using that namespace. Anything I put in <filename> is now the app name, however in iTunes it continues to say "Unknown Ge..." which is pretty unprofessional. Although the icon works fine. When syncing I see the value in the <filename> field, as it will say "Syncing Testapp...".

  • In-app purchases no longer working

    I have and iphone 4 running iOS5.1.  Since upgrade to 5.1, I can no longer make in-app purchases, receiving a "cannot connect to itunes store" error.  I can purchase apps directly, or purchase from itunes, but not in-app.  Worked fine before I upgraded

    Supposedly, when you "re-purchase" them, the iTunes Store should recognize that they were previously purchased (assuming you are using the same iTunes Store account). That said however, I just sent off an email to the iTunes Store Support section because I WAS charged again for an in-app purchase.
    I don't know if this was a fluke or a new policy by Apple to get their 30% of a $2.99 purchase since Apple is known to be: losing money, stock is tanking, no one is buying their products, etc.

  • App Catalog no longer works in Poland

    I am using Palm Pre 2 for little more than 2 weeks. Initially free apps were available in App Catalog (and only the free ones as I live in Poland). But starting last week they are no longer available - now the list of apps is totally empty. Anyone have idea why ?
    Post relates to: Pre 2 p102ueu (Unlocked EU)

    Hi lynettec,
    When you say Acrobat doesn't work in Firefox, do you mean that you can't view PDF files in the Firefox browser? If so, please see View PDF files in Firefox without downloading them | Firefox Help
    If you're referring to the Acrobat online services, they are supported in Firefox, so I'd would need a little more information about what's happening to get to the bottom of the problem.
    Best,
    Sara

  • HT2693 what can i do when vendor contact support page can't send my info/msg due to page error and i have paid for an app that no longer works after purchase

    What can i do when i purchase an app then after purchase the app fails to work. I deleted the app rebooted ipa then reinstated app. It still fails to work. I went to vendor support but when i go to send the info to them it comes up with unable to send msg due to page error. I am not happy. My child loved the app now it wont even open. Any help???

    Try talking to iTunes support
    http://www.apple.com/support/itunes/contact/

  • Audio and video played inside of apps will no longer work.

    I use several apps to listen to audio and within the last few days I tried listening to NPR but when I hit "play" it would just buffer and never play. I then attempted to download some podcasts via iTunes as an alternative and kept  getting an error "unable to Download Podcast." I was not on the latest version (5.1.1)of iOS (was on version 5.1) and several apps needed updated so I updated everything.  Since then my videos within CNN, NBC, etc stopped working and the audio/podcast download issue remained.  Oddly, I can watch videos via the YouTube app or via blogs on a browser but videos or audio within apps(CNN, NPR, NBC, etc) do not play.  Sometimes I just get a blank screen and sometimes the audio will actually play but no video depending on the app I'm using.
    I have no problem surfing the internet or playing videos via YouTube app so it isn't a connection issue. Here are the steps I've taken thus far to resolve the issue but with no luck:
    First issue: Audio not working - just buffer. Also, couldn't download podcasts
    1. Restart
    2. Reset (On/Off + home)
    3. Update to latest version iOS (now on 5.1.1)
    4. Update all apps
    New issue: Video now doesn't work within apps.  Audio and podcast download still not working.
    5. Reset (On/Off +Home - again)
    6. Reset All Settings
    7. Restore from Backup
    8. Reset (On/Off +Home - getting desperate)
    9. Deleted CNN app from iPad and iTunes, ran sync and reinstalled.  Still no luck but now actually get a message when trying to play video "Unable to play video" (very helpful)
    I'm at a loss. any ideas would be much appreciated.
    Thank you!

    Did you already update to the latest iOS; http://support.apple.com/kb/HT4623

  • Facebook app is no longer working on my BB curve 8520!HELP please??

    Hey there
    I have had my BB 8520 for quite some time now & never had any problem having access to my Facebook app , it was slow with notifications etc etc but never did it not allow me to use the app!! So I woke up one morning and opened my facebook app from the previous night as always & it had frozen its home updates so I tried to refresh the page & it reloaded the page but then it was un-responsive from then on!!so I removed the battery,never helped!I un-installed it,rei-installed it,never helped!!I then deleted the app off app world and re-downloaded it,never helped!!HELP???I can still see the facebook app on my home page and when I click & open the fb app it opens up the login page through the app so I put my email and pin and then say login , the bubble pops up saying contacting facebook so I wait. .then it says in the bubble 'The facebook server is not able to handle your request at this time. Please try again later. (1503) ????? My facebook account still works in the facebook web internet page when searched through google but the App has crashed!!

    It could just be that your phone is having issues connecting to the Facebook server at the moment because of a communication error. You can try resending your service books to see if that might help, otherwise I'd try to wait another few hours. To resend your service books, go to Setup > Email Settings, press the BB Menu button and select Service Books. From here, you should be able to resend your service books.
    If resending the service books doesn't help and if it still doesn't work in a few hours, come back and let us know as there are some more drastic steps we can try to get you back up and running.
    If you want to thank someone for their comment, do so by clicking the Thumbs Up icon.
    If your issue is resolved, don't forget to click the Solution button on the resolution!

  • App store no longer works after installing iOS6 while traveling

    Hi,
    I have an iPhone 4S that I updated to iOS 6 while traveling in Brazil.  Now, even though my Apple account was created in the U.S. tied to the U.S. App Store, when I open the App Store it automatically goes to the Brazilian App Store and pops up an error message that my account is invalid for use in the Brazil App Store because it is an American account.  I've been using the App Store just fine for years from various countries as I travel.  It has always gone directly to the U.S. App Store regardless of where I am in the world.  Now it only seems to pull up the Brazilian App Store and not allow me to update apps or make purchases.
    My question is has anyone else experienced this?  Is it because I updated to iOS 6 while physically traveling in Brazil so the phone thinks it is a Brazil-based phone or is it a bug in iOS 6 that prevents you from using App Store while outside the U.S.?  I haven't been able to test what it does when I'm in the U.S. as I haven't returned yet.  All of my settings on the phone are in English and set up for U.S. settings - there's no setting in the phone set up for Brazil or the Portuguese language.
    If this is because I installed iOS 6 while in Brazil, how do I fix that?  Do I have to re-install iOS 6 while in the U.S.?  If so, how do I trigger a re-install and what do I do in the meantime to use App Store while traveling?  Is there a work-around that allows me to switch it from the Brazil App Store to U.S. App Store?  The error message I receive indicates that I need to change to the U.S. App Store in order to install apps but doesn't mention how to do that, as there don't appear to be config options in App Store.
    Any help would be appreciated..
    Thanks,
    Brent

    Hi,
    I have an iPhone 4S that I updated to iOS 6 while traveling in Brazil.  Now, even though my Apple account was created in the U.S. tied to the U.S. App Store, when I open the App Store it automatically goes to the Brazilian App Store and pops up an error message that my account is invalid for use in the Brazil App Store because it is an American account.  I've been using the App Store just fine for years from various countries as I travel.  It has always gone directly to the U.S. App Store regardless of where I am in the world.  Now it only seems to pull up the Brazilian App Store and not allow me to update apps or make purchases.
    My question is has anyone else experienced this?  Is it because I updated to iOS 6 while physically traveling in Brazil so the phone thinks it is a Brazil-based phone or is it a bug in iOS 6 that prevents you from using App Store while outside the U.S.?  I haven't been able to test what it does when I'm in the U.S. as I haven't returned yet.  All of my settings on the phone are in English and set up for U.S. settings - there's no setting in the phone set up for Brazil or the Portuguese language.
    If this is because I installed iOS 6 while in Brazil, how do I fix that?  Do I have to re-install iOS 6 while in the U.S.?  If so, how do I trigger a re-install and what do I do in the meantime to use App Store while traveling?  Is there a work-around that allows me to switch it from the Brazil App Store to U.S. App Store?  The error message I receive indicates that I need to change to the U.S. App Store in order to install apps but doesn't mention how to do that, as there don't appear to be config options in App Store.
    Any help would be appreciated..
    Thanks,
    Brent

Maybe you are looking for