Event trapping when the active document changes
Hi all,
Apologies if this question has been asked / answered before. I don't get out much.
Is there any way, in ExtendScript, to get an event when the user brings a different document to the front? Something similar to the "beforeOpen" event, but which fires when the activeDocument changes?
Seems to me that something like that would be quite handy. But then, maybe I'm just odd.
Thanks,
Chuck
Well, I'll answer it...
There is no way to do it with ExtendScript and InDesign alone.
You can do it (and I do in one app I've written) with APID from Rorohiko. In fact, I use APID as my primary event engine.
Events I routinely use from APID:
subjectCreated - when a frame or something has been created.
subjectDelete - same, but
subjectModifed - when an object has been modified
subjectModifed-text - when a text object is reflown
docSelected
docDeselected
selected - a page item is selected
deselected - a page item is deselected
Regards
Bob
Similar Messages
-
Call a function when the active document is closed
Hi friends
I have a portion of my script (at true a specific function) that I´d need to be executed every time the user close the app.activeDocument in Photoshop.
I know there´s a Photoshop script called "Script Event Manager" where we can associate actions and scripts with events (like closing the document). I´d not like to use this script because..as I told...it´s not my entire script to be runned when closing a file..but only a function.
Tried to search in the Script Event Manager for any event called "onClose" () but sure there´s nothing.
How could I insert an event in the body of my own script that calls a function every time user close the active document?
Thank you a lot for the help
Best Regards
Gustavo.As I said before the close event is really not that useful. In addition to the document already being closed the event descriptor will only have the path to the closed file if it was saved as part of the close event.
But if you want to play around with this to see if it will be helpful to you here is one way. You will need to add the notifer. This only needs to be done once unless it is removed.
app.notifiersEnabled = true;
app.notifiers.add( "Cls ",new File('~/desktop/closeEventHandler.jsx') );
Then for the event handler script, something like this.
try {
if (arguments.length >= 2) {
var filePath;
var desc = arguments[0];
if( desc.hasKey( stringIDToTypeID('in') ) ) filePath = desc.getPath(stringIDToTypeID('in'));
if( filePath != undefined ) alert( decodeURI( filePath ) );
} catch (e) {} -
Notified when the active page changes
Hello,
We have a panel that displays the content of script lables. A script label can be added to a page.
How do we determine the current page? The page might be selected from the from the pages panel and might not have any items on the page. Our ActiveSelectionObserver is not being called when the visible page is being changed.
Thanks.
P.Well, I'll answer it...
There is no way to do it with ExtendScript and InDesign alone.
You can do it (and I do in one app I've written) with APID from Rorohiko. In fact, I use APID as my primary event engine.
Events I routinely use from APID:
subjectCreated - when a frame or something has been created.
subjectDelete - same, but
subjectModifed - when an object has been modified
subjectModifed-text - when a text object is reflown
docSelected
docDeselected
selected - a page item is selected
deselected - a page item is deselected
Regards
Bob -
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? -
Revision: 11448
Author: [email protected]
Date: 2009-11-04 17:06:22 -0800 (Wed, 04 Nov 2009)
Log Message:
Making a small ItemRenderer change so that we don't dispatch an unused, contentBackgroundColorChanged event anymore when the itemIndex gets set.
QE notes: -
Doc notes: -
Bugs: -
Reviewer: Deepa
Tests run: checkintests
Is noteworthy for integration: No
Modified Paths:
flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ItemRenderer .asRevision: 11448
Author: [email protected]
Date: 2009-11-04 17:06:22 -0800 (Wed, 04 Nov 2009)
Log Message:
Making a small ItemRenderer change so that we don't dispatch an unused, contentBackgroundColorChanged event anymore when the itemIndex gets set.
QE notes: -
Doc notes: -
Bugs: -
Reviewer: Deepa
Tests run: checkintests
Is noteworthy for integration: No
Modified Paths:
flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ItemRenderer .as -
Minumum and Maximum pointsize in the active document with font name
hi
How to find the font with point size in active document and how to get the minimum point size and maximum point size used in the active document with font name
Thanks in Advance.Okay, that does look good (without testing it). Does it do its job?
I think it can be made a bit more efficiently by not running over all text frames, but rather over all stories in the document -- a small change, the rest can stay the same.
You can also try turning the gathering of used data around. It appears you are now pushing every item immediately into your array, then weed out duplicates. (For my thoughts on the latter, see below!) It might be quicker and more memory-efficient to scan your present array to see if the new item is already in there, and only push when it's not. (Bonus points for a binary tree implementation -- the fastest possible way! But a linear search on the entire array, or on a sorted array and bailing out if you go "past" the current item, may be fast enough.)
(On Weeding out duplicates; you might want to skip this, as it won't be necessary for the above:)
Your function UniteSame sorts out and removes duplicates by comparing every item to every other one; then it sorts the array. An alternative can be to
1. Sort the array
2. Create a new empty one
3. Push an item of the original onto the new one.
4. Skip items of the original list while they are the same as the bottom one of the new list.
5. Until you run out of items. -
I want the system automatic update my UDFs when the OnHand was changed.
I added two UDFs in table OITW to count the warehouse OnHand by CASES and Bottles. I want the system automatic update my UDFs when the OnHand was changed. Is there any way I can do it in database level instead in the application (too much places involved).
There is few ways how to do this:
- triger as David said, but I dont recomend it through SAP policy
- in stored procedure transaction notification by adding or updating document update your user field
- create job in SQL server which in specific interval recalculate the changes of onhand and update your user defined field
- create addon which will be over functiuonalities which may change the onhand value
I think that from SAP is possible only Addon, but the easist way is trigger and if you dont need it just in time but for example every 10 seccond, the better is job which cannot fail the standard SBO transaction (triger may and may be unsafe).
Hope it helps
Petr -
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.
-
Hello all,
I joined a test automation team in the middle of a large project and
inherited a huge set of VIs (over 700) and associated architecture for
this automation (not to mention the several thousand TestStand
sequences). Another part of the project is being developed by our
customer, who is using VB 6.0 to create ActiveX components which we
need to use in LabView to access their hardware. They've already
invested a large amount of time developing these ActiveX components,
and they are not finished -- meaning the ActiveX interfaces will be
changing. Every time they send updated ActiveX components, I have to
re-write many, many VIs including updating a couple strict typdefs.
This process takes way too much time and is mind-numbing and prone to
error or omission.
Unfortunately I can't post any of the VIs because of a NDA. But
perhaps a bit more detailed explanation would help. TestStand calls a
VI to open and get an ActiveX reference for automation (which it stores
in a variant). It will pass this reference into any VI it calls to
perform specific functions through this ActiveX interface. For
example, one VI that may be called passes this automation refnum into
another, which passes it to another, which passes it into another to
get the actual ActiveX reference stored in that variant (through a
Variant To Data call with a strict typedef of the ActiveX component
wired to the type input). [See the attached image of this sample VI
hierarchy: the far left icon would represent TestStand, and the far
right is the strict typedef.] Any of the VIs in the chain might use
ActiveX Property or Invoke nodes, and it can break at any one of those
when the ActiveX component changes. It's easy to fix each one, but
since there are so many VIs it takes a very long time.
Is there any way at all to do a massive search/replace or something to
make the ActiveX references update? I realise that even though
property or method names stay the same from one version to the next,
they are different references. Is there a way to update these based on
name if you give it the base ActiveX reference?
Thanks in advance for any help!
Tom Williams
Attachments:
hierarchy.GIF 6 KBBen,
Unfortunately I can't post any VIs that would demonstrate the problem
because the ActiveX components are confidential. I'll try to develop
my own ActiveX dll that will demonstrate it, but in the meantime, in
hopes that another picture will help, I've attached an image of a block
diagram (with some names changed to protect confidential information)
of one of the lower level VIs from the hierarchy I posted. In this
example, the "Automation Refnum IN" is an input with a type definition
linked to the strict typedef based on the ActiveX automation dll that
has changed. I updated that typedef, but as you can see the output to
the "Class1" indicator is broken. If I delete the "Class1" indicator
and select Create->Indicator from the Class1 property node, and then
wire the new "Class1" indicator to the connector pane, the VI is fixed
-- at least at compile time. In most cases there is also a runtime
problem where the reference obtained by one of the intermediate
property nodes is null, so the property or method node that uses it
fails (e.g. "_VNManager.Networks" property returned is 0, so the
"_Networks.Network1" property node fails). To fix this problem, I have
to delete the wires between the property nodes, and one by one select a
different property/method, then select the correct property/method and
re-wire. There seems to be a bit of "jiggling the handle" to get it to
work though.
I don't know if the ActiveX developer changed anything in this class,
but if he did, he didn't change the name of this class. I would like
to have to modify the VI only if a class, property or method has
changed name or been removed.
Does that all make sense? Thanks for any pointers or help!
Tom
Attachments:
Class1_Path.GIF 7 KB -
How to find the when the password is changed for a system User
Hi to all,
We have a test database where our application connects to system user. The application runs more than a month without any issues, But suddenly my system and sys password gets changed. I wonder how this would happen. I have checked with DBA_USERS to check whether the account gets locked, But the account is in the Open state.
I need to find out when the password gets changed for these users and who changed it? Is there any possible to trace it or we need to enable the auditing to find it in future.
Kindly let me know the possible ways.
Regards,
Vijayaraghavan KVijayaraghavan Krishnan wrote:
Hi to all,
We have a test database where our application connects to system user. The application runs more than a month without any issues, But suddenly my system and sys password gets changed. I wonder how this would happen. I have checked with DBA_USERS to check whether the account gets locked, But the account is in the Open state.
I need to find out when the password gets changed for these users and who changed it? Is there any possible to trace it or we need to enable the auditing to find it in future.
Kindly let me know the possible ways.
Regards,
Vijayaraghavan KThe only way to implement an Oracle Audit -
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.
-
Digitally Sign All Signature Fields in the Active Document
I have a script which will sign a single digital signature field by the field name.
I need to revise the script so it will sign multiple/all signature fields in the active document without having to put the field name in the script, as the field names will vary with each document.
Can anyone please advise how to modify the script to sign all fields in the active document regardless of the field name?
function myOtherTrustedFunction()
app.beginPriv();
// Get and login to security handler
var oSigHdlr = security.getHandler( "Adobe.PPKLite" );
oSigHdlr.login( "123","/c/Documents and Settings/name/Application Data/Adobe/Acrobat/10.0/Security/FirstNameLastName.pfx");
// Setup Signing Properties
var chk = this.getField("Checked");
if (chk != null) {
// Apply Signature and save back to original file
var bRtn = chk.signatureSign({oSig:oSigHdlr, bUI:false, oInfo:{password:"123"}});
app.endPriv();
Any assistance will be most appreciated.Thank you for your help, the script will now count only the signature fields which have not been signed.
I have added the second part of the script to then sign all of the blank signature fields.
The script is only signing one of the digital signature fields instead of all of the blank signature fields.
Can you please advise how I can modify the script to sign all of the blank signature fields?
var count = 0;
for (var i = 0; i < numFields; i++) {
// Get the current field object
f = getField(getNthFieldName(i));
// If it's a signature field and not already signed, increment counter
if (f.type === "signature" && !f.value) {
count++;
var myEngine = security.getHandler( "Adobe.PPKLite" );
myEngine.login( "123", c/Documents and Settings/name/Application Data/Adobe/Acrobat/10.0/Security/FirstNameLastName.pfx" );
// Sign the field
f.signatureSign( myEngine,{password: "123"}); -
Blocking Billing Doc.when the accounting document do not created
Hi Dear all,
Someone knows to tell me how can I block a Billing Document when the Accounting Document not generate? I tried to find some customizing, but I didn´t find it.
I´m asking because sometimes the user don´t realize the "warning message"- No accounting document Generate. If I have some option to block this billing, will be perfect for my process.
Thanks
MelissaHi ,
Till accounting document is not generated Billing will have status Open, I am not clear what do you mean by Blocking .
In tablw VBRK , you can get data for billing document for which accounting document is not generated.
Rajesh
Maybe you are looking for
-
How do you set up for another ipod on same computer
I just bought another ipod for my wife and she wants to set up her own itunes account or a completely different library. Can this be done on the same computer or do we have to share the same music?
-
"sequence 'JDR_DOCUMENT_ID_S' is corrupt" using JPXImporter
used JPX Import to load components with the following command : java oracle.jrad.tools.xml.importer.JPXImporter $JAVA_TOP/cggv/oracle/apps/per/selfservice/appraisals/server/MgrAppraisalsInProgressVOEx.jpx -username apps -password $mp_apps -dbconnecti
-
How much better is the middle-end vs the low end, with no upgrades. Will they both play all games now and probably in the next 3 or 4 years(i realize time-viewing is quite hard), at any resolution i dont care THAT much, although it is also nice to ha
-
Ok, I've looked absolutely everywhere I can think to, and still coming up empty handed.. can someone please lend me a hand? I just recently purchased my iPod nano 8g. I had sync'd all my photo's to it.. and everything was going great. Then I decided
-
Hi BO Experts, Currently i am working on Business Intelligence 7.0.I just want to know what is the role of BO with BI. In BI, we have different areas. 1. Extraction. 2. Modeling. 3. Reporting. Is BO is used only in the reporting side (using Crystal R