{"id":8,"date":"2025-03-17T22:41:41","date_gmt":"2025-03-17T13:41:41","guid":{"rendered":"https:\/\/cg-method.com\/photoshop\/?p=8"},"modified":"2026-09-20T15:03:28","modified_gmt":"2026-09-20T06:03:28","slug":"select-layers-by-name","status":"publish","type":"post","link":"https:\/\/cg-method.com\/photoshop\/select-layers-by-name\/","title":{"rendered":"Photoshop\u30b9\u30af\u30ea\u30d7\u30c8\uff08jsx\uff09\u2502\u30ec\u30a4\u30e4\u30fc\u540d\u3067\u30ec\u30a4\u30e4\u30fc\u9078\u629e\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Photoshop\u3067\u6307\u5b9a\u3057\u305f\u540d\u524d\u306e\u30ec\u30a4\u30e4\u30fc\u3092\u691c\u7d22\u3057\u3001\u9078\u629e\u72b6\u614b\u306b\u3059\u308bJSX\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1017\" height=\"670\" src=\"https:\/\/cg-method.com\/photoshop\/wp-content\/uploads\/2025\/03\/2025-03-17_23h07_29.png\" alt=\"Photoshop\u3067\u6307\u5b9a\u3057\u305f\u540d\u524d\u306e\u30ec\u30a4\u30e4\u30fc\u3092\u691c\u7d22\u3057\u3066\u9078\u629e\u72b6\u614b\u306b\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u52d5\u4f5c\u30a4\u30e1\u30fc\u30b8\u3002\" class=\"wp-image-22\" srcset=\"https:\/\/cg-method.com\/photoshop\/wp-content\/uploads\/2025\/03\/2025-03-17_23h07_29.png 1017w, https:\/\/cg-method.com\/photoshop\/wp-content\/uploads\/2025\/03\/2025-03-17_23h07_29-300x198.png 300w, https:\/\/cg-method.com\/photoshop\/wp-content\/uploads\/2025\/03\/2025-03-17_23h07_29-768x506.png 768w\" sizes=\"auto, (max-width: 1017px) 100vw, 1017px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Photoshop\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u30ec\u30a4\u30e4\u30fc\u540d\u304b\u3089\u30ec\u30a4\u30e4\u30fc\u3092\u9078\u629e\u3059\u308b\u65b9\u6cd5<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u30b9\u30af\u30ea\u30d7\u30c8\u4f5c\u6210\u6642\u306e\u30dd\u30a4\u30f3\u30c8\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list is-style-num_circle\">\n<li><code>app.activeDocument<\/code>\u304c\u5b58\u5728\u3059\u308b\u304b\u3092\u30c1\u30a7\u30c3\u30af<\/li>\n\n\n\n<li><code>doc.layers.getByName(\"\u80cc\u666f\")<\/code>\u304c\u5b58\u5728\u3059\u308b\u304b\u3092\u30c1\u30a7\u30c3\u30af<\/li>\n\n\n\n<li>\u4efb\u610f\u306e\u30ec\u30a4\u30e4\u30fc\u540d\u3092\u53d7\u3051\u53d6\u308c\u308b\u3088\u3046\u306b\u95a2\u6570\u5316<\/li>\n<\/ul>\n\n\n\n<p class=\"is-style-icon_pen wp-block-paragraph\">\u30b0\u30eb\u30fc\u30d7\u5185\u306e\u5b50\u30ec\u30a4\u30e4\u30fc\u3084\u5b6b\u30ec\u30a4\u30e4\u30fc\u306f\u3001\u3053\u306e\u8a18\u8ff0\u3067\u306f\u76f4\u63a5\u53d6\u5f97\u30fb\u9078\u629e\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Photoshop\u306e\u307b\u304b\u306e\u81ea\u52d5\u5316\u51e6\u7406\u3084\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u3001\u307e\u3068\u3081\u8a18\u4e8b\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n<div class=\"swell-block-postLink\">\t\t\t<div class=\"p-blogCard -internal\" data-type=\"type1\" data-onclick=\"clickLink\">\n\t\t\t\t<div class=\"p-blogCard__inner\">\n\t\t\t\t\t<span class=\"p-blogCard__caption\">\u3042\u308f\u305b\u3066\u8aad\u307f\u305f\u3044<\/span>\n\t\t\t\t\t<div class=\"p-blogCard__thumb c-postThumb\"><figure class=\"c-postThumb__figure\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cg-method.com\/photoshop\/wp-content\/uploads\/2026\/09\/photoshop-matome-3-300x169.jpg\" alt=\"\" class=\"c-postThumb__img u-obf-cover\" width=\"320\" height=\"180\"><\/figure><\/div>\t\t\t\t\t<div class=\"p-blogCard__body\">\n\t\t\t\t\t\t<a class=\"p-blogCard__title\" href=\"https:\/\/cg-method.com\/photoshop\/photoshop-matome\/\">Photoshop\u306e\u4f7f\u3044\u65b9\u307e\u3068\u3081\uff5c\u30ec\u30a4\u30e4\u30fc\u64cd\u4f5c\u30fb\u66f8\u304d\u51fa\u3057\u30fb\u30b9\u30af\u30ea\u30d7\u30c8<\/a>\n\t\t\t\t\t\t<span class=\"p-blogCard__excerpt\">Photoshop\u306e\u8a18\u4e8b\u3092\u3001\u3084\u308a\u305f\u3044\u3053\u3068\u304b\u3089\u63a2\u305b\u308b\u3088\u3046\u306b\u5206\u985e\u3057\u307e\u3057\u305f\u3002 \u540c\u3058\u4f5c\u696d\u3092\u4f55\u5ea6\u3082\u7e70\u308a\u8fd4\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u9805\u76ee\u3082\u3054\u89a7\u304f\u3060\u3055\u3044\u3002 \u5404\u30ab\u30c6\u30b4\u30ea\u30fc\u306f\u95b2\u89a7\u6570\u306e\u591a&#8230;<\/span>\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\n\n<p class=\"wp-block-paragraph\">\u30b3\u30fc\u30c9\u5185\u306e\u300c\u80cc\u666f\u300d\u3068\u8a18\u8ff0\u3055\u308c\u3066\u3044\u308b\u7b87\u6240\u3092\u3001\u9078\u629e\u3057\u305f\u3044\u30ec\u30a4\u30e4\u30fc\u540d\u306b\u5909\u66f4\u3057\u3066\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>\/\/ \u73fe\u5728\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u53d6\u5f97\nvar doc = app.activeDocument;\n\n\/\/ \u30ec\u30a4\u30e4\u30fc\u3092\u6307\u5b9a\u3057\u3066\u53d6\u5f97\u3059\u308b\u95a2\u6570\nfunction getLayerByName(layerName) {\n    try {\n        return doc.layers.getByName(layerName);\n    } catch (e) {\n        alert(&quot;\u30ec\u30a4\u30e4\u30fc\u540d &#39;&quot; + layerName + &quot;&#39; \u306f\u5b58\u5728\u3057\u307e\u305b\u3093\u3002&quot;);\n        return null;\n    }\n}\n\n\/\/ \u6307\u5b9a\u3057\u305f\u30ec\u30a4\u30e4\u30fc\u540d\u3092\u53d6\u5f97\uff08\u30c7\u30d5\u30a9\u30eb\u30c8\u306f &quot;\u80cc\u666f&quot;\uff09\nvar targetLayer = getLayerByName(&quot;\u80cc\u666f&quot;);\n\nif (targetLayer) {\n    doc.activeLayer = targetLayer;\n}<\/code><\/pre><\/div>\n\n<!-- cgm-topic:start -->\n\n\n<p class=\"wp-block-paragraph\">\u30ec\u30a4\u30e4\u30fc\u3092\u9078\u629e\u30fb\u64cd\u4f5c\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u306f\u3001\u307b\u304b\u306b\u3082\u7d39\u4ecb\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n<div class=\"swell-block-postLink\">\t\t\t<div class=\"p-blogCard -internal\" data-type=\"type1\" data-onclick=\"clickLink\">\n\t\t\t\t<div class=\"p-blogCard__inner\">\n\t\t\t\t\t<span class=\"p-blogCard__caption\">\u3042\u308f\u305b\u3066\u8aad\u307f\u305f\u3044<\/span>\n\t\t\t\t\t<div class=\"p-blogCard__thumb c-postThumb\"><figure class=\"c-postThumb__figure\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cg-method.com\/photoshop\/wp-content\/uploads\/2025\/03\/select-layer-by-name-ignore-hierarchy-300x169.jpg\" alt=\"\" class=\"c-postThumb__img u-obf-cover\" width=\"320\" height=\"180\"><\/figure><\/div>\t\t\t\t\t<div class=\"p-blogCard__body\">\n\t\t\t\t\t\t<a class=\"p-blogCard__title\" href=\"https:\/\/cg-method.com\/photoshop\/select-layer-by-name-ignore-hierarchy\/\">Photoshop\u30b9\u30af\u30ea\u30d7\u30c8\uff08jsx\uff09\u2502\u968e\u5c64\u95a2\u4fc2\u306a\u304f\u30ec\u30a4\u30e4\u30fc\u540d\u3067\u30ec\u30a4\u30e4\u30fc\u9078\u629e\u3059\u308b\u65b9\u6cd5<\/a>\n\t\t\t\t\t\t<span class=\"p-blogCard__excerpt\">Photoshop\u3067\u30ec\u30a4\u30e4\u30fc\u306e\u968e\u5c64\u306b\u95a2\u4fc2\u306a\u304f\u3001\u6307\u5b9a\u3057\u305f\u30ec\u30a4\u30e4\u30fc\u540d\u3067\u691c\u7d22\u3057\u3066\u9078\u629e\u72b6\u614b\u306b\u3059\u308bJSX\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002 Photoshop\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u968e\u5c64\u306b\u95a2\u4fc2\u306a\u304f\u30ec\u30a4\u30e4\u30fc\u540d\u3067&#8230;<\/span>\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\n<div class=\"swell-block-postLink\">\t\t\t<div class=\"p-blogCard -internal\" data-type=\"type1\" data-onclick=\"clickLink\">\n\t\t\t\t<div class=\"p-blogCard__inner\">\n\t\t\t\t\t<span class=\"p-blogCard__caption\">\u3042\u308f\u305b\u3066\u8aad\u307f\u305f\u3044<\/span>\n\t\t\t\t\t<div class=\"p-blogCard__thumb c-postThumb\"><figure class=\"c-postThumb__figure\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cg-method.com\/photoshop\/wp-content\/uploads\/2025\/03\/select-lower-layer-300x169.jpg\" alt=\"\" class=\"c-postThumb__img u-obf-cover\" width=\"320\" height=\"180\"><\/figure><\/div>\t\t\t\t\t<div class=\"p-blogCard__body\">\n\t\t\t\t\t\t<a class=\"p-blogCard__title\" href=\"https:\/\/cg-method.com\/photoshop\/select-lower-layer\/\">Photoshop\u30b9\u30af\u30ea\u30d7\u30c8\uff08jsx\uff09\u25021\u3064\u4e0b\u306e\u8868\u793a\u30ec\u30a4\u30e4\u30fc\u3092\u9078\u629e\u3059\u308b\u65b9\u6cd5<\/a>\n\t\t\t\t\t\t<span class=\"p-blogCard__excerpt\">Photoshop\u30671\u3064\u4e0b\u306e\u8868\u793a\u30ec\u30a4\u30e4\u30fc\u3092\u9078\u629e\u3059\u308bJSX\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002 Photoshop\u30b9\u30af\u30ea\u30d7\u30c8\u30671\u3064\u4e0b\u306e\u8868\u793a\u30ec\u30a4\u30e4\u30fc\u3092\u9078\u629e\u3059\u308b\u65b9\u6cd5 \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u4e3b\u306a\u30dd\u30a4\u30f3\u30c8\u306f\u4ee5\u4e0b\u306e&#8230;<\/span>\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\n<div class=\"swell-block-postLink\">\t\t\t<div class=\"p-blogCard -internal\" data-type=\"type1\" data-onclick=\"clickLink\">\n\t\t\t\t<div class=\"p-blogCard__inner\">\n\t\t\t\t\t<span class=\"p-blogCard__caption\">\u3042\u308f\u305b\u3066\u8aad\u307f\u305f\u3044<\/span>\n\t\t\t\t\t<div class=\"p-blogCard__thumb c-postThumb\"><figure class=\"c-postThumb__figure\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cg-method.com\/photoshop\/wp-content\/uploads\/2025\/03\/select-layer-below-with-hidden-300x169.jpg\" alt=\"\" class=\"c-postThumb__img u-obf-cover\" width=\"320\" height=\"180\"><\/figure><\/div>\t\t\t\t\t<div class=\"p-blogCard__body\">\n\t\t\t\t\t\t<a class=\"p-blogCard__title\" href=\"https:\/\/cg-method.com\/photoshop\/select-layer-below-with-hidden\/\">Photoshop\u30b9\u30af\u30ea\u30d7\u30c8\uff08jsx\uff09\u2502\u975e\u8868\u793a\u306e\u30ec\u30a4\u30e4\u30fc\u3067\u3082\u53ef\uff011\u3064\u4e0b\u306e\u8868\u793a\u30ec\u30a4\u30e4\u30fc\u3092\u9078\u629e\u3059\u308b\u65b9\u6cd5<\/a>\n\t\t\t\t\t\t<span class=\"p-blogCard__excerpt\">Photoshop\u3067\u975e\u8868\u793a\u30ec\u30a4\u30e4\u30fc\u304c\u542b\u307e\u308c\u3066\u3044\u3066\u3082\u30011\u3064\u4e0b\u306e\u8868\u793a\u30ec\u30a4\u30e4\u30fc\u3092\u9078\u629e\u3067\u304d\u308bJSX\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002 Photoshop\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u975e\u8868\u793a\u30ec\u30a4\u30e4\u30fc\u304c\u3042\u3063\u3066\u30821\u3064\u4e0b\u306e&#8230;<\/span>\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\n<div class=\"swell-block-postLink\">\t\t\t<div class=\"p-blogCard -internal\" data-type=\"type1\" data-onclick=\"clickLink\">\n\t\t\t\t<div class=\"p-blogCard__inner\">\n\t\t\t\t\t<span class=\"p-blogCard__caption\">\u3042\u308f\u305b\u3066\u8aad\u307f\u305f\u3044<\/span>\n\t\t\t\t\t<div class=\"p-blogCard__thumb c-postThumb\"><figure class=\"c-postThumb__figure\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cg-method.com\/photoshop\/wp-content\/uploads\/2025\/03\/add-upper-layer-to-selection-300x169.jpg\" alt=\"\" class=\"c-postThumb__img u-obf-cover\" width=\"320\" height=\"180\"><\/figure><\/div>\t\t\t\t\t<div class=\"p-blogCard__body\">\n\t\t\t\t\t\t<a class=\"p-blogCard__title\" href=\"https:\/\/cg-method.com\/photoshop\/add-upper-layer-to-selection\/\">Photoshop\u30b9\u30af\u30ea\u30d7\u30c8\uff08jsx\uff09\u25021\u3064\u4e0a\u306e\u30ec\u30a4\u30e4\u30fc\u3092\u8ffd\u52a0\u9078\u629e\u3059\u308b\u65b9\u6cd5<\/a>\n\t\t\t\t\t\t<span class=\"p-blogCard__excerpt\">Photoshop\u30671\u3064\u4e0a\u306e\u30ec\u30a4\u30e4\u30fc\u3092\u8ffd\u52a0\u9078\u629e\u3059\u308bJSX\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002 Photoshop\u30b9\u30af\u30ea\u30d7\u30c8\u30671\u3064\u4e0a\u306e\u30ec\u30a4\u30e4\u30fc\u3092\u8ffd\u52a0\u9078\u629e\u3059\u308b\u65b9\u6cd5 \u51e6\u7406\u306e\u30dd\u30a4\u30f3\u30c8\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002&#8230;<\/span>\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n\n<!-- cgm-topic:end -->\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>Photoshop\u3067\u6307\u5b9a\u3057\u305f\u540d\u524d\u306e\u30ec\u30a4\u30e4\u30fc\u3092\u691c\u7d22\u3057\u3001\u9078\u629e\u72b6\u614b\u306b\u3059\u308bJSX\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002 Photoshop\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u30ec\u30a4\u30e4\u30fc\u540d\u304b\u3089\u30ec\u30a4\u30e4\u30fc\u3092\u9078\u629e\u3059\u308b\u65b9\u6cd5 \u30b9\u30af\u30ea\u30d7\u30c8\u4f5c\u6210\u6642\u306e\u30dd\u30a4\u30f3\u30c8\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002 \u30b0\u30eb\u30fc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":13,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pochipp_cv_data":"","swell_btn_cv_data":"","ssp_meta_description":"\u6307\u5b9a\u3057\u305f\u540d\u524d\u306e\u30ec\u30a4\u30e4\u30fc\u3092\u691c\u7d22\u30fb\u9078\u629e\u3059\u308bJSX\u30b3\u30fc\u30c9\u3092\u89e3\u8aac\u3002app.activeDocument\u306e\u5b58\u5728\u78ba\u8a8d\u3084doc.layers.getByName\u3092\u7528\u3044\u305f\u95a2\u6570\u5316\u306e\u30dd\u30a4\u30f3\u30c8\u3001\u30b0\u30eb\u30fc\u30d7\u5185\u306e\u5b50\u30fb\u5b6b\u30ec\u30a4\u30e4\u30fc\u306f\u76f4\u63a5\u53d6\u5f97\u3067\u304d\u306a\u3044\u6ce8\u610f\u70b9\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002","ssp_meta_title":"Photoshop\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u30ec\u30a4\u30e4\u30fc\u540d\u6307\u5b9a\u9078\u629e","ssp_meta_robots":"","ssp_meta_canonical":"","ssp_meta_image":"","ssp_meta_keyword":"","book_review_data":"","footnotes":""},"categories":[2],"tags":[],"class_list":["post-8","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-layer-operation"],"_links":{"self":[{"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/posts\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/comments?post=8"}],"version-history":[{"count":12,"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/posts\/8\/revisions"}],"predecessor-version":[{"id":1264,"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/posts\/8\/revisions\/1264"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/media\/13"}],"wp:attachment":[{"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/media?parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/categories?post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cg-method.com\/photoshop\/wp-json\/wp\/v2\/tags?post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}