Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
0

Need a way to hide a layer in a document from UI (Locked — Duplicate Post)

Community Beginner ,
Jul 03, 2017 Jul 03, 2017

Hi experts,

I have a requirement to add a Text to layer and make it uneditable to user.

I have tried to Lock, hide, diable edit layers as well as textFrame inside the layer via Scripting, however in Illustrator UI, user has the option to make the layer or Frame editable which makes user to make changes.

So, looking for an option to lock, hide the layer from UI.

Here is the code I used:

// Finds the tags associated with the selected art item,

// show names and values in a separate document

if ( app.documents.length > 0 )

{

    doc = app.activeDocument;

    if ( doc.selection.length > 0 )

    {

            for ( i = 0; i < doc.selection.length; i++ )

            {

                        selectedArt = selection[0];

                        tagList = selectedArt.tags;

                        if (tagList.length == 0)

                        {

                                var tempTag = tagList.add();

                                tempTag.name = "OneWord";

                                tempTag.value = "anything you want";

                         }

             }      

        // Create a document and add a line of text per tag

        var reportDocument = app.documents.add();

        top_offset = 400;

      

        for ( i = 0; i < tagList.length; i++ )

        {

                    tagText = tagList.value;

                    newItem = reportDocument.textFrames.add();

                    newItem.contents = "Tag: (" + tagList.name +

                    " , " + tagText + ")";

                    newItem.position = Array(100, top_offset);

                    newItem.enableAccess = false;

                    newItem.editable = false;

                    newItem.locked = true;

                    newItem.hidden = true;

                    newItem.layer.visible = false;

                    newItem.layer.opacity = 0;

                    newItem.layer.preview = false;

                    newItem.layer.locked = true;

                    newItem.layer.enable=false;

                    newItem.layer.requirePermissionPassword = true;

                    newItem.layer.permissionPassword = "Vinnudear";

                    newItem.textRange.size = 24;

                    top_offset = top_offset - 20;

                   // newItem.layer.parent.save();

        //newItem.layer.parent.saveNoUI("c:\\temp\\LockTest.ai");

        //newItem.layer.parent.requirePermissionPassword = true;

        //newItem.layer.parent.permissionPassword = "teamcenter";

        newItem.note = "USER:VINAY";

        alert(newItem.note);

        } 

    }

}

Regards,

Vinay

Message was edited by: Vinay Seera

323
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 03, 2017 Jul 03, 2017

You may receive a better response  at the Illustrator Scripting  forum

Translate
Adobe
Community Expert ,
Jul 03, 2017 Jul 03, 2017

You may receive a better response  at the Illustrator Scripting  forum

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 04, 2017 Jul 04, 2017
LATEST

This discussion is locked. Please see duplicate post at Need a way to hide a layer in a document from UI .

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines