{"id":8522,"date":"2017-06-01T12:45:43","date_gmt":"2017-06-01T03:45:43","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=8522"},"modified":"2017-06-02T16:43:18","modified_gmt":"2017-06-02T07:43:18","slug":"adobe-illustrator%e3%82%92%e6%93%8d%e4%bd%9c%e3%81%99%e3%82%8bvbscript","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=8522","title":{"rendered":"Adobe Illustrator\u3092\u64cd\u4f5c\u3059\u308bVBScript"},"content":{"rendered":"<p><a href=\"https:\/\/www.ka-net.org\/blog\/?cat=136\" title=\"Acrobat | \u521d\u5fc3\u8005\u5099\u5fd8\u9332\" target=\"_blank\">Acrobat<\/a>\u3068\u540c\u69d8\u306b\u30bf\u30a4\u30d7\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001VBA\u3084VBS\u304b\u3089Illustrator\u3092\u64cd\u4f5c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306fIllustrator\u3092\u64cd\u4f5c\u3057\u3066\u65b0\u898f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u4f5c\u6210\u3001\u6587\u5b57\u3092\u8ffd\u52a0\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nSample\r\n\r\nPublic Sub Sample()\r\n'Illustrator\u306e\u30aa\u30fc\u30c8\u30e1\u30fc\u30b7\u30e7\u30f3\u30c6\u30b9\u30c8\r\n  Dim appAi\r\n  Dim doc\r\n  \r\n  Set appAi = GetIllustratorObject()\r\n  If appAi Is Nothing Then\r\n    MsgBox &quot;Illustrator.Application\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002&quot;, vbExclamation + vbSystemModal\r\n    Exit Sub\r\n  End If\r\n  \r\n  With appAi\r\n    Set doc = .Documents.Add\r\n    With doc.TextFrames.Add\r\n      .Top = 300\r\n      .Left = 50\r\n      .TextRange.CharacterAttributes.Size = 28\r\n      .Contents = &quot;Name:&quot; &amp; appAi.Name &amp; vbNewLine &amp; _\r\n                  &quot;Version:&quot; &amp; appAi.Version &amp; vbNewLine &amp; _\r\n                  &quot;Build Number:&quot; &amp; appAi.BuildNumber &amp; vbNewLine &amp; _\r\n                  &quot;Locale:&quot; &amp; appAi.Locale\r\n    End With\r\n  End With\r\nEnd Sub\r\n\r\nPrivate Function GetIllustratorObject()\r\n'Illustrator.Application\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53d6\u5f97\r\n  Dim obj\r\n  Dim ai_path\r\n  \r\n  Set obj = Nothing: ai_path = &quot;&quot; '\u521d\u671f\u5316\r\n  On Error Resume Next\r\n  Set obj = GetObject(, &quot;Illustrator.Application&quot;)\r\n  On Error GoTo 0\r\n  \r\n  'Illustrator\u304c\u8d77\u52d5\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u306fRun\u30e1\u30bd\u30c3\u30c9\u3067\u8d77\u52d5\r\n  If obj Is Nothing Then\r\n    ai_path = GetIllustratorExePath()\r\n    With CreateObject(&quot;Scripting.FileSystemObject&quot;)\r\n      If .FileExists(ai_path) = True Then\r\n        CreateObject(&quot;WScript.Shell&quot;).Run &quot;&quot;&quot;&quot; &amp; ai_path &amp; &quot;&quot;&quot;&quot;, 1, False\r\n        WScript.Sleep 6000 '\u8d77\u52d5\u5f85\u3061\r\n        On Error Resume Next\r\n        Set obj = GetObject(, &quot;Illustrator.Application&quot;)\r\n        On Error GoTo 0\r\n      End If\r\n    End With\r\n  End If\r\n  \r\n  Set GetIllustratorObject = obj\r\nEnd Function\r\n\r\nPrivate Function GetIllustratorExePath()\r\n'Illustrator.exe\u306e\u30d1\u30b9\u3092\u53d6\u5f97\r\n  Dim itm\r\n  Dim ret\r\n  Const CSIDL_COMMON_PROGRAMS = 23\r\n  \r\n  '&#x5B;\u30d7\u30ed\u30b0\u30e9\u30e0]\u306b\u3042\u308b\u30b7\u30e7\u30fc\u30c8\u30ab\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u304b\u3089Illustrator.exe\u306e\u30d1\u30b9\u3092\u53d6\u5f97\r\n  With CreateObject(&quot;Shell.Application&quot;).Namespace(CSIDL_COMMON_PROGRAMS)\r\n    For Each itm In .Items\r\n      If InStr(LCase(itm.Name), &quot;illustrator&quot;) Then\r\n        With CreateObject(&quot;WScript.Shell&quot;).CreateShortcut(itm.Path)\r\n          ret = .TargetPath\r\n        End With\r\n        Exit For\r\n      End If\r\n    Next\r\n  End With\r\n  GetIllustratorExePath = ret\r\nEnd Function<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/VBScript_Illustrator_01.gif\" alt=\"\" width=\"652\" height=\"552\" class=\"alignnone size-full wp-image-8524\" \/><\/p>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3092\u898b\u308c\u3070\u5206\u304b\u308b\u901a\u308a\u3001Illustrator.Application\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u53d6\u5f97\u90e8\u5206\u306e\u51e6\u7406\u304c\u5197\u9577\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u901a\u5e38\u3067\u3042\u308c\u3070<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Set appAi = CreateObject(&quot;Illustrator.Application&quot;)<\/pre>\n<p>\u3068\u3001Word\u3084Excel\u306e\u3088\u3046\u306b\u3059\u308c\u3070\u554f\u984c\u7121\u3044\u306f\u305a\u3067\u3059\u304c\u3001Illustrator\u306e\u5834\u5408\u306f\u306a\u305c\u304b<span style=\"color: #ff0000; font-weight: bold;\">\u201cIllustrator\u304c\u8d77\u52d5\u3057\u3066\u3044\u308b\u72b6\u614b\u201d<\/span>\u3067\u306a\u3044\u3068\u64cd\u4f5c\u304c\u4e0a\u624b\u304f\u3044\u304d\u307e\u305b\u3093\u3002<br \/>\n(\u30a6\u30a3\u30f3\u30c9\u30a6\u304c\u8868\u793a\u3055\u308c\u305a\u3001\u307e\u305f\u3001Visible\u30d7\u30ed\u30d1\u30c6\u30a3\u3082\u8aad\u307f\u53d6\u308a\u5c02\u7528\u3067\u3042\u308b\u305f\u3081\u3001\u64cd\u4f5c\u4e0d\u80fd)<\/p>\n<ul>\n<li>VBA &#8211; Illustrator.Application not visible?<\/li>\n<li style=\"list-style-type:none;\"><a href=\"https:\/\/forums.adobe.com\/thread\/950527\" target=\"_blank\" title=\"VBA - Illustrator.Application not visible?\">https:\/\/forums.adobe.com\/thread\/950527<\/a><\/li>\n<li>How can I start Illustrator visible?<\/li>\n<li style=\"list-style-type:none;\"><a href=\"https:\/\/forums.adobe.com\/thread\/716799\" target=\"_blank\" title=\"How can I start Illustrator visible?\">https:\/\/forums.adobe.com\/thread\/716799<\/a><\/li>\n<\/ul>\n<p>\u305d\u306e\u305f\u3081\u3001\u4e0a\u8a18\u30b3\u30fc\u30c9\u3067\u306f\u3001<\/p>\n<ol>\n<li>Illustrator\u304c\u8d77\u52d5\u3057\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u5224\u5225\u3002<\/li>\n<li>\u8d77\u52d5\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u300c\u30d7\u30ed\u30b0\u30e9\u30e0\u300d\u306b\u3042\u308b\u30b7\u30e7\u30fc\u30c8\u30ab\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u304b\u3089Illustrator.exe\u306e\u30d1\u30b9\u3092\u53d6\u5f97\u3057\u3001WshShell.Run\u30e1\u30bd\u30c3\u30c9\u3067\u8d77\u52d5\u3002<\/li>\n<li>Illustrator.Application\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53d6\u5f97\u3002<\/li>\n<\/ol>\n<p>\u3068\u3044\u3063\u305f\u51e6\u7406\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u884c\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3092\u53d6\u5f97\u3059\u308b\u51e6\u7406\u304c\u30d7\u30ed\u30b0\u30e9\u30e0\u30d5\u30a9\u30eb\u30c0\u306b\u4f9d\u5b58\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u6b63\u78ba\u6027\u306b\u306f\u6b20\u3051\u308b\u306e\u3067\u3059\u304c\u3001\u4e00\u5fdc\u306f\u76ee\u7684\u3092\u9054\u6210\u3067\u304d\u308b\u306e\u3067\u3001\u3053\u308c\u3067\u826f\u3057\u3068\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>Illustrator\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u3001\u4e0b\u8a18\u30b5\u30a4\u30c8\u304b\u3089\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u308b\u306e\u3067\u3001\u305d\u3061\u3089\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n<ul>\n<li>Illustrator Scripting | Adobe Developer Connection<\/li>\n<li style=\"list-style-type:none;\"><a href=\"http:\/\/www.adobe.com\/devnet\/illustrator\/scripting.html\" target=\"_blank\" title=\"Illustrator Scripting | Adobe Developer Connection\">http:\/\/www.adobe.com\/devnet\/illustrator\/scripting.html<\/a><\/li>\n<li>Illustrator Scripting | Adobe Developer Connection [ADC]<\/li>\n<li style=\"list-style-type:none;\"><a href=\"http:\/\/www.adobe.com\/jp\/devnet\/illustrator\/scripting.html\" target=\"_blank\" title=\"Illustrator Scripting | Adobe Developer Connection [ADC]\">http:\/\/www.adobe.com\/jp\/devnet\/illustrator\/scripting.html<\/a><\/li>\n<\/ul>\n<div id=\"single_banner_area2\" class=\"clearfix one_banner\">\n<div class=\"single_banner single_banner_left\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u8a18\u4e8b\u4e2d(\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u5e83\u544a\u30e6\u30cb\u30c3\u30c8) -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-7306936664602087\"\r\n     data-ad-slot=\"5429724765\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<div class=\"single_banner single_banner_right\">\n<a href=\"\" target=\"_blank\"><img decoding=\"async\" src=\"\" alt=\"\" title=\"\" \/><\/a>\n<\/div>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"Acrobat\u3068\u540c\u69d8\u306b\u30bf\u30a4\u30d7\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001VBA\u3084VBS\u304b\u3089Illustrator\u3092\u64cd\u4f5c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 \u4eca\u56de\u306fIllustrator\u3092\u64cd\u4f5c\u3057\u3066\u65b0\u898f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u4f5c\u6210\u3001\u6587\u5b57\u3092\u8ffd\u52a0\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u7d39\u4ecb [&hellip;]","protected":false},"author":1,"featured_media":8523,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[Adobe Illustrator\u3092\u64cd\u4f5c\u3059\u308bVBScript]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6,151],"tags":[],"class_list":["post-8522","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vbs","category-illustrator"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Illustrator.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-2ds","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/8522","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8522"}],"version-history":[{"count":2,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/8522\/revisions"}],"predecessor-version":[{"id":8537,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/8522\/revisions\/8537"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/8523"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8522"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8522"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8522"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}