[CS4/CS5] ScriptUI focus event (Win/Mac)

Hi friends,
I'm looking after a way to control the focus of EditText widgets within a Dialog but I'm totally confused by the event loop logics —especially in Mac OS.
The basic task I need to achieve is to attach a validation mechanism to an EditText. When the user has entered a wrong field and the change event occurs, I want to display an alert box, then re-activate the field. The problem is that both the change event and the alert box interfer with focus attribution. I think that user or system focus/blur events are stacked so that any command that attempts to focus back to the original widget cannot work while the stack is not empty.
Here is a simple test to illustrate my problem. The script is supposed to display an alert when the user change a field, then it tries to focus back to the corresponding field through myWidget.active = true. This does not work.
var     u,
     w = new Window('dialog',u,u,{xname:'Window'}),
     e1 = w.add('edittext', u, "",{xname:'EditText (1)'}),
     e2 = w.add('edittext', u, "",{xname:'EditText (2)'}),
     eInfo = w.add('edittext', [0,0,300,400], "",{xname: 'EditText (Info)', multiline:true}),
     b = w.add('button',u,'Clear', {xname:'Button'});
e1.characters = e2.characters = 20;
var anyEvent = function(ev)
     var tg = ev.target;
     eInfo.text += (tg.properties.xname + ' -> ' +
          ev.type.toUpperCase() +
          (tg.active ? '  (active)':'  (non active)') +
          '\n');
var changeEvent = function(ev)
     eInfo.text += ('\n--- BEFORE Breaking Alert\n');
     alert("Breaking alert");
     // Trying to FOCUS back on ev.target
     eInfo.text += ('\n--- BEFORE Active=true\n');
     ev.target.active = true;
     eInfo.text += ('--- AFTER Active=true\n');
// Event 'inspector'
w.addEventListener('change', anyEvent);
w.addEventListener('focus', anyEvent);
w.addEventListener('blur', anyEvent);
// Events
w.addEventListener('change', changeEvent);
b.onClick = function(){eInfo.text = '';};
w.show();
I tried various strategies to address this problem by using event timestamps and/or dispatching custom new UIEvent('focus'...), but nothing works conveniently.
In addition I got odd behaviours in Mac OS. The below screenshot shows a piece of a ScriptUI dialog —using a custom framework, so don't be surprised by the skin! What is weird is that in a particular state *two* EditText controls have the focus ring at the same time:
I didn't know such a thing could happen. I probably did not understand anything about the 'focus' paradigm.
Any help from an expert would be greatly appreciated. Thanks a lot!
@+
Marc

Harbs. wrote:
It does seem to change the focus, but you are still left with a cursor sometimes (which does not work).
The one that has the focus rect allows input and .active = true seems to work fine. (Mac 10.6 CS5)
Harbs
Well, this is not so clear to me. My beta-tester —also Mac CS5— reports unpredictable behaviors. It also depends on how the user change the focus: using the TAB key and clicking into another field are not equivalent. (It seems that the change-focus-by-click event is more complicated to counteract...)
But generally, on Mac platforms, we cannot be sure that setting myEditText.active = true gives the focus back to myEditText when other user events are running. The problem is that the active property is not always 'reliable'. We found that (under unstable circumstances) e1.active might returns true while e2 actually owns the focus ring! Somehow, Mac systems can dissociate the 'active' control and the focus... I don't know.
My assumption is that the focus has a high level priority in the Mac event loop and that it closely mirrors the user interaction, while the active property is an abstract thing featured by the ScriptUI layer. The purpose of ScriptUI is to wrap OS events and widgets in a single scripting interface for both Mac and Win, but ScriptUI is nothing but a bridge. I suppose that "myWidget is active" and "myWidget has the focus" means exactly the same thing in Windows, so ScriptUI can easily target the focus through the active property in Win environment. But Mac OS doesn't work the same way.
Interestingly when we set an EditText as borderless in Windows, we entirely remove the default widget appearence. On the contrary, a borderless EditText in Mac still reserve an additional region for the focus and there is no way to hide the focus ring when the control receives the inputs.
In addition, I posted above a screenshot where two EditText instances have the focus ring at the same time. I'm not a Mac user but I was told that this is not a normal situation. Then playing with the active property in ScriptUI can really disrupt the focus behavior on Mac platforms...
My first idea was to study more closely event triggering and to use a timestamp-based routine to keep the control of the focus. So I sent the following script to my beta-tester:
var     u,
     w = new Window('dialog',u,u,{xname:'Window'}),
     e1 = w.add('edittext', u, "aaa",{xname:'(1)'}),
     e2 = w.add('edittext', u, "",{xname:'(2)'}),
     eInfo = w.add('edittext', [0,0,300,400], "",{xname: '(Info)', multiline:true}),
     cForce = w.add('checkbox', u, "Force default value on error"),
     b = w.add('button',u,'Clear', {xname:'(Button)', name:'ok'});
e1.characters = e2.characters = 20;
var fgTarget = null,
     fgTimeStamp = +new Date,
     fgAlerting = null,
     fgNonValid;
var blurEventHandler = function(ev)
     if( fgAlerting ) return;
     var d = +new Date - fgTimeStamp;
     if( 100 < d )
          eInfo.text = '';
          fgTarget = ev.target;
          fgTimeStamp = +new Date;
          fgAlerting = null;
          fgNonValid = isNaN(fgTarget.text);
     d += ' ms';
     eInfo.text += (ev.target.properties.xname + ' is losing the focus  ' + d + '\n');
     fgTarget.active = true;
     if( fgNonValid )
          eInfo.text += ('  Re-activate ' + fgTarget.properties.xname +
               ' from '+ ev.target.properties.xname + '\n' +
               '  w.active=' + w.active + '\n' +
               '  e1.active=' + e1.active + '\n' +
               '  e2.active=' + e2.active + '\n') ;
          if( null===fgAlerting )
               fgAlerting = true;
               eInfo.text += '--- ALERT ---\n';
               alert("Please enter a numeric value or let the field empty.");
               fgAlerting = false;
               if( cForce.value ) fgTarget.text = '50';
               fgTimeStamp = +new Date;
e1.addEventListener('blur',blurEventHandler);
e2.addEventListener('blur',blurEventHandler);
var anyEventHandler = function(ev)
     eInfo.text += (ev.target.properties.xname + ' -> ' + ev.type + '\n');
e1.addEventListener('mousedown',anyEventHandler);
e1.addEventListener('mouseup',anyEventHandler);
e1.addEventListener('keydown',anyEventHandler);
e1.addEventListener('keyup',anyEventHandler);
e2.addEventListener('mousedown',anyEventHandler);
e2.addEventListener('mouseup',anyEventHandler);
e2.addEventListener('keydown',anyEventHandler);
e2.addEventListener('keyup',anyEventHandler);
b.onClick = function(){eInfo.text='';}
e1.active = true;
w.show();
This script gives unstable results. ScriptUI does not always report every event that actually occurs.
But as a general rule, what the user has done supersedes what the script can do.
Any help from ScriptUI / Mac gurus would be highly welcome.
@+
Marc

Similar Messages

  • [JS CS4/CS5] ScriptUI Click Event Issue in JSXBIN

    Still working on a huge ScriptUI project, I discovered a weird issue which appears to *only* affect 'binary compiled' scripts (JSXBIN export), not the original script!
    When you repeatedly use addEventListener() with the same event type, you theorically have the possibility to attach several handlers to the same component and event, which can be really useful in a complex framework:
    // Declare a 'click' manager on myWidget (at this point of the code)
    myWidget.addEventListener('click', eventHandler1);
    // Add another 'click' manager (for the same widget)
    myWidget.addEventListener('click', eventHandler2);
    When you do this, both eventHandler1 and eventHandler2 are registered, and when the user clicks on myWidget, each handler is called back.
    The following script shows that this perfectly works in ID CS4 and CS5:
    // Create a dialog UI
    var     u,
         w = new Window('dialog'),
         p = w.add('panel'),
         g = p.add('group'),
         e1 = p.add('statictext'),
         e2 = p.add('statictext');
    // Set some widget properties
    e1.characters = e2.characters = 30;
    g.minimumSize = [50,50];
    var gx = g.graphics;
    gx.backgroundColor = gx.newBrush(gx.BrushType.SOLID_COLOR, [.3, .6, .9, 1]);
    // g->click Listener #1
    g.addEventListener('click', function(ev)
         e1.text = 'click handler 1';
    // g->click Listener #2
    g.addEventListener('click', function(ev)
         e2.text = 'click handler 2';
    w.show();
    The result is that when you click on the group box, e1.text AND e2.text are updated.
    But now, if I export the above code as a JSXBIN from the ESTK, the 2nd event handler sounds to be ignored! When I test the 'compiled' script and click on the group box, only e1.text is updated. (Tested in ID CS4 and CS5, Win32.)
    By studying the JSXBIN code as precisely as possible, I didn't find anything wrong in the encryption. Each addEventListener() statement is properly encoded, with its own function handler, nothing is ignored. Hence I don't believe that the JSXBIN code is defective by itself, so I suppose that the ExtendScript/ScriptUI engine behaves differently when interpreting a JSXBIN... Does anyone have an explanation?
    @+
    Marc

    John Hawkinson wrote:
    Not an explanation, but of course we know that in JSXBIN you can't use the .toSource() method on functions.
    So the implication here is that perhaps the .toSource() is somehow implicated in event handlers and there's some kind of static workaround for it?
    Perhaps you can get around this by eval() or doScript()-ing strings?
    Thanks a lot, John, I'm convinced you're on the good track. Dirk Becker suggested me that this is an "engine scope" issue and Martinho da Gloria emailed me another solution —which also works— and joins Dirk's assumption.
    Following is the result of the various tests I did from your various suggestions:
    // #1 - THE INITIAL PROBLEM// =====================================
    // EVALUATED BINARY CODE
    var handler1 = function(ev)
         ev.target.parent.children[1].text = 'handler 1';
    var handler2 = function(ev)
         ev.target.parent.children[2].text = 'handler 2';
    var     u,
         w = new Window('dialog'),
         p = w.add('panel'),
         g = p.add('group'),
         e1 = p.add('statictext'),
         e2 = p.add('statictext');
    e1.characters = e2.characters = 30;
    g.minimumSize = [50,50];
    var gx = g.graphics;
    gx.backgroundColor = gx.newBrush(gx.BrushType.SOLID_COLOR, [.3, .6, .9, 1]);
    g.addEventListener('click', handler1);
    g.addEventListener('click', handler2);
    w.show();
    eval("@JSXBIN@[email protected]@MyBbyBn0AKJAnASzIjIjBjOjEjMjFjShRByBNyBnA . . . . .");
    // RESULT
    // handler 1 only, that's the issue!
    Now to John's approach:
    // #2 - JOHN'S TRICK
    // =====================================
    var handler1 = function(ev)
         ev.target.parent.children[1].text = 'handler 1';
    var handler2 = function(ev)
         ev.target.parent.children[2].text = 'handler 2';
    // EVALUATED BINARY CODE
    var     u,
         w = new Window('dialog'),
         p = w.add('panel'),
         g = p.add('group'),
         e1 = p.add('statictext'),
         e2 = p.add('statictext');
    e1.characters = e2.characters = 30;
    g.minimumSize = [50,50];
    var gx = g.graphics;
    gx.backgroundColor = gx.newBrush(gx.BrushType.SOLID_COLOR, [.3, .6, .9, 1]);
    g.addEventListener('click', handler1);
    g.addEventListener('click', handler2);
    w.show();
    eval("@JSXBIN@[email protected]@MyBbyBn0AIbCn0AFJDnA . . . . .");
    // RESULT
    // handler1 + handler2 OK!
    This test shows that if handler1 and handler2's bodies are removed from the binary, the script works. Note that the handlers are declared vars that refer to (anonymous) function expressions. (BTW, no need to use a non-main #targetengine.) This is not a definitive workaround, of course, because I also want to hide handlers code...
    Meanwhile, Martinho suggested me an interesting approach in using 'regular' function declarations:
    // #3 - MARTINHO'S TRICK
    // =====================================
    // EVALUATED BINARY CODE
    function handler1(ev)
         ev.target.parent.children[1].text = 'handler 1';
    function handler2(ev)
         ev.target.parent.children[2].text = 'handler 2';
    var     u,
         w = new Window('dialog'),
         p = w.add('panel'),
         g = p.add('group'),
         e1 = p.add('statictext'),
         e2 = p.add('statictext');
    e1.characters = e2.characters = 30;
    g.minimumSize = [50,50];
    var gx = g.graphics;
    gx.backgroundColor = gx.newBrush(gx.BrushType.SOLID_COLOR, [.3, .6, .9, 1]);
    g.addEventListener('click', handler1);
    g.addEventListener('click', handler2);
    w.show();
    eval("@JSXBIN@[email protected]@MyBbyBnACMAbyBn0ABJCnA . . . . .");
    // RESULT
    // handler1 + handler2 OK!
    In the above test the entire code is binary-encoded, and the script works. What's the difference? It relies on function declarations rather than function expressions. As we know, function declarations and function expressions are not treated the same way by the interpreter. I suppose that function declarations are stored at a very persistent level... But I don't really understand what happens under the hood.
    (Note that I also tried to use function expressions in global variables, but this gave the original result...)
    Thanks to John, Dirk, and Martinho for the tracks you've cleared. As my library components cannot use neither the global scope nor direct function declarations my problem is not solved, but you have revealed the root of my troubles.
    @+
    Marc

  • [至急]CS5.5 か CS6?Win かMacで迷い中.

    30代主婦、初心者です。
    Adobe CS5.5 Master Collection (Windows版)のパッケージと、
    CS5.5向けの参考書を所有しております。
    (既存のPC1台にインストールしただけ)
    これからWeb&DTPを勉強し、就職を目指す場合、
    【質問1】
    デザイナーの現場では、CS5.5が最も普及されているのでしょうか?
    (以前のバージョンを使用されている職場も多いようですが)
    【質問2】
    現場では、Macが8割、Windowsが2割くらいでしょうか?
    【質問2】
    CCを契約してCS6以降の知識がないと就職は厳しいでしょうか?
    CS5.5でほぼカバーできますでしょうか?
    【質問3】
    CS5.5とCS6では、機能や操作はだいぶ異なりますでしょうか?
    CS5.5を学べば、CS6もすぐに習得できるものでしょうか?
    【質問4】
    下記いずれかのPC購入を検討中です。
    いずれはWin、Mac 1台ずつ揃えたいですが、
    就職に備えた学習目的で購入する場合、先に購入すべきOS(おすすめの機種)と
    優先すべきCSのバージョンをアドバイス頂ければ幸いです。
    【質問5】
    メモリは8GB、SSD256GBで考えておりますが、初心者のWeb&DTP環境には十分でしょうか?
    13.3インチでも、Web&DTP制作業務にはあまり支障はないでしょうか?
    ■既存PC■
    Windows 7 64bit (Sony Vaio Eシリーズ  15.5インチ、型番:VPCEB29FJ)
    スペック | Eシリーズ | 製品情報 | 個人向け | VAIOパーソナルコンピューター | ソニー
    (CPU:intel core i5-450M / 2.40GHz、メモリ:4GB、解像度:WXGA 1366×768、HDD:500GB、BDドライブ搭載、USB2.0×3口、Office 2010)
    ■検討PC■
    MacBook Pro Retinaディスプレイ 2600/13.3 MGX82J/A
    価格.com - APPLE MacBook Pro Retinaディスプレイ 2600/13.3 MGX82J/A 価格比較
    TOSHIBA  dynabook KIRA V73(V63) 13.3インチ
    dynabook KIRA V73/PS (プレミアムシルバー) 型番:PVB73PS-KHA: 個人向けPC | 東芝ダイレクト
    TOSHIBA  dynabook R83 13.3インチ
    dynabook R83/PB (グラファイトブラック) 型番:PRB83PB-BUA: 個人向けPC | 東芝ダイレクト
    ■用途■
    インターネット(IE、Chrome)、Office (Word、Excel、PowerPoint)
    写真加工&保存(本体&外付けHDD、DropBox等)、筆ぐるめ
    Web & DTP系ソフト(Photoshop、Illustrator、Dreamweaver、Indesign等)の学習
    今のWindowsのまま、CS5.5から学ぶのが経済的ですが、
    処理速度が若干遅く、BDドライブも壊れ、買い替えを検討しており、
    新しいWindowsかMacで、Adobeを学習しようと思っております。
    出来れば、15.5インチ→13.3インチを新調したいのと、
    MOS資格のバージョンアップ受験の為、
    Office2010→Office 2013以降にもバージョンアップしたいです。
    OSとCSのバージョンは、どちらにも対応できるに越した事はないですが、
    予算や学習面から、まずは優先順位をつけたいです。
    Macは未経験ですが、その辺はあまり気にしておりません。
    既存PCに外付BDドライブを付けて、Office 365を契約し、
    Officeをバージョンアップしても良いのですが。
    Adobe系は動作が重く遅かったので、今のPCで使用することはあまり考えておりません。
    出来れば2月中に購入したく、ご教授の程よろしくお願いいたします。

    ご丁寧なご回答、誠にありがとうございます!
    育児中につき、返信が遅くなり大変恐縮です。
    質問番号が重複しており、大変失礼いたしました。
    印刷会社さんの統計があるんですね。
    比較的最近のデータで、とても参考になりました。
    低コストで効率的な学習目的であれば、
    現状の環境でも習得可能なようで良かったです。
    以前の職場やCafeで、
    デザイナーさんが打合せやちょっとした確認作業で、
    13~15インチを持参されている方が多かったので、
    それで事足りるのかと勘違いしておりました。
    基本はやはり大画面でデスクトップが前提なんですね。
    モニタサイズ及び解像度については、
    全くの無知ですので、大変参考になりました!
    独学では実績と見なされないため、
    やはり然るべき機関での学習が必須のようですね。
    通学は知人でも意見が分かれております。
    私も体験しましたが、どうもしっくりこなかったり。
    ですが、就職を想定した場合は、
    個人レベルでの学習には限界もあるかと存じますので、
    業界事情や就職相談、応用力、ポートフォリオ制作などの目的で、
    途中からの検討させて頂くことになるかと思います。
    就職先ですが、私の場合は家族が転勤族ですので、
    正社員ではなく、別の雇用形態を考えております。
    (地方のパート求人(初心者OK)で、PhotoshopやIllustratorでの加工、
    簡単な配布物、P作成・修正・更新作業レベルを想定。)
    いずれの雇用形態にしましても、厳しい道のりですが、
    慎重に検討した方が良さそうですね。
    Web・DTP業界は選択肢の一つで、
    情報収集段階ですので、考えが甘いのかも知れません。
    今ある環境を上手く活用し、働き方がマッチするのかについても、
    事前にしっかり調べておく必要がありそうですね。
    ご丁寧なアドバイス、誠にありがとうございました。

  • ICCprofileSize Win CS5 and MAC CS4/CS5

    Hi,
    I open 16 bit .ppm file and select "Leave as is (don't color manage)".
    Inside format plugin on formatSelectorWriteStart iCCprofile set to:
    1) Windows CS5 32 bit - 3144
    2) MAC CS5 64 bit - 0
    3) MAC CS5 32 bit - 0
    4) MAC CS4 32 bit - 3144
    Please advice me why on some platforms I have icc associated with image on some not.
    Thank you.

    It is the same code.
    It can be easily reproduced with SimpleFormat plugin sample
    1) Change SimpleFormat.r:
    FormatICCFlags { iccCannotEmbedGray,
    iccCanEmbedIndexed,
    iccCanEmbedRGB,
    iccCanEmbedCMYK },
    FormatICCRequiredFlags { iccGrayOptional,
    iccIndexedOptional,
    iccRGBRequired,
    iccCMYKOptional }
    2) print gFormatRecord->iCCprofileSize in the bbeginning of DoWriteStart(void)
    3) open color .ppm or .jpeg(without icc), select "leave as is(don't color manage)"
    4) save as SimpleFormat
    with CS5 on windows  iCCprofileSize == 3144, on MAC iCCprofileSize == 0
    Cheers

  • Using Photoshop CS4/CS5 and Lightroom 2/3 on Win 7 vs OSX

    I do NOT want to re-ignite the no-win discussion of pc vs mac. Now that CS5 is announced, yet again as I preprare to upgrade from CS4, I ask if I should convert fromWin7 64-bit on a PC to MAC Pro running OSX. I currently run a WIN 7 64-bit PC with 8 GB Ram. I would consider buying a MAC PRO with 8 GB RAM. The machine(s) are used strictly for image processing, no general office work or general internet surfing except as relates to supporting my software, etc. 
    I don't want to discuss PC vs MaC but I would like to understand the limits, advantages/disadvantages of one platform vs the other as specifically relates to CS4/CS5 and/or Lightroom 2/3. In other words are there functions or processes that I can do on one platform and not the other, or do better on one compared to the other, not does one cost more than the other any comments or help?? Mike

    As a casual user of CS products, I find no substantive differences between using them on a Mac vs. PC. I can cross post this question over to the Photoshop forum (originally posted to the Photoshop.com web site forum, which is not just about the desktop app).
    It's probably going to become a Mac vs. PC discussion, since the question is inherently 'which is better', but hopefully people will remain objective and constructive!
    -Mark

  • Feather error in Illustrator CS4, CS5 (Win)

    caribou_areas.ai (.98MB) (alternatively caribou_areas.zip (959 Kb))
    CS4 & CS5 Design Standard
    Intel Core 2 Duo CPU E8400 @ 3 GHz, 3 GB RAM
    Win XP (SP3)

    Yes, my message got posted before I intended - sorry :-o
    Then I lost my edit. Trying again...
    I'm having trouble applying a 5 pt feather via the Effect>Stylize menu to a closed path with a 17% transparent magenta fill: keep getting the message "an error occurred while processing the appearance of an object".
    All of the other similar, but smaller objects in the file which have less nodes don't cause the error when I feather them, so I wonder if there's something odd about this particular object (the largest one with the most nodes) that's provoking the error. Or if there's some kind of node/path limit for feathering.
    I get the same error if I try applying a feather to the same object when it has 100% magenta opacity; just upgraded from CS4 to CS5 and nothing has changed.
    I have posted the file here:
    http://www.claireart.ca/caribou_areas.ai
    or http://www.claireart.ca/caribou_areas.zip
    It represents endangered species areas which will look a lot nicer on my base map if I can feather the edges, so I'd appreciate any suggestions ;-)
    Thanks.
    Bill Horne
    Wells, BC Canada
    Design Standard CS4, CS5
    Windows XP (SP3)
    Intel Core 2 Duo E8400 @ GHz, 3 GB RAM

  • Mac: OS X Lion(10.7) CS4/CS5/CS5.5

    Hi all,
    I have currently a plugin that I build it on my Mac with OSX 10.6(Snow Leopard) and I can build it for 3 versions of CS including: CS4/CS5/CS5.5. Now I have to cach up with some of other Mac development stuff and need to upgrade to Lion and Xcode 4.1, Any idea/ thoughts on this case to be able to keep my old stuff (specially CS4) still compileable? I know I can have different version of Xcode on the same partition but not sure with pgrading to Lion what would be the restriction/losing with my situation?
    Thanks,
    Kamran

    Well, having some of your files written in big endian doesn't mean you can't read or write them with a program written in little endian.
    David, that was not what I implied. But if they rewrite it for Intel, they have to take very good care to swap to/from native to file endianess for every value they write (much like htonl() et. al are used in network programming). By releasing just a PPC binary, there was no need for conversion because native and file endianess happened to be identical.
    Adobe should develop a universal binary version of their CS4 odfrc-cmd, the little endian part doing the swap to keep things in big endian.
    I full heartedly agree. And I suggest everyone in need of this reports this issue to Adobe dev support. I'm not sure how much detail I'm at liberty to reveal on a public forum, but my report did not come to them as a surprise, and a little community pressure may help speed things up.
    Is there somewhere a description of what's in those files? Perhaps it is not so complicated to develop a little endian version of that tool...
    Not really. As Dirk suggested, it's basically Rez on steroids. Regrettably one has to parse the file down to every single int value that's defined in all of the many structures, and byte-swap just those. After that you have to put it all back together. It would be a huge pain, but not impossible.

  • ScriptUI Custom Events

    Hi all,
    Is there any chance I can propagate custom events in ScriptUI ? I tried this sample in ESTK and it works fine. However I tried to run it in several CS apps and all my attempts raised errors. My intenttion is to create custom components that would throw events listened by the parent window. Am I asking too much ?
    function test()
              var w = new Window('dialog');
              var btn = w.add('button');
              w.addEventListener ('custom', tata);
              btn.onClick = function()
                        w.close()
                        var e = new UIEvent('custom', true, true, w, null);
                        e.data= {test:"hello"};
                        w.dispatchEvent(e)
              function tata(e)
                        alert(e.data.test);
              w.show();
    test();
    Thanks for any hint/advice,
    Loic

    Hi Loïc,
    To my knowledge new UIEvent(…) works fine in InDesign (CS4/CS5/CS6) provided that you let the view parameter undefined.
    So just try to replace:
        var e = new UIEvent('custom', true, true, w, null);
    by:
        var e = new UIEvent('custom', true, true);
    Note: Usually a custom UI event should be dispatched from a specific target—in your case: btn.dispatchEvent(e)—rather than from the top window. This way you can have multiple listeners that the event will hit during the bubbling phase:
    // Propagation of a custom UI event (which bubbles)
    // Tested in ID CS4/CS5/CS6
    const EV_TYPE = 'MyCustomEventType';
    var u,
        w = new Window('dialog'),
        p = w.add('panel'),
        b = p.add('button',u,"Test"),
        evHandler = function(ev)
            alert( this + " is listening: " + ev.data );
        myDispatcher = function(data)
            var ev = new UIEvent(EV_TYPE, true, true);
            ev.data = data;
            this.dispatchEvent(ev);
    w.addEventListener(EV_TYPE, evHandler);
    p.addEventListener(EV_TYPE, evHandler);
    b.onClick = function(){ myDispatcher.call(this, "Some data"); }
    w.show();
    @+
    Marc

  • How can you tell what version of Illustrator (Ver. 10, CS4, CS5, CC Ver.17, etc.) saved artwork is in?

    Our company needs to save artwork we create in Illustrator in different versions depending on our various client's needs. Is there anyway to know what version of Illustrator (Version 10, CS4, CS5, CC Version17, etc.) saved artwork is in? When we view preferences it just shows the current version of the application not the version the individual artwork is saved at. Any advise would be extremely helpful. Thanks.

    If you are on a Mac there's always Get Info

  • Open Multi-Page PDF win/mac

    Que tal amigos foreros...en los foros en ingles muchos usuarios habian expresado la necesidad de editar PDFs Multipagina en Illustrator y mas los usuarios de PC, ya que por ahi existe un script, pero solamente es para mac. Asi que me di a la tarea de escribir uno...trabaja con CS4/CS5
    Espero les guste, o mas bien, espero les sea util
    si tienen preguntas o comentarios, dejenme saber
    Saludos, Carlos Canto

    Carlos,
    Muchas Gracias por tu colaboración y excelente script, el que se abra el ESTK no tiene mayor importancia.
    El caso es que Adobe recomienda encarecidamente NO utilizar Illustrator para editar PDFs, por diversas razones, aunque cuando no hay otro remedio o herramienta disponible, o conocida ...
    Para llegar aquí, aparte de San Google, hay que ir a Adobe.es (en mi caso), pestaña de Ayuda,  ..... (hasta aqui bien),
    luego hay que bajar hasta el final y ver Comunidad y Foros...... (esto puede ser)
    al pulsar aparacen un montón de foros se supone de programas pero en inglés,
    y la última línea es de International Forums,  ya casi hemos llegado)
    pulsamos entonces, y por fin se abren cuatro palabras con idiomas, en una dice: español      (casi no me lo puede creer)
    pincho y llego por fin aquí.
    Muy poca gente sabe de la existencia de este pequeño refugio, si a esta dificultad añadimos la peculiar forma de ser de la gente, ....

  • Long-time Elements user who had planned for CS4, CS5 or CS6 on disk

    As a long-time Elements user who had planned to purchase Photoshop CS4, CS5 or CS6 right before the Cloud changed everything, why can't I get the cloud subscription for $9.99? This makes me want to just buy an older disk on EBay or elsewhere.

    why can't I get the cloud subscription for $9.99?
    Are you trying to subscribe to the Photoshop Photography Program (PS+LR)?
    That deal is available to anyone, regardless of whether you've purchased Adobe software in the past or not.
    What is preventing you from subscribing?

  • CS6 Beta Modifies CS4 & CS5 Bridge File Associations (W7 Pro 64Bit SP1)

    Symptoms:
    After installing CS6 including bridge CS6 onto a W7 pro 64Bit Machine with SP1.
    The File associations in the existing copies of CS4 and CS5 bridge are updated to make the CS6 Beta the default programme for opening the majority of file types from either CS4 or CS5 bridge.
    When right clicking ona file from CS4/5 bridge only the option of opening in CS6 is presented
    Expected Bahaviour:
    I expected that CS6 would be the default programme launched from CS6 bridge but that CS4/CS5 would remain the default programmes launched from their own versions of bridge.
    Setting CS6 as the default file association in previous versions of bridge makes no sense at the Beta stage, as it interupts a clean migration back to existing workflow.
    I would also question the value in not preserving the existing file associations in prior versions of bridge in the final CS6 release, as there are cases when it might be desirable to go back to a previous version of CS, in which case opening that version of bridge and launching directly into the prior versions of CS is very desirable.
    Is there anyway to quickly restore the previous associations in CS4/CS5 bridge and be sure that they are exactly the same as prior to the CS6 beta install ?

    Sorry for the noise. I misunderstood your depth of knowlege and what you had tried. I also committed the sin of not testing the procedure all the way through because I did not want to change the association on my computer. I get the same behavior.
    Guess for .jpg
    Registry shows for .jpg:
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserCho ice  Progid = Applications\Photoshop.exe
    HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\Photoshop.exe\shell\open\command  (Default) = "C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Photoshop.exe" "%1"
    UserChoice seems to be added when I made the association choice. Note that it points into Applications with a non-version specific Photoshop.exe. Within HKLM\....\Applications there is only one Photoshop.exe -- no version -- and that entry points to CS6.
    I believe that explains why the browsed to association is CS6. It does not explain why it would be set up that way. Probably has something to do with Windows special handling of certain file extensions. Beyond my depth and tells me I am not going to find a solution.

  • I have Adobe Photoshop CS4 and have just upgraded my Mac operating system to Yosemite with the newest version of Java 2014 running. When I try to access Photoshop from Bridge or directly open it asks for a Legacy Version of Java 6. As I am a pensioner I c

    I have Adobe Photoshop CS4 and have just upgraded my Mac operating system to Yosemite with the newest version of Java 2014 running. When I try to access Photoshop from Bridge or directly open it asks for a Legacy Version of Java 6. As I am a pensioner I cannot afford an upgrade does anyone know of a work-around for this problem?

    Hi Daddyfred,
    CS4 Photoshop has not been tested on Yosemite. But still you can try the Java 6 update using the below link.
    http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419 409.html
    Thank you for posting on Adobe Forums.

  • HT4796 After migrating all of my adobe software (Cs4, cs5, etc.) to my new imac, the software won't open due to many errors. Any help on this?

    After migrating all of my adobe software (Cs4, cs5, etc.) to my new imac, the software won't open due to many errors. Any help on this?

    Welcome to the Apple Support Communities
    Adobe software is conflictive when you use Migration Assistant because their applications don't work properly after migration. If you keep the DVDs or the installers of your software, use them to reinstall all your Adobe applications and they should start working correctly

  • JS CS4 & CS5 working through the ScriptListener

    Working through the guide there is an example:
    var eventFile = new File(app.path + "/Presets/Scripts/Event Scripts Only/Welcome.jsx")
    app.notifiers.add( "Opn ", eventFile)
    There is 2 possible places to save this file in windows:
    C:\Program Files\Adobe\Adobe Photoshop CS5\Presets\Scripts
    or
    C:\Program Files\Adobe\Adobe Photoshop CS5\Presets\Scripts\Event Scripts Only
    I've tried both and when I open a file in Photoshop I do not get the alert.
    If I go into the Script Event Manager and set the above code to run on Open Document event it works.
    Is there a way to get this example to work without setting it up in the Script Event Mananger?
    Cheers.

    My experence is that you only need to set app.notifiers.enabled to true if it is not already set. It can be set to true by a script or the Scripts Events Manager.
    If you register an event using app.notifiers.add in ESTK the event does not run the script unless Photoshop is restarted. If it is added as part of a script run in Photoshop or the Script Events Manager it runs without restart.
    As X pointed out the scirpt can be anywhere, it doesn't have to be in one of those two locations. But for me events registered with the API remain registered from session to session untill removed.
    Here is a save way to register an event. Note that it only sets app.notifiers.enabled to true if it is false and registers the open event only if there is not already one.
    if(!app.notifiers.enabled) app.notifiers.enabled =  true;
    var hasOpenEvent = false;
    for(var e = 0;e<app.notifiers.length;e++){// the only way to tell which events are in use is to loop notifiers
         if(app.notifiers[0].event == 'Opn ') hasOpenEvent = true;
    if(!hasOpenEvent) {
         var eventFile = new File(app.path + "/Presets/Scripts/Event Scripts Only/Welcome.jsx");
         app.notifiers.add( "Opn ", eventFile);
    And as I understand it
    new File(app.path + "/Presets/Scripts/Event Scripts Only/Welcome.jsx");
    will only work with English versions of Photoshop.

Maybe you are looking for

  • Location services not working on Mountain Lion

    I am running OS X Mountain Lion and ever since I have updated location services haven't been working how they were in Lion. I have location services on in System Prefrences. When ever I encounter this problem I am using Wi-Fi. Please Help!

  • How do you rename, or change permissions on many files?

    **Note** there are SUDO commands here that can potentially wreck up your system.  If you have questions about this stuff, post in the forum or ask someone verbally to help.  The sudo command can really cause problems if you're not entirely sure what

  • [b]Problem with message choice[/b]

    Hi, all, I have a problem with message choice because when I get the value it returns the value of index row. For example I have this message choice: <messageChoice model="${bindings.Dept}" readOnly="false" required="no" name="dpt"> <contents childDa

  • URGENT: index not used from jdbc

    Hi, This is for java app and sybase database. I have a 'select' query for which index is properly created. If I use plain jdbc connection, index is used and result comes pretty fast. but if I use connection from my app, it does not use index and take

  • Is it possible to use a program as a filter between Windows and the user?

    I was interested in working on an ACL for Windows 98. What I'd like to do is whenever an app attempts to be opened by the user if they don't have permission through my program it will cancel the request. I'd like to do this in Java but I'm wondering