ScriptUI window.minimized = true; on Mac

I would like to make custom palettes for Illustrator which have the ability to get out of the way, similar to native palettes.  On Windows, my minimized = true; command works, and the palette shrinks into a tiny bar, which I like.  However, same command on Mac does not do the trick.
#target illustrator
#targetengine main
function myPanel(){
    var arr = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
    function paletteWindow(){
        var w = new Window('palette', 'My Panel', undefined, {resizeable: true});
        var g1 = w.add('group');
        var t = g1.add('treeview', undefined, []);   t.size = [200, 450];
        for(var i=0; i<arr.length; i++){
            var item = arr[i];
            var n = t.add('node', item);
        t.onDoubleClick = function(){
            if(t.selection != null && t.selection.text != ''){
                alert(t.selection.text);
        var btn_min = w.add('button', undefined, 'Minimize');
        btn_min.onClick = function(){
            w.minimized = true;
            w.update();
        w.onResizing = w.onResize = function () {this.layout.resize ();}
        w.onShow = function(){
            w.minimumSize.width = 220;
            w.minimumSize.height = 100;
            t.items[1].expanded = true;
        this.show = function(){w.show();}
    var thisPaletteWindow = new paletteWindow(); // have to call it like this, or it disappears.
    thisPaletteWindow.show();
myPanel();

Okay, I think I can live with the following workaround:
I can just have me a palette which has a button, the button shows the real palette and closes this one. The real palette has a button that closes that one and shows the tiny one!
Or, there can be a 'toolbar' which can show & hide other bigger palettes.
I made the following though, which uses window closing to get rid of non-visible windows. It is probably possible to do this by messing with the 'visible' property of the windows, and just keep one hidden. Well, with this setup, it's possible to pass in the configuration of the big palette as an object to be stored in the tiny window, and then to resurrect the element states of the big one when it's maximized, including the window's location so that it appears as if they are appearing back in the last place they were closed at. This could be re-purposed to pop up the big palette in the same location of the tiny one, so that they closer mimic the behavior of the native UI panels. This works for me in CC2014, so I may have to use this on a few things.
#target illustrator
#targetengine main
//need main engine here explicitly
function myPanel(){
    var arr = [];
    for(var i=33; i<123; i++){
        arr.push(String.fromCharCode(i)+" ------------------ text line");
    function tinyWindow(storeObj){
        var w = new Window('palette', 'MiniPanel', undefined, {borderless: false}); w.spacing = 0; w.margins = [0,0,0,0];
        w.location = storeObj.tinyWindowLocation;
        var btn = w.add('button', undefined, 'Maximize');
        this.show = function(){w.show();}
        btn.onClick = function(){
            storeObj.tinyWindowLocation = w.bounds;
            var thisPaletteWindow = new paletteWindow(storeObj);
            thisPaletteWindow.show();
            w.close();
    function paletteWindow(setupObj){
        var w = new Window('palette', 'My Panel');
        w.location = setupObj.bigWindowLocation;
        var g1 = w.add('group');
        var t = g1.add('treeview', undefined, []);  t.size = [200, 450];
        for(var i=0; i<arr.length; i++){
            var item = arr[i];
            var n = t.add('node', item);
        var e = w.add('edittext', undefined, setupObj.edittextContents, {readonly: true}); e.characters = 19;
        t.onDoubleClick = function(){
            if(t.selection != null && t.selection.text != ''){
                e.text = (t.selection.text);
        var btn_min = w.add('button', undefined, 'Minimize');
        btn_min.onClick = function(){
            var thisTinyWindow = new tinyWindow({edittextContents: e.text, tinyWindowLocation: setupObj.tinyWindowLocation, bigWindowLocation: w.location});
            thisTinyWindow.show();
            w.close();
        this.show = function(){w.show();}
    var thisTinyWindow = new tinyWindow({edittextContents: '', tinyWindowLocation: [920,514], bigWindowLocation: [860, 350]});
    thisTinyWindow.show();
myPanel();

Similar Messages

  • [PC / Mac] Modal vs. Non-modal ScriptUI windows issue

    Hi,
    in Photoshop ScriptUI 'dialog' Windows are supported (they're modal windows), while 'palette' Window's behavior is peculiar (they're non-modal, and as long as there's something going on in the script, they keep displaying - otherwise they automatically close). Apparently, this is different in InDesign (for instance), where palettes can stay idle - at least this is what I've been told.
    I've found a couple of workarounds to work with palette Windows (my goal is to show them in order to let the user interact with either PS and the script's GUI - just like you'd do with regular panels and extensions - that is: to work with them as non-modal, idle palettes that mimic extension behavior), namely:
    // usual Window stuff
    win.show()
    while (isDone === false) { // isDone is set true in win.onClose() etc.
      app.refresh();
    or
    var s2t = function(stringID) {
      return app.stringIDToTypeID(stringID);
    var waitForRedraw = function() {
      var d;
      d = new ActionDescriptor();
      d.putEnumerated(s2t('state'), s2t('state'), s2t('redrawComplete'));
      return executeAction(s2t('wait'), d, DialogModes.NO);
    // Window stuff
    while (isDone === false) { // isDone is set true in win.onClose() etc.
      waitForRedraw()
    The problem is as follows:
    1. They both work on Mac, either CS5 and CS6
    2. app.refresh() seems to work on PC + CS5, but not PC + CS6
    3. waitForRedraw() fails on both PC + CS5 and PC + CS6.
    Mind you: When I wrote that the workarounds fails in CS5 and/or CS6 on PC, I mean that the 'palette', idle windows are modal and not non-modal as it is on Mac (which is my main coding platform).
    [EDIT] Further testing has shown that PC palettes are... halfway between modal and non-modal. For instance, you can click on menus, but not select a Tool; you can collapse or drag a panel, but not access its content. You can't absolutely click on the image - for instance I'm desperately trying to enable panning on PC palettes: no way, you can't have the Hand tool to click&drag the image. For some reason, a "soft-scrolling" is enabled (on my MacBookPro, two fingers scrolling in all directions in the trackpad - but how to mimic this behavior in a desktop PC with no trackpad I don't know). Weirdly enough, the trackpad's "soft-scrolling" works in all directions on PC + CS5 64bits only, either CS5 @32bits, CS6 @32/64bits goes up and down only, no left/right allowed - frankly, to deal with platform-dependent issues is one thing, to take into account 32/64bits too is... ehm...
    So, to sum up there are big differences in the ScriptUI behavior depending on how platform and PS version are combined:
    PC, 'palette' Window:
    CS5 + waitForRedraw() = modal
    CS5 + app.refresh() =  non-modal
    CS6 + (app.refresh() OR waitForRedraw()) = modal
    Mac, 'palette' Window:
    (CS5 OR CS6) + (app.refresh() OR waitForRedraw()) = non-modal
    Is there any... "working workaround" to make on PC CS6 a 'palette' ScriptUI Window to keep a non-modal, idling behavior? (the unasked question is: why is that palettes are behaving as non-modal in CS5 and not in CS6?! )
    Thanks in advance!
    Davide
    Message was edited by: DBarranca - added blue text, further testing comparing 32/64bit versions

    In the meantime, I've published two posts either describing in detail my issues:
    ScriptUI Window in Photoshop - palette vs. dialog
    and testing a workaround:
    ScriptUI - BridgeTalk persistent window examples
    Hopefully they may be useful to others as well.
    Regards
    Davide

  • JS ScriptUI window too busy to accept a click

    I have a script that shows a Script UI 'window' (resizable, with minimize/maximize buttons etc).
    The users can keep this interface minimized or put it beside the document, and still work with the active document (which is good).
    (A previous interface for the same "main import code", used the old InDesign modal dialogue, that did not allow this.)
    My problem is that as soon as I click the "start" button on this ScriptUI window, I can no longer interact with the form, until it's all done. It seems to be "too busy" to interact with anything at all, while running the main code loop. I can't even move the window.
    The Esc (Escape) button does not work (I wouldn't expect it to either).
    When the main loop (initiated by the Start-button) is done, the form is accessible again.
    Is there a way to let the main code "wait" a fraction of a second, to let it accept button clicks? I'd like to have an abort button on the window, or just any way to let a user abort the script code before it's all done.
    Thanks,
    Andreas

    Andreas,
    You can try using
    myPalette.update();
    Where si myPalette your variable name for ScriptUI palette.
    Unfortunately, there are some issues on MacOS when update is happening too quickly.
    Hope that helps.
    Marijan (tomaxxi)
    http://tomaxxi.com

  • [JS] ScriptUI window unefficient in binary mode :-(

    Hi,
    I have a fully functional scriptUI window.
    If I export the script as binary, the window appears suddenly then close.
    Usually, this problem is solved by #targetengine session
    But this line does exists in the script. So it seems that the matter really comes from the binary export.
    Is that a known issue ? Is there a workaround ?
    TIA Loic

    I use CS3, so yes.
    Please post the code that is not working for you (just a minimal example of the load of a binary).
    I use the following to load a binary:
    var basePath = getScriptsFolderPath();
    script = loadScript(basePath + 'folderInTheSameFolderAsTheLoadScript/myBinaryFile.jsxbin');
    if(script != null && script1 != null)  {
        eval(script);
    function loadScript (in_filename) {
        var script = null;
        var file = File(in_filename);
        do {
            if (! file.exists) {
                break;
            if (! file.open()) {
                break;
            script = file.read();
            file.close();
        } while (false);
        return script;
    function getScriptsFolderPath() {
        var err;
        try {
            var script = app.activeScript;
        }  catch(err) {
            var script = File(err.fileName);
        return script.path + '/';   
    Thomas B. Nielsen
    http://www.lund-co.dk

  • HT202213 my mac can see windows home sharing but windows cant see my mac home sharing?

    Hi,
    I have set up home sharing on a mac and a windows pc. My mac ITunes is showing the 'sharing' menu with my windows pc listed however the windows ITunes isn't showing the 'sharing' menu........ can anyone assist please?
    thanks

    DIngo Dave 69 wrote:
    I am running Snow Leopard and on my seperate windows 7 machine I can see and connect to my mac. However I cannot get the Mac to connect to the Windows 7 machine. Even home sharing is not working on itunes.
    Can anyone help?
    Maybe
    On the Win7 machine,
    1. Ignore everything to do with Homegroup.
    2. Go > Computer > Users > User; right click on User and chose Share with > Specific people; and Set to share with a specific individual or Everyone—both with Read/Write permission.
    3. Go Control Panel > Network and Sharing Options > Advanced sharing Settings, and Turn on network discovery, Turn on file and printer sharing, Turn off public folder sharing , and Turn off password protected sharing (unless sharing won’t occur without turning it on).
    4. Restart (probably not necessary, but I’d do it).
    On the Sno machine,
    1. Go System Preferences > Sharing > Check File sharing > Go Options > Enable SMB sharing.
    2. Go System Preferences > Network > Select Airport or Ethernet depending on what you are going to be using. I am assuming you will be using wireless below. Let me know if not true.
    3. Having selected Airport, select ask to join new networks and show Airport status in menu bar.
    4. Click advanced > click remember networks this computer has joined > Click Wins > Enter the ip address of your Win7 machine in the WINS server box > Enter the Win7's workgroup name in the workbook box unless it already is there (look in the drop down menu too). In all likelihood the name is workgroup, but check on the Win7 machine.
    5. Restart (probably not necessary, but I’d do it).
    Try to connect to your Win7. Use Go menu > Connect to server. In trying to connect, type smb://ipaddress (of the Win7 machine). If, for some reason, you are asked to, input a user name and password, then use you user name and password for the Win7. Don't save anything to Keychain now and actually never for making network connections.

  • Is it true that Mac's can get a genuine Virus? I've heard they can't.

    Is it true that Mac's can get a genuine Virus? I've heard they can't.

    OS X already includes everything it needs to protect itself from viruses and malware. Keep it updated with software updates from Apple.
    A much better question is "how should I protect my Mac":
    Never install any product that claims to "speed up", "clean up", "optimize", or "accelerate" your Mac. Without exception, they will do the opposite.
    Never install pirated or "cracked" software, software obtained from dubious websites, or other questionable sources. Illegally obtained software is almost certain to contain malware.
    Don’t supply your password in response to a popup window requesting it, unless you know what it is and the reason your credentials are required.
    Don’t open email attachments from email addresses that you do not recognize, or click links contained in an email:
    Most of these are scams that direct you to fraudulent sites that attempt to convince you to disclose personal information.
    Such "phishing" attempts are the 21st century equivalent of a social exploit that has existed since the dawn of civilization. Don’t fall for it.
    Apple will never ask you to reveal personal information in an email. If you receive an unexpected email from Apple saying your account will be closed unless you take immediate action, just ignore it. If your iTunes or App Store account becomes disabled for valid reasons, you will know when you try to buy something or log in to this support site, and are unable to.
    Don’t install browser extensions unless you understand their purpose. Go to the Safari menu > Preferences > Extensions. If you see any extensions that you do not recognize or understand, simply click the Uninstall button and they will be gone.
    Don’t install Java unless you are certain that you need it:
    Java, a non-Apple product, is a potential vector for malware. If you are required to use Java, be mindful of that possibility.
    Disable Java in Safari > Preferences > Security.
    Despite its name JavaScript is unrelated to Java. No malware can infect your Mac through JavaScript. It’s OK to leave it enabled.
    Block browser popups: Safari menu > Preferences > Security > and check "Block popup windows":
    Popup windows are useful and required for some websites, but popups have devolved to become a common means to deliver targeted advertising that you probably do not want.
    Popups themselves cannot infect your Mac, but many contain resource-hungry code that will slow down Internet browsing.
    If you ever see a popup indicating it detected registry errors, that your Mac is infected with some ick, or that you won some prize, it is 100% fraudulent. Ignore it.
    Ignore hyperventilating popular media outlets that thrive by promoting fear and discord with entertainment products arrogantly presented as "news". Learn what real threats actually exist and how to arm yourself against them:
    The most serious threat to your data security is phishing. To date, most of these attempts have been pathetic and are easily recognized, but that is likely to change in the future as criminals become more clever.
    OS X viruses do not exist, but intentionally malicious or poorly written code, created by either nefarious or inept individuals, is nothing new.
    Never install something without first knowing what it is, what it does, how it works, and how to get rid of it when you don’t want it any more.
    If you elect to use "anti-virus" software, familiarize yourself with its limitations and potential to cause adverse effects, and apply the principle immediately preceding this one.
    Most such utilities will only slow down and destabilize your Mac while they look for viruses that do not exist, conveying no benefit whatsoever - other than to make you "feel good" about security, when you should actually be exercising sound judgement, derived from accurate knowledge, based on verifiable facts.
    Do install updates from Apple as they become available. No one knows more about Macs and how to protect them than the company that builds them.
    Summary: Use common sense and caution when you use your Mac, just like you would in any social context. There is no product, utility, or magic talisman that can protect you from all the evils of mankind.

  • What are the chances on installing Windows 8 pro on mac?

    Hi guys, i just wanna know if what are the chances on installing a windows 8 pro on mac?
    I just bought a CD of windows 8 pro. Im planning to use it on my mac because i am currently studying a software which is applicable on windows such as Visual Studio 2008, 2010 or 2012.
    I am planning to use bootcamp for windows 8 pro, i dont like to use parallels or vm.
    and i heard about bootcamp doesnt support windows 8, is that true?
    If it is true, so does it means it is not possible to use windows 8 using bootcamp?
    Am i right that bootcamp offers the drivers or something?
    Or can i just update the drivers for windows manually, u know the thing which u can found it on control panel on windows.

    Grazzii wrote:
    Running Windows 8 on my iMac right now buddy. You don't actually need Bootcamp to do all the heavy work for you - it's just a parition tool. However, you will need Bootcamp tools once Windows is installed to get the most out of windows. Without the Bootcamp tools installed, Windows will run - your mouse and keyboard should also work, but the resolution, graphics, speed.etc will all be a little over the place. I used Bootcamp tools 3.0 as it came with my iMac, not sure if the latest 4.0 works...
    Boot Camp 5.1 is the latest version, but no version includes drivers for Windows 8.

  • My phone is not showing up in itunes.  I want to sync it.  I have a MAC and I have restarted the phone, it's charged, I have the most current version of itunes.  What do I do now?  It says to reinstall itunes if you have windows but not for mac.  Help!

    My phone is not showing up in itunes.  I want to sync it.  I have a MAC and I have restarted the phone, it's charged, I have the most current version of itunes.  What do I do now?  It says to reinstall itunes if you have windows but not for mac.  Help!

    With your phone plugged in, open Image Capture and see if the iPhone shows up.  If not, you are having a sync problem.  If it shows up in Image Capture, but not iTunes, I'd delete iTunes and reinstall it.

  • How do I transfer my iTunes library from a Windows laptop to a Mac?

    Help, How do I transfer my itunes library froma windows laptop to a Mac?
    I'm not the most technically gifted!

    Type "move itunes library from mac to pc" into the google search bar.
    Please turn off your caps lock.  All caps indicates shouting, is considered rude and is difficult to read.  Many will not read such posts.

  • I have Macbook Pro 13" mid 20012. How to install Windows 8 onto the mac using DVD? 10.8.3

    the title says it all.
    i have windows 8 DVD and i would like to have a clear instructions on how to install windows 8. I dont understand the need for USB

    Welcome to the Apple Support Communities
    You need a USB drive to install the Windows support software. It contains all the drivers that your MacBook Pro needs, and you will have to install them after finishing the Windows installation. If you don't install them, a lot of things won't work: the wireless card, the sound card, the brightness, the trackpad gestures... Apart from that, you don't need it for anything else.
    Apple has released the official steps to install Windows 8 on a Mac, so if you want, print this PDF > http://manuals.info.apple.com/en_US/boot_camp_install-setup_10.8.pdf

  • Can I use windows software on my mac?

    May seem like a silly question, but when I purchased my macbook, I was told that I could reserve a portion of the harddrive to run windows software. I need to run Quickbooks Pro that I have in windows form. How do I load it onto my macbook???

    Ok, several ways.
    Apparently, there's a wine-like solution for Mac, so you can run windows software from within Mac OS X. Expect it to be somewhat buggy and imperfect though, and it might not run some software. It's coming out soon as far as I know. I saw in on MacRumors a while ago.
    Then there's the Apple solution called Boot Camp. What it does is just allow you to dual boot. It means you will actually be running windows on the machine.
    And then a new user favorite, is using machine emulation, it emulates a second machine inside the current machine allowing you to run Windows inside Mac OS X. It's very memory-hungry, though, and somewhat slower usually. Look into Parallels and QEMU.

  • Transferring Playlists From A Windows Computer to a Mac (with an IPod???)

    I recently switched from a Windows computer to a Mac and the folk at the Apple Store copied my documents and music files to the new Mac. All of my music that I had on ITunes on the Windows computer was transferred, including all the purchased music. The only thing that wasn't transferred were my extensive playlists, which I've spent years creating. I figured I could do it with my IPod and I was about to synch my IPod with the new Mac, when I saw the message advising me that everything on the IPod would be erased including, presumably, the existing playlists. Now, I realize I could simply print out what's on the playlists from my old Windows computer and manually recreate the playlists, but that would be a laborious pain in the butt. There's gotta be a simpler way but so far so one seems to be able to tell me what it is. A few people have told me there's no way to do it, but I have to believe there's a way because it would be foolish and dumb for there not to be. Any ideas? Thanks.

    There are a number of third party utilities that you can use to retrieve music files and clone playlists from an iPod. You could start your research with the three below, I believe they can all copy playlists and other data. If you search the web I'm sure you'll find others:
    iRepo Mac & Windows (iPhone and iPod Touch compatible)
    iPod Access Mac & Windows (iPhone and iPod Touch compatible)
    TouchCopy Mac & Windows (iPhone and iPod Touch compatible)

  • Parallels: transferring info from a Windows program to a Mac program

    I've been devoted to a Mac for a few years now, but I recently had to switch back to Windows because of its far superior voice recognition software. (I was recently disabled, and now rely on voice recognition to type.)
    If I were to buy a new Mac and use my Dragon NaturallySpeaking professional software (the Windows voice recognition program) via Parallels, does anyone know if I would be able to use that to type in a Macintosh program? I understand that I could stay within the virtual Windows platform or do separate tasks on the Mac platform, but I'm not sure if I would be able to transfer the information gathered by the Windows program into a Mac program.
    If I'm able to do this, it would mean I could finally switch back to a Mac. Thanks in advance!

    If I were to buy a new Mac and use my Dragon
    NaturallySpeaking professional software (the Windows
    voice recognition program) via Parallels, does anyone
    know if I would be able to use that to type in a
    Macintosh program?
    No
    iFelix

  • How can i install windows game on my mac actually i download a cricket game 2009 how i can inastall in mac

    how can i install windows game on my mac. actually i download a cricket game 2009 how i can inastal in mac

    It will never run in OS X. You need to install Windows on your machine.

  • How do I share files from Windows Vista to a Mac with Lion OSX?

    How do I share files from Windows Vista to a Mac with Lion OSX?  I'm having SO much trouble with this!  Any help would be appreciated!!!

    In a finder window, under 'shared' you should be able to see the windows computer name, click on it and connect to it. I am assuming here you have sharing turned on and permissions granted on the windows computer.
    Will add a note though, I have frequently accessed files from a PC on the LAN using XP, not vista.

Maybe you are looking for