<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7200358175562922597</id><updated>2011-12-14T10:45:43.364+09:00</updated><category term='Cappuccino'/><category term='InDesign'/><category term='misc.'/><category term='Terminal'/><category term='Perl'/><category term='MySQL'/><category term='about this blog'/><category term='Finder'/><category term='Shell command'/><category term='AppleScript'/><category term='Objective-C'/><category term='IDML'/><title type='text'>Cross the Sea</title><subtitle type='html'>Let's Browse the Net With Crossing the Sea.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>43</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-3950741075202686395</id><published>2010-11-25T20:10:00.000+09:00</published><updated>2010-11-25T20:10:36.322+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>Character Code and Different System Language</title><content type='html'>When AppleScript Editor saves a script file including Japanese words as TEXT file format, that character code is UTF-16LE. I figure out so. But in a different system language, the character code is not the same one. Would you look at following a screenshot;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/_vCoDJp475R0/TO4DR0i311I/AAAAAAAABSA/K-YOUHYhRsU/s1600/language+Distinction2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_vCoDJp475R0/TO4DR0i311I/AAAAAAAABSA/K-YOUHYhRsU/s1600/language+Distinction2.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
A file that was saved in Japanese language environment is Shift-JIS. The same contents’ file that was saved in English language is UTF-16LE. Each file was saved as different character code.&lt;br /&gt;
&lt;br /&gt;
I’m working usually in English language system. When I receive files that were saved in Japanese language environment, I have to be wary though the scripts are able to run.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-3950741075202686395?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/3950741075202686395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=3950741075202686395&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/3950741075202686395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/3950741075202686395'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2010/11/character-code-and-different-system.html' title='Character Code and Different System Language'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_vCoDJp475R0/TO4DR0i311I/AAAAAAAABSA/K-YOUHYhRsU/s72-c/language+Distinction2.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-2301981191730823018</id><published>2010-11-24T22:16:00.001+09:00</published><updated>2010-11-24T22:16:41.181+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>UTF16-BE or UTF16-LE?</title><content type='html'>&lt;br /&gt;
I hope that character code of files AppleScript Editor saves would be only UTF16-LE. I hate a mixed state of ascii and it. Honestly speaking, UTF8 is the best. I tweeted like so.&lt;br /&gt;
&lt;br /&gt;
After I tweeted, there was a person who send message me about my tweet. He said that the character code of AppleScript Editor as text file format is UTF16-BE. Uhhh... but the result of hexdump shows little-endian BOM.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/_vCoDJp475R0/TO0PLiH2TZI/AAAAAAAABR0/njcY9-uDpsU/s1600/197586808.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_vCoDJp475R0/TO0PLiH2TZI/AAAAAAAABR0/njcY9-uDpsU/s1600/197586808.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
What am I missing here? Which is correct?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-2301981191730823018?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/2301981191730823018/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=2301981191730823018&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/2301981191730823018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/2301981191730823018'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2010/11/utf16-be-or-utf16-le.html' title='UTF16-BE or UTF16-LE?'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_vCoDJp475R0/TO0PLiH2TZI/AAAAAAAABR0/njcY9-uDpsU/s72-c/197586808.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-7786965932679438641</id><published>2010-09-29T23:22:00.005+09:00</published><updated>2010-12-06T11:13:51.718+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Terminal'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>Associated Script With Emacs Again</title><content type='html'>I remade a script to open selected files on Finder with Emacs. The script has two mode; one is after making a new process then add files there and another one is add files to already existing process. When selecting “make new process mode,” if there were any process in the most front of terminal window, will prepare for a new tab.&lt;br /&gt;
My blog have stopped updating for a long time. The last subject was the same one; about associated script with Emacs. I thought that it’s good subject to proceed with my blog again.&lt;br /&gt;
&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;script=property%20editor%20%3a%20%22emacs%22%0a%0aon%20run%0a%20%20%0a%20%20%28*%20Selecting%20some%20text%20files.%20*%29%0a%20%20tell%20application%20%22Finder%22%20to%20set%20file_objects%20to%20selection%0a%20%20filefilter%20of%20me%20given%20selected_items%3aa%20reference%20to%20file_objects%0a%20%20if%20file_objects%20is%20%7b%7d%20then%20return%0a%20%20%0a%20%20%28*%20Make%20user%20select%20mode%20which%20adds%20buffers%20to%20an%20new%20process%20or%20already%20existing%20process%3f%20*%29%0a%20%20set%20msg%20to%20%22Which%20do%20you%20intend%20to%20add%20buffers%20to%20a%20new%20process%20or%20already%20exists%20process%3f%22%0a%20%20display%20alert%20%22Select%20a%20mode.%22%20message%20msg%20%c2%ac%0a%20%20%20%20buttons%20%7b%22Cancel%22%2c%20%22New%20process%22%2c%20%22Existing%20process%22%7d%20default%20button%203%20cancel%20button%201%0a%20%20set%20the_mode%20to%20button%20returned%20of%20result%0a%20%20%0a%20%20%28*%20Launching%20a%20terminal.%20*%29%0a%20%20tell%20application%20%22Terminal%22%20to%20activate%0a%20%20%0a%20%20%0a%20%20if%20the_mode%20is%20%22Existing%20process%22%20then%0a%20%20%20%20%28*%20Change%20mode%20to%20find%20file%20on%20Emacs.%20*%29%0a%20%20%20%20repeat%20with%20a_file%20in%20file_objects%0a%20%20%20%20%20%20find_file%28%29%20of%20me%0a%20%20%20%20%20%20enter_filePath%28a_file%29%20of%20me%0a%20%20%20%20end%20repeat%0a%20%20%20%20%0a%20%20else%20if%20the_mode%20is%20%22New%20process%22%20then%0a%20%20%20%20repeat%20with%20a_file%20in%20file_objects%0a%20%20%20%20%20%20set%20contents%20of%20a_file%20to%20quoted%20form%20of%20%28a_file%20as%20Unicode%20text%29%0a%20%20%20%20end%20repeat%0a%20%20%20%20%0a%20%20%20%20%28*%20Serializing%20file%20names.%20%20*%29%0a%20%20%20%20set%20default_delimit%20to%20text%20item%20delimiters%20of%20AppleScript%0a%20%20%20%20set%20text%20item%20delimiters%20of%20AppleScript%20to%20%22%20%22%0a%20%20%20%20set%20posix_paths%20to%20every%20item%20of%20file_objects%20as%20text%0a%20%20%20%20set%20text%20item%20delimiters%20of%20AppleScript%20to%20default_delimit%0a%20%20%20%20%0a%20%20%20%20%28*%20I%20didn%27t%20get%20the%20how%20to%20make%20a%20new%20window.%0a%20%20%20%20%20%20%20%20%20%20%20So%20I%e2%80%99m%20using%20a%20command%20of%20making%20a%20new%20tab.%20*%29%0a%20%20%20%20new_open_tab%28%29%20of%20me%0a%20%20%20%20%0a%20%20%20%20%28*%20Openning%20files.%20*%29%0a%20%20%20%20set%20cmd%20to%20editor%20%26%20%22%20%22%20%26%20posix_paths%20as%20Unicode%20text%0a%20%20%20%20tell%20application%20%22Terminal%22%0a%20%20%20%20%20%20tell%20window%201%0a%20%20%20%20%20%20%20%20do%20script%20cmd%20in%20selected%20tab%0a%20%20%20%20%20%20end%20tell%0a%20%20%20%20end%20tell%0a%20%20else%0a%20%20%20%20--%20do%20nothing%0a%20%20end%20if%0a%20%20file_objects%0aend%20run%0a%0a------------------------------------------------------------------------------------------%0a--%20Filefilter%0a------------------------------------------------------------------------------------------%0aon%20filefilter%20given%20selected_items%3afile_objects_ref%0a%20%20set%20swap%20to%20contents%20of%20file_objects_ref%0a%20%20set%20contents%20of%20file_objects_ref%20to%20%7b%7d%0a%20%20repeat%20with%20f%20in%20swap%0a%20%20%20%20set%20the_alias%20to%20f%20as%20alias%0a%20%20%20%20if%20not%20%28folder%20of%20%28info%20for%20the_alias%29%29%20%c2%ac%0a%20%20%20%20%20%20and%20%28name%20of%20%28info%20for%20the_alias%29%29%20does%20not%20end%20with%20%c2%ac%0a%20%20%20%20%20%20%22%7e%22%20and%20%28name%20of%20%28info%20for%20the_alias%29%29%20does%20not%20start%20with%20%22.%22%20then%0a%20%20%20%20%20%20set%20contents%20of%20file_objects_ref%20to%20contents%20of%20file_objects_ref%20%c2%ac%0a%20%20%20%20%20%20%20%20%26%20POSIX%20path%20of%20%28the_alias%20as%20Unicode%20text%29%0a%20%20%20%20end%20if%0a%20%20end%20repeat%0aend%20filefilter%0a%0a------------------------------------------------------------------------------------------%0a--%20Terminal%0a------------------------------------------------------------------------------------------%0aon%20new_open_tab%28%29%0a%20%20tell%20application%20%22Terminal%22%0a%20%20%20%20tell%20window%201%0a%20%20%20%20%20%20try%0a%20%20%20%20%20%20%20%20if%20selected%20tab%20is%20busy%20then%0a%20%20%20%20%20%20%20%20%20%20add_newTab%28%29%20of%20me%0a%20%20%20%20%20%20%20%20end%20if%0a%20%20%20%20%20%20on%20error%0a%20%20%20%20%20%20%20%20--%20This%20handling%20is%20a%20case%20of%20no%20window%20of%20Terminal.%0a%20%20%20%20%20%20%20%20%28*%20I%20didn%27t%20get%20the%20how%20to%20make%20a%20new%20window.%0a%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20So%20I%e2%80%99m%20using%20a%20command%20of%20making%20a%20new%20tab.%20*%29%0a%20%20%20%20%20%20%20%20add_newTab%28%29%20of%20me%0a%20%20%20%20%20%20end%20try%0a%20%20%20%20end%20tell%0a%20%20end%20tell%0aend%20new_open_tab%0a%0a------------------------------------------------------------------------------------------%0a--%20System%20Events%0a------------------------------------------------------------------------------------------%0aon%20add_newTab%28%29%0a%20%20tell%20application%20%22System%20Events%22%0a%20%20%20%20tell%20window%201%20of%20application%20%22Terminal%22%20to%20activate%0a%20%20%20%20key%20code%2017%20using%20%7bcommand%20down%7d%0a%20%20end%20tell%0aend%20add_newTab%0a%0aon%20view_tab%28%29%20--%20unused%20subroutine%0a%20%20tell%20application%20%22System%20Events%22%0a%20%20%20%20tell%20window%201%20of%20application%20%22Terminal%22%20to%20activate%0a%20%20%20%20key%20code%2017%20using%20%7bshift%20down%2c%20command%20down%7d%0a%20%20end%20tell%0aend%20view_tab%0a%0a------------------------------------------------------------------------------------------%0a--%20Change%20mode%20on%20Emacs%0a------------------------------------------------------------------------------------------%0aon%20find_file%28%29%0a%20%20tell%20application%20%22System%20Events%22%0a%20%20%20%20tell%20window%201%20of%20application%20%22Terminal%22%20to%20activate%0a%20%20%20%20key%20code%207%20using%20%7bcontrol%20down%7d%20--%20cntrol%20%2b%20x%0a%20%20%20%20key%20code%203%20using%20%7bcontrol%20down%7d%20--%20cntrol%20%2b%20f%0a%20%20%20%20key%20code%200%20using%20%7bcontrol%20down%7d%20--%20cntrol%20%2b%20a%0a%20%20%20%20key%20code%2040%20using%20%7bcontrol%20down%7d%20--%20cntrol%20%2b%20k%0a%20%20end%20tell%0aend%20find_file%0a%0a------------------------------------------------------------------------------------------%0a--%20Enter%20the%20file%20path%0a------------------------------------------------------------------------------------------%0aon%20enter_filePath%28a_file%29%0a%20%20set%20the%20clipboard%20to%20a_file%20as%20Unicode%20text%0a%20%20tell%20application%20%22System%20Events%22%0a%20%20%20%20tell%20window%201%20of%20application%20%22Terminal%22%20to%20activate%0a%20%20%20%20key%20code%209%20using%20%7bcommand%20down%7d%20--%20command%20%2b%20v%0a%20%20%20%20key%20code%2036%20--%20return%0a%20%20end%20tell%0aend%20enter_filePath"&gt;Script Editor opens a new window with following the script.&lt;/a&gt;
&lt;/div&gt;

&lt;pre class="code"&gt;
property editor : "emacs"

on run
  
  (* Selecting some text files. *)
  tell application "Finder" to set file_objects to selection
  filefilter of me given selected_items:a reference to file_objects
  if file_objects is {} then return
  
  (* Make user select mode which adds buffers to an new process or already existing process? *)
  set msg to "Which do you intend to add buffers to a new process or already exists process?"
  display alert "Select a mode." message msg ¬
    buttons {"Cancel", "New process", "Existing process"} default button 3 cancel button 1
  set the_mode to button returned of result
  
  (* Launching a terminal. *)
  tell application "Terminal" to activate
  
  
  if the_mode is "Existing process" then
    (* Change mode to find file on Emacs. *)
    repeat with a_file in file_objects
      find_file() of me
      enter_filePath(a_file) of me
    end repeat
    
  else if the_mode is "New process" then
    repeat with a_file in file_objects
      set contents of a_file to quoted form of (a_file as Unicode text)
    end repeat
    
    (* Serializing file names.  *)
    set default_delimit to text item delimiters of AppleScript
    set text item delimiters of AppleScript to " "
    set posix_paths to every item of file_objects as text
    set text item delimiters of AppleScript to default_delimit
    
    (* I didn't get the how to make a new window.
           So I’m using a command of making a new tab. *)
    new_open_tab() of me
    
    (* Openning files. *)
    set cmd to editor &amp; " " &amp; posix_paths as Unicode text
    tell application "Terminal"
      tell window 1
        do script cmd in selected tab
      end tell
    end tell
  else
    -- do nothing
  end if
  file_objects
end run

------------------------------------------------------------------------------------------
-- Filefilter
------------------------------------------------------------------------------------------
on filefilter given selected_items:file_objects_ref
  set swap to contents of file_objects_ref
  set contents of file_objects_ref to {}
  repeat with f in swap
    set the_alias to f as alias
    if not (folder of (info for the_alias)) ¬
      and (name of (info for the_alias)) does not end with ¬
      "~" and (name of (info for the_alias)) does not start with "." then
      set contents of file_objects_ref to contents of file_objects_ref ¬
        &amp; POSIX path of (the_alias as Unicode text)
    end if
  end repeat
end filefilter

------------------------------------------------------------------------------------------
-- Terminal
------------------------------------------------------------------------------------------
on new_open_tab()
  tell application "Terminal"
    tell window 1
      try
        if selected tab is busy then
          add_newTab() of me
        end if
      on error
        -- This handling is a case of no window of Terminal.
        (* I didn't get the how to make a new window.
                                 So I’m using a command of making a new tab. *)
        add_newTab() of me
      end try
    end tell
  end tell
end new_open_tab

------------------------------------------------------------------------------------------
-- System Events
------------------------------------------------------------------------------------------
on add_newTab()
  tell application "System Events"
    tell window 1 of application "Terminal" to activate
    key code 17 using {command down}
  end tell
end add_newTab

on view_tab() -- unused subroutine
  tell application "System Events"
    tell window 1 of application "Terminal" to activate
    key code 17 using {shift down, command down}
  end tell
end view_tab

------------------------------------------------------------------------------------------
-- Change mode on Emacs
------------------------------------------------------------------------------------------
on find_file()
  tell application "System Events"
    tell window 1 of application "Terminal" to activate
    key code 7 using {control down} -- cntrol + x
    key code 3 using {control down} -- cntrol + f
    key code 0 using {control down} -- cntrol + a
    key code 40 using {control down} -- cntrol + k
  end tell
end find_file

------------------------------------------------------------------------------------------
-- Enter the file path
------------------------------------------------------------------------------------------
on enter_filePath(a_file)
  set the clipboard to a_file as Unicode text
  tell application "System Events"
    tell window 1 of application "Terminal" to activate
    key code 9 using {command down} -- command + v
    key code 36 -- return
  end tell
end enter_filePath
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-7786965932679438641?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/7786965932679438641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=7786965932679438641&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7786965932679438641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7786965932679438641'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2010/09/associated-script-with-emacs-again.html' title='Associated Script With Emacs Again'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-2465088234227004965</id><published>2010-04-10T17:09:00.005+09:00</published><updated>2010-04-11T16:33:58.225+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Terminal'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>Select Files in Finder And Open Them Using Emacs</title><content type='html'>&lt;p&gt;At a mention message on Twitter, I was asked a question that whether there is or not a way to open a text file that was selected on Finder using with Emacs editor on a terminal. I thought that perhaps it may be able to do that if someone write an Applescript for it. And I answered so. After tweeting that, I tried to write a script to implement it.&lt;/p&gt;

&lt;p&gt;A feature of the following script is to open some text files you selected within a Finder window. At the time, if a process is running in the current tab, a new tab is made and a file is opened by emacs in the new tab. If there are some folder items in items you selected, they are excluded from the list.&lt;p&gt;

&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;script=property%20editor%20%3a%20%22emacs%22%0a%0a%28*%20Selecting%20some%20text%20files.%20*%29%0atell%20application%20%22Finder%22%20to%20set%20file_objects%20to%20selection%0afilefilter%20of%20me%20given%20selected_items%3aa%20reference%20to%20file_objects%0aif%20file_objects%20is%20%7b%7d%20then%0a%20%20set%20msg%20to%20%22Would%20you%20select%20some%20text%20files.%22%20%26%20return%20%26%20return%20%26%20%c2%ac%0a%20%20%20%20%22%20If%20there%20are%20some%20folder%20items%20in%20items%20you%20selected%2c%20they%20are%20excluded%20from%20the%20list.%22%0a%20%20display%20alert%20%22There%20are%20no%20text%20files%20in%20items%20you%20selected.%22%20message%20msg%20buttons%20%7b%22Close%22%7d%0a%20%20return%0aend%20if%0a%0a%28*%20Openning%20using%20with%20Editor.%20*%29%0atell%20application%20%22Terminal%22%20to%20activate%0arepeat%20with%20f%20in%20file_objects%0a%20%20new_open_tab%28%29%20of%20me%0a%20%20open_file_withEditor%20given%20file_path%3af%0aend%20repeat%0a%0a------------------------------------------------------------------------------------------%0a--%20Terminal%0a------------------------------------------------------------------------------------------%0aon%20new_open_tab%28%29%0a%20%20tell%20application%20%22Terminal%22%0a%20%20%20%20tell%20window%201%0a%20%20%20%20%20%20try%0a%20%20%20%20%20%20%20%20if%20selected%20tab%20is%20busy%20then%0a%20%20%20%20%20%20%20%20%20%20add_newTab%28%29%20of%20me%0a%20%20%20%20%20%20%20%20end%20if%0a%20%20%20%20%20%20on%20error%0a%20%20%20%20%20%20%20%20--%20This%20handling%20is%20a%20case%20of%20no%20window%20of%20Terminal.%0a%20%20%20%20%20%20%20%20%28*%20I%20didn%27t%20get%20the%20how%20to%20make%20a%20new%20window.%0a%20%20%20%20%20%20%20%20%20%20%20%20So%20I%e2%80%99m%20using%20a%20command%20of%20making%20a%20new%20tab.%20*%29%0a%20%20%20%20%20%20%20%20add_newTab%28%29%20of%20me%0a%20%20%20%20%20%20end%20try%0a%20%20%20%20end%20tell%0a%20%20end%20tell%0aend%20new_open_tab%0a%0aon%20open_file_withEditor%20given%20file_path%3aposix_path%0a%20%20set%20cmd%20to%20editor%20%26%20%22%20%22%20%26%20posix_path%20as%20Unicode%20text%0a%20%20tell%20application%20%22Terminal%22%0a%20%20%20%20tell%20window%201%0a%20%20%20%20%20%20do%20script%20cmd%20in%20selected%20tab%0a%20%20%20%20end%20tell%0a%20%20end%20tell%0aend%20open_file_withEditor%0a%0a------------------------------------------------------------------------------------------%0a--%20System%20Events%0a------------------------------------------------------------------------------------------%0aon%20add_newTab%28%29%0a%20%20tell%20application%20%22System%20Events%22%0a%20%20%20%20tell%20window%201%20of%20application%20%22Terminal%22%20to%20activate%0a%20%20%20%20key%20code%2017%20using%20%7bcommand%20down%7d%0a%20%20end%20tell%0aend%20add_newTab%0a%0aon%20view_tab%28%29%20--%20unused%20subroutine%0a%20%20tell%20application%20%22System%20Events%22%0a%20%20%20%20tell%20window%201%20of%20application%20%22Terminal%22%20to%20activate%0a%20%20%20%20key%20code%2017%20using%20%7bshift%20down%2c%20command%20down%7d%0a%20%20end%20tell%0aend%20view_tab%0a%0a------------------------------------------------------------------------------------------%0a--%20Filefilter%0a------------------------------------------------------------------------------------------%0aon%20filefilter%20given%20selected_items%3afile_objects_ref%0a%20%20set%20swap%20to%20contents%20of%20file_objects_ref%0a%20%20set%20contents%20of%20file_objects_ref%20to%20%7b%7d%0a%20%20repeat%20with%20f%20in%20swap%0a%20%20%20%20set%20the_alias%20to%20f%20as%20alias%0a%20%20%20%20if%20not%20%28folder%20of%20%28info%20for%20the_alias%29%29%20then%0a%20%20%20%20%20%20set%20contents%20of%20file_objects_ref%20to%20contents%20of%20file_objects_ref%20%c2%ac%0a%20%20%20%20%20%20%20%20%26%20quoted%20form%20of%20%28POSIX%20path%20of%20%28the_alias%20as%20Unicode%20text%29%29%0a%20%20%20%20end%20if%0a%20%20end%20repeat%0aend%20filefilter"&gt;Script Editor opens a new window with following the script.&lt;/a&gt;
&lt;/div&gt;

&lt;pre class="code"&gt;
property editor : "emacs"

(* Selecting some text files. *)
tell application "Finder" to set file_objects to selection
filefilter of me given selected_items:a reference to file_objects
if file_objects is {} then
  set msg to "Would you select some text files." &amp; return &amp; return &amp; ¬
    " If there are some folder items in items you selected, they are excluded from the list."
  display alert "There are no text files in items you selected." message msg buttons {"Close"}
  return
end if

(* Openning using with Editor. *)
tell application "Terminal" to activate
repeat with f in file_objects
  new_open_tab() of me
  open_file_withEditor given file_path:f
end repeat

------------------------------------------------------------------------------------------
-- Terminal
------------------------------------------------------------------------------------------
on new_open_tab()
  tell application "Terminal"
    tell window 1
      try
        if selected tab is busy then
          add_newTab() of me
        end if
      on error
        -- This handling is a case of no window of Terminal.
        (* I didn’t get the how to make a new window.
            So I’m using a command of making a new tab. *)
        add_newTab() of me
      end try
    end tell
  end tell
end new_open_tab

on open_file_withEditor given file_path:posix_path
  set cmd to editor &amp; " " &amp; posix_path as Unicode text
  tell application "Terminal"
    tell window 1
      do script cmd in selected tab
    end tell
  end tell
end open_file_withEditor

------------------------------------------------------------------------------------------
-- System Events
------------------------------------------------------------------------------------------
on add_newTab()
  tell application "System Events"
    tell window 1 of application "Terminal" to activate
    key code 17 using {command down}
  end tell
end add_newTab

on view_tab() -- unused subroutine
  tell application "System Events"
    tell window 1 of application "Terminal" to activate
    key code 17 using {shift down, command down}
  end tell
end view_tab

------------------------------------------------------------------------------------------
-- Filefilter
------------------------------------------------------------------------------------------
on filefilter given selected_items:file_objects_ref
  set swap to contents of file_objects_ref
  set contents of file_objects_ref to {}
  repeat with f in swap
    set the_alias to f as alias
    if not (folder of (info for the_alias)) then
      set contents of file_objects_ref to contents of file_objects_ref ¬
        &amp; quoted form of (POSIX path of (the_alias as Unicode text))
    end if
  end repeat
end filefilter
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-2465088234227004965?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/2465088234227004965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=2465088234227004965&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/2465088234227004965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/2465088234227004965'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2010/04/select-files-in-finder-and-open-them.html' title='Select Files in Finder And Open Them Using Emacs'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-4576878037045849617</id><published>2010-01-10T00:03:00.008+09:00</published><updated>2010-07-13T16:36:17.230+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IDML'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>IDML: About Self of Attribute and ID of Property</title><content type='html'>&lt;p&gt;Is it possible to select page items on an InDesign document associated with elements of IDML? It is written like this on &lt;span style="font-style:italic;"&gt;idml-specification.pdf&lt;/span&gt; :&lt;/p&gt;

&lt;blockquote&gt;&lt;b&gt;8.2 IDML Component Names&lt;/b&gt;
An IDML component name can only be defined for a spread, story, or master spread. In an IDML package, each instance of these elements appears as a separate file. The component name is used as the file name for an object instance and it’s also used to refer to the file in designmap.xml. 
Note the component name does not change the value of the self attribute of the element.&lt;/blockquote&gt;

&lt;blockquote&gt;&lt;b&gt;8.2.4 Scripting Interface&lt;/b&gt;
Component names can be accessed through the IDMLComponentName property on spread, story, and master spread objects.&lt;/blockquote&gt;

&lt;p&gt;Are they only spread, story and master spread objects? If so, can’t we mutually refer to other objects and their elements? For example text frame, rectangle and other things. I tried to test the matter with scripts.&lt;/p&gt;

&lt;ol&gt;&lt;li&gt;Selected any element of page items had attribute “Self” and got the value.&lt;/li&gt;
&lt;li&gt;Removed a character, u or U that was the first value of the attribute.&lt;/li&gt;
&lt;li&gt;Treated the value as hexadecimal digit sequence, and converted it to decimal digit sequence.&lt;/li&gt;
&lt;li&gt;Selected a page item using the decimal number on the document of InDesign. Used following the script:&lt;/li&gt;&lt;/ol&gt;

&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;script=display%20dialog%20%22Enter%20a%20number%20for%20searching%20a%20page%20item.%22%20default%20answer%20%22%22%0aset%20id_number%20to%20%28text%20returned%20of%20result%29%20as%20integer%0a%0atell%20application%20%22Adobe%20InDesign%20CS4%22%0a%20%20tell%20active%20document%0a%20%20%20%20try%0a%20%20%20%20%20%20set%20a_object%20to%20page%20item%20id%20id_number%0a%20%20%20%20on%20error%0a%20%20%20%20%20%20tell%20application%20%22Finder%22%20to%20display%20dialog%20%22It%20seemed%20that%20you%20entered%20the%20wrong.%22%0a%20%20%20%20%20%20error%20number%20-128%0a%20%20%20%20end%20try%0a%20%20%20%20%0a%20%20%20%20if%20not%20%28show_object%20of%20me%20given%20a_reference%3aa_object%29%20then%0a%20%20%20%20%20%20tell%20application%20%22Finder%22%20to%20display%20dialog%20%22It%20failed%20selecting%20the%20page%20item.%22%0a%20%20%20%20%20%20error%20number%20-128%0a%20%20%20%20end%20if%0a%20%20end%20tell%0aend%20tell%0a%0a--------------------------------------------------------------------------------%0aon%20show_object%20given%20a_reference%3aa_object%0a%20%20tell%20application%20%22Adobe%20InDesign%20CS4%22%0a%20%20%20%20try%0a%20%20%20%20%20%20tell%20active%20window%20to%20set%20current_zoom_oar%20to%20zoom%20percentage%0a%20%20%20%20%20%20tell%20active%20document%20to%20select%20a_object%0a%20%20%20%20%20%20tell%20active%20window%20to%20set%20zoom%20percentage%20to%20current_zoom_oar%0a%20%20%20%20on%20error%0a%20%20%20%20%20%20return%20false%0a%20%20%20%20end%20try%0a%20%20%20%20return%20true%0a%20%20end%20tell%0aend%20show_object"&gt;Script Editor opens a new window with following the script.&lt;/a&gt;
&lt;/div&gt;

&lt;pre class="code"&gt;
display dialog "Enter a number for searching a page item." default answer ""
set id_number to (text returned of result) as integer

tell application "Adobe InDesign CS4"
  tell active document
    try
      set a_object to page item id id_number
    on error
      tell application "Finder" to display dialog "It seemed that you entered the wrong."
      error number -128
    end try
    
    if not (show_object of me given a_reference:a_object) then
      tell application "Finder" to display dialog "It failed selecting the page item."
      error number -128
    end if
  end tell
end tell

--------------------------------------------------------------------------------
on show_object given a_reference:a_object
  tell application "Adobe InDesign CS4"
    try
      tell active window to set current_zoom_oar to zoom percentage
      tell active document to select a_object
      tell active window to set zoom percentage to current_zoom_oar
    on error
      return false
    end try
    return true
  end tell
end show_object
&lt;/pre&gt;

&lt;p&gt;The test was successful. It’s possible to access the page item using the value of Self attribute. But note when the IDML package was opened by InDesign, there are cases that a different UID was created on the document. Read following the paragraph:&lt;/p&gt;

&lt;blockquote&gt;&lt;b&gt;8.2.3 Reset Component Name on Import&lt;/b&gt;
When an IDML package is opened by InDesign, user-defined component names will be saved in the document so they can be used when the document is exported (that is, they are preserved for round-trip).

Default names are not saved with the document because the object created during import may have a different UID. A new default name is generated when the document is exported.&lt;/blockquote&gt;

&lt;p&gt;It seems that &lt;u&gt;when the document is exported&lt;/u&gt; is &lt;u&gt;when an IDML package file is opened by InDesign application&lt;/u&gt;. In other words, when a IDML package is opened by InDesign application, there are nothing way to access page items(InDesign’s objects) on the document from elements I myself newly added to spread XML. The elements have not a key for accessing directly. If we try to find a page item associated with an element I made, it seems that we should make up a absolute path tracing a relative reference from spread’s, story’s and master spread’s element.&lt;/p&gt;

&lt;p&gt;In a case of an element of IDML package that was exported from already existing InDesign’s document, of course it’s possible to access from the element. The opposite is true.&lt;/p&gt;

&lt;p&gt;Would anybody tell me whether above my understanding is true or false?&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-4576878037045849617?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/4576878037045849617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=4576878037045849617&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/4576878037045849617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/4576878037045849617'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2010/01/idml-about-self-of-attribute-and-id-of.html' title='IDML: About Self of Attribute and ID of Property'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-8766855486016248081</id><published>2009-12-25T18:43:00.001+09:00</published><updated>2009-12-25T18:57:07.973+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc.'/><title type='text'>Environment Variables on Remote Machines</title><content type='html'>&lt;p&gt;I realized that it is not able to get a clone in remote Git server running on Mac OS X last week. Git said that command git-upload-pack was not found, though I can confirm a path of environment variable on both of my local machine and remote server. It seems to need the option to access the git server via SSH at the time using clone command. So I added an alias to ~/.gitconfig file.&lt;/p&gt;

&lt;pre class="code"&gt;
[alias]
rclone = clone --upload-pack=/usr/local/git/bin/git-upload-pack
rpush  = push  --receive-pack=/usr/local/git/bin/git-receive-pack
&lt;/pre&gt;

&lt;p&gt;But this way needs to also make other aliases: push, fetch and perhaps pull. Maybe there are and much more. I think that to setting aliases is not ultimate solution. I searched google for sshd_config and PermitUserEnvironment but I couldn’t resolve this problem, environment variable via SSH.&lt;/p&gt;
&lt;pre class="code"&gt;
ssh my_account@my_domain echo \$PATH
&lt;/pre&gt;&lt;p&gt;Not including needful path in the result of above command is the point of occasion. &lt;/p&gt;

&lt;p&gt;I read &lt;a href="http://stackoverflow.com/questions/225291/git-upload-pack-command-not-found-how-to-fix-this-correctly"&gt;this blog&lt;/a&gt;. I made symbolic links in /usr/bin but I couldn’t fixed.  I have suffered all through the day. That‘s enough! I have abandoned to fix it.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-8766855486016248081?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/8766855486016248081/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=8766855486016248081&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/8766855486016248081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/8766855486016248081'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/12/environment-variables-on-remote.html' title='Environment Variables on Remote Machines'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-6643178567153384448</id><published>2009-12-07T18:15:00.004+09:00</published><updated>2009-12-08T14:28:19.838+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><category scheme='http://www.blogger.com/atom/ns#' term='IDML'/><title type='text'>Package Method of IDMLTOOLS.jar</title><content type='html'>&lt;p&gt;I resumed researching IDML from today and brushed up things I checked out until this spring. Once I wrote &lt;a href="http://cross-the-sea.blogspot.com/2009/01/export-idml-and-decompress-it-without.html"&gt;an entry&lt;/a&gt; about package of IDML. The script in that page is to generate a package from the frontmost document. The following script is to decompress an idml package file. It doesn’t need a system environment that is installed InDesign. I prepared a perl script to understand how to use java applets. It’s verbosity because I want to write an explicit script.&lt;/p&gt;

&lt;p&gt;Package method with '-d' option of idmltools.jar makes me confused many times when a destination directory doesn’t exist. So this script automatically makes the destination directory.&lt;/p&gt;

&lt;pre class="code"&gt;
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use open ":utf8";
use open ":std";
use File::Path;

my $IDMLTOOLS_HOME = `printenv IDMLTOOLS_HOME`;
my $command        = 'java';
my @java_argv      = ();
chomp $IDMLTOOLS_HOME;
$java_argv[0] = '-classpath';
$java_argv[1] = "$IDMLTOOLS_HOME/jars/idmltools.jar";
$java_argv[2] = 'com.adobe.idml.Package';

map { utf8::decode( $_ ) } @ARGV;
if ( $ARGV[0] eq '-h' ){
    `$command @java_argv '-h'`;
    exit;
}
elsif ( ! $IDMLTOOLS_HOME ) {
    die "Please define the environment variable IDMLTOOLS_HOME.\n";
}

if( $ARGV[0] eq '-c' and $ARGV[2] !~ /\.idml$/ ){
    $ARGV[2] .= '.idml';
}
elsif( $ARGV[0] eq '-d' and  ! -e $ARGV[2] ){
    umask 0;
    mkpath( ( $ARGV[2] ), {verbose =&gt; 0, mode =&gt; 0777} ) or die $!;
}

`$command @java_argv @ARGV`;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-6643178567153384448?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/6643178567153384448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=6643178567153384448&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/6643178567153384448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/6643178567153384448'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/12/package-method-of-idmltoolsjar.html' title='Package Method of IDMLTOOLS.jar'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-7520183188837181116</id><published>2009-11-26T12:22:00.002+09:00</published><updated>2009-11-26T12:29:01.711+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>I Recommend Text Format for AppleScript</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_vCoDJp475R0/Sw3111EM1bI/AAAAAAAABPI/dlTFQQ4LY6M/s1600/script_or_text.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 362px; height: 156px;" src="http://3.bp.blogspot.com/_vCoDJp475R0/Sw3111EM1bI/AAAAAAAABPI/dlTFQQ4LY6M/s400/script_or_text.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5408249032668403122" /&gt;&lt;/a&gt;&lt;p&gt;When you save AppleScript’s files, I recommend saving scripts as “text” format. Because there is not much different of the implementation time between application or script format and text one on a program about one hundred lines scale. If you save AppleScript’s files as text format, you can get the benefit of Spotlight of OS X and multi-file searching with plain text editor, and it’s also possible to do version control in Git.&lt;/p&gt;

&lt;p&gt;Actually, won’t anyone write script of many thousand lines? Is there someone who is writing a script like that? I guess that the line count in one script file is perhaps less than one hundred lines. Then that’s easy enough. There is not frustration to wait compiling every running script. So, we should save scripts as text format.&lt;/p&gt;

&lt;p&gt;Almost of AppleScript I wrote are short files. They are used via osascript like a command to control any application in Perl, or using NSAppleScript. Because I don’t think it is suitability to develop a application that is controlled by AppleScrip. It’s difficult to debug a script that has a lot of steps. So, I never try to control complicated process in AppleScript.&lt;/p&gt;

&lt;p&gt;That's why I have none big script files and I have saved AppleScript’s files as text format. What I want to say is it is better that AppleScript is also treated as one of the many interpreter languages than compiler languages.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-7520183188837181116?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/7520183188837181116/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=7520183188837181116&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7520183188837181116'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7520183188837181116'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/11/i-recommend-text-format-for-applescript.html' title='I Recommend Text Format for AppleScript'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_vCoDJp475R0/Sw3111EM1bI/AAAAAAAABPI/dlTFQQ4LY6M/s72-c/script_or_text.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-4243494225231910905</id><published>2009-09-08T18:37:00.004+09:00</published><updated>2009-09-10T18:46:12.290+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>Make TextWrangler Open Some Files using AppleScript</title><content type='html'>&lt;p&gt;I wrote a script of AppleScript with TextWrangler to open some perl’s script files inside one document. The script will open some files that have extentions ‘.pl’ and ‘.pm’ in a folder you select. Every file in some nested folders is target.&lt;/p&gt;

&lt;p&gt;You don’t need to drop the same folder since second time, only click the applet. The applet remembers the folder you dropped.&lt;/p&gt;

&lt;p&gt;Before making the below script run, you may should check and rewrite bounds data of window in the fourth line from the bottom of script to adjust to your monitor.&lt;/p&gt;

&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;script=property%20jobFolder%20%3a%20null%0a%0aon%20open%20ARGV%0a%20%20set%20jobFolder%20to%20item%201%20of%20ARGV%20as%20alias%0a%20%20run%20of%20me%0aend%20open%0a%0aon%20run%0a%20%20if%20jobFolder%20is%20null%20then%0a%20%20%20%20set%20jobFolder%20to%20choose%20folder%20with%20prompt%20%22Select%20a%20%20folder%20including%20some%20perl%e2%80%99s%20script%20files.%22%0a%20%20end%20if%0a%20%20%0a%20%20set%20targetFiles%20to%20%7b%7d%0a%20%20getScriptFiles%28jobFolder%2c%20a%20reference%20to%20targetFiles%29%20of%20me%0a%20%20openTextWranglerWindow%28targetFiles%29%20of%20me%0aend%20run%0a%0aon%20getScriptFiles%28jobFolder%2c%20targetFiles_ref%29%0a%20%20tell%20application%20%22Finder%22%0a%20%20%20%20set%20scriptFiles%20to%20every%20item%20of%20jobFolder%20%c2%ac%0a%20%20%20%20%20%20whose%20%28%28name%20of%20it%29%20ends%20with%20%22.pm%22%29%20or%20%28%28name%20of%20it%29%20ends%20with%20%22.pl%22%29%0a%20%20end%20tell%0a%20%20repeat%20with%20a_file%20in%20scriptFiles%0a%20%20%20%20set%20contents%20of%20targetFiles_ref%20to%20contents%20of%20targetFiles_ref%20%26%20%28a_file%20as%20alias%29%20as%20list%0a%20%20end%20repeat%0a%20%20%0a%20%20set%20innerFolders%20to%20%7b%7d%0a%20%20tell%20application%20%22Finder%22%20to%20set%20innerFolders%20to%20every%20item%20of%20jobFolder%20whose%20%28class%20of%20it%29%20is%20folder%0a%20%20if%20innerFolders%20is%20not%20%7b%7d%20then%0a%20%20%20%20repeat%20with%20f%20in%20innerFolders%0a%20%20%20%20%20%20getScriptFiles%28f%2c%20targetFiles_ref%29%20of%20me%0a%20%20%20%20end%20repeat%0a%20%20end%20if%0aend%20getScriptFiles%0a%0aon%20openTextWranglerWindow%28targetFiles%29%0a%20%20tell%20application%20%22TextWrangler%22%0a%20%20%20%20activate%0a%20%20%20%20open%20targetFiles%20opening%20in%20new_window%20with%20properties%20%7bbounds%3a%7b0%2c%2020%2c%20800%2c%201000%7d%7d%0a%20%20%20%20set%20show%20documents%20drawer%20of%20text%20window%201%20to%20true%0a%20%20end%20tell%0aend%20openTextWranglerWindow"&gt;Script Editor opens a new window with following the script.&lt;/a&gt;
&lt;/div&gt;

&lt;pre class="code"&gt;
property jobFolder : null

on open ARGV
  set jobFolder to item 1 of ARGV as alias
  run of me
end open

on run
  if jobFolder is null then
    set jobFolder to choose folder with prompt "Select a  folder including some perl’s script files."
  end if
  
  set targetFiles to {}
  getScriptFiles(jobFolder, a reference to targetFiles) of me
  openTextWranglerWindow(targetFiles) of me
end run

on getScriptFiles(jobFolder, targetFiles_ref)
  tell application "Finder"
    set scriptFiles to every item of jobFolder ¬
      whose ((name of it) ends with ".pm") or ((name of it) ends with ".pl")
  end tell
  repeat with a_file in scriptFiles
    set contents of targetFiles_ref to contents of targetFiles_ref &amp; (a_file as alias) as list
  end repeat
  
  set innerFolders to {}
  tell application "Finder" to set innerFolders to every item of jobFolder whose (class of it) is folder
  if innerFolders is not {} then
    repeat with f in innerFolders
      getScriptFiles(f, targetFiles_ref) of me
    end repeat
  end if
end getScriptFiles

on openTextWranglerWindow(targetFiles)
  tell application "TextWrangler"
    activate
    open targetFiles opening in new_window with properties {bounds:{0, 20, 800, 1000}}
    set show documents drawer of text window 1 to true
  end tell
end openTextWranglerWindow
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-4243494225231910905?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/4243494225231910905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=4243494225231910905&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/4243494225231910905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/4243494225231910905'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/09/make-textwrangler-open-some-files-using.html' title='Make TextWrangler Open Some Files using AppleScript'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-1218613795089104386</id><published>2009-08-08T12:07:00.002+09:00</published><updated>2009-08-09T00:13:41.056+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><title type='text'>Libxml2 and LibXML Module</title><content type='html'>&lt;p&gt;If we output a serialized XML node using a combination of Perl’s LibXML and libxml2 library which remain an environment installed from Leopard OS install DVD, Japanese of element contents are output as numeric character reference.&lt;/p&gt;

&lt;p&gt;Two weeks ago, I wrote &lt;a href="http://cross-the-sea.blogspot.com/2009/07/how-to-dump-xml-and-structure-on-perl.html"&gt;an entry&lt;/a&gt; about decoding with entities() of HTML::Entities module. When debugging a program, that doesn't matter. But when their decoded XML element are output as xml documents and we’ll use them, there is a problem. Example, it is the time when an InDesign document imports the XML document. After serializing with toString() if the result is decoded by decode_entities(), every general-entity reference will be replaced their characters; as ‘&lt;’, ‘&gt;’ and ‘&amp;’. In that case, InDesign can’t accurately treat. I failed due to it.&lt;/p&gt;

&lt;p&gt;Though, if both of libxml2 and Perl’s LibXML are updated, we’ll come good without decoding them.&lt;/p&gt;

&lt;p&gt;I updated them yesterday. The libxml2’s version is 2.7.3 and I compiled it using a source file downloaded from &lt;a href="http://xmlsoft.org/"&gt;xmlsoft.org&lt;/a&gt;. And the LibXML module is 1.69_2. I downloaded it from &lt;a href="http://search.cpan.org/dist/XML-LibXML/"&gt;CPAN site&lt;/a&gt; without using CPAN module.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-1218613795089104386?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/1218613795089104386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=1218613795089104386&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/1218613795089104386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/1218613795089104386'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/08/libxml2-and-libxml-module.html' title='Libxml2 and LibXML Module'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-838249090054342584</id><published>2009-07-28T18:09:00.008+09:00</published><updated>2009-09-30T08:21:10.915+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Objective-C'/><title type='text'>About an Alert Message of RegexKit.framework</title><content type='html'>&lt;p&gt;In November last year, I wrote &lt;a href="http://oddeye.blogspot.com/2008/11/regexkitframework.html"&gt;an entry&lt;/a&gt; about the RegexKit.framework on my another blog. A program I wrote returns correct results, but show an alert message, too.&lt;/p&gt;

&lt;pre class="code"&gt;
CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary.
&lt;/pre&gt;

&lt;p&gt;I couldn’t find the cause of it. I wonder how should I search the “missing semicolon” in the framework. I had trouble finding it. In the end, I couldn’t find it.&lt;/p&gt;

&lt;p&gt;A few day ago, alex told me where is a file has the reason for the errors in.&lt;/p&gt;

&lt;blockquote&gt;The file /Developer/Local/Frameworks/RegexKit.framework/Versions/A/Resources/English.lproj/Localizable.strings is missing a semi colon on line 160.&lt;/blockquote&gt;

&lt;p&gt;Above the file path was hiding behind the side menu. I want you to join the following two lines,&lt;/p&gt;

&lt;p&gt;&lt;span style="font-style:italic;"&gt;/Developer/Local/Frameworks/RegexKit.framework/Versions/A&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-style:italic;"&gt;/Resources/English.lproj/Localizable.strings&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The RegexKit’s version is 0.6.0 Beta. I edited line 160 as he say. Then, the error disappeared. Thank alex for his advice.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-838249090054342584?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/838249090054342584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=838249090054342584&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/838249090054342584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/838249090054342584'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/07/about-alert-message-of.html' title='About an Alert Message of RegexKit.framework'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-6164827451639089026</id><published>2009-07-22T12:14:00.004+09:00</published><updated>2011-04-26T10:12:48.502+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><title type='text'>How to Dump XML and Structure on Perl</title><content type='html'>&lt;p&gt;Until now when I made InDesign to import a XML document, all objects had been placed on a document. And after did that, InDesign had imported the whole of XML at one time. So I didn’t realize that it needs decode the data for exporting a node partly using &lt;span style="font-style:italic;"&gt;toString()&lt;/span&gt; on XML::LibXML. &lt;/p&gt;

&lt;p&gt;For exampl;&lt;/p&gt;
&lt;pre class="code"&gt;
&amp;lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
&amp;lt;Root&gt;
    &amp;lt;column firstChar="あ"&gt;
        &amp;lt;hiragana&gt;あいうえお&amp;lt;/hiragana&gt;
        &amp;lt;katakana&gt;アイウエオ&amp;lt;/katakana&gt;
    &amp;lt;/column&gt;
    &amp;lt;column firstChar="か"&gt;
        &amp;lt;hiragana&gt;かきくけこ&amp;lt;/hiragana&gt;
        &amp;lt;katakana&gt;カキクケコ&amp;lt;/katakana&gt;
    &amp;lt;/column&gt;
&amp;lt;/Root&gt;
&lt;/pre&gt;

&lt;p&gt;In case that output partly without decoding above XML;&lt;/p&gt;
&lt;pre class="code"&gt;
&amp;lt;column firstChar="あ"&gt;
        &amp;lt;hiragana&gt;&amp;amp;#x3042;&amp;amp;#x3044;&amp;amp;#x3046;&amp;amp;#x3048;&amp;amp;#x304A;&amp;lt;/hiragana&gt;
        &amp;lt;katakana&gt;&amp;amp;#x30A2;&amp;amp;#x30A4;&amp;amp;#x30A6;&amp;amp;#x30A8;&amp;amp;#x30AA;&amp;lt;/katakana&gt;
    &amp;lt;/column&gt;
&lt;/pre&gt;

&lt;p&gt;Wide character are outputed as numeric  character reference. I therefore checked about a way to decode them. It seems that the easiest way is to use &lt;span style="font-style:italic;"&gt;decode_entities()&lt;/span&gt; of HTML::Entities.&lt;/p&gt;

&lt;p&gt;By the way, Data::Dumper also needs decoding to dump structure. Here, I’m going to write down its way of decoding.&lt;/p&gt;

&lt;pre class="code"&gt;
#!/usr/bin/perl
use strict;
use utf8;
use open ":utf8";
use open ":std";
use XML::LibXML;
use HTML::Entities;
use Data::Dumper;

my $decode = 1;

# Dump a node in utf8.
print "___________________ Dump a node in utf8.\n";
my $XMLDocument = '/Users/*****/Desktop/sample.xml';
my $XPath       = "//column[attribute::firstChar='あ']";

my $parser = XML::LibXML-&gt;new;
my $root   = $parser-&gt;parse_file( $XMLDocument );
my @nodes  = $root-&gt;findnodes( $XPath );
my $a_node = $nodes[0];
$decode ? nDumper ( $a_node )
        : print $a_node-&gt;toString();

# Dump a structure in utf8.
print "\n___________________ Dump a structure in utf8.\n";
my %hash = ( 'first'  =&gt; [ 'あいうえお', 'アイウエオ' ], 
             'second' =&gt; [ 'かきくけこ', 'カキクケコ' ] );
$decode ? jDumper ( Dumper %hash )
        : print Dumper ( %hash );

#=============================================================================
sub nDumper{
    my $the_node  = shift;
    my $serialize = $the_node-&gt;toString();
    print decode_entities( $serialize );
}
sub jDumper{
    foreach my $a_variable ( @_ ){
        $a_variable =~ s/\\x{([0-9a-z]+)}/chr(hex($1))/ge;
        print $a_variable;
    }
}
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;If $decode is 0;&lt;/b&gt;&lt;/p&gt;
&lt;pre class="code"&gt;
___________________ Dump a node in utf8.
&amp;lt;column firstChar="あ"&gt;
        &amp;lt;hiragana&gt;&amp;amp;#x3042;&amp;amp;#x3044;&amp;amp;#x3046;&amp;amp;#x3048;&amp;amp;#x304A;&amp;lt;/hiragana&gt;
        &amp;lt;katakana&gt;&amp;amp;#x30A2;&amp;amp;#x30A4;&amp;amp;#x30A6;&amp;amp;#x30A8;&amp;amp;#x30AA;&amp;lt;/katakana&gt;
    &amp;lt;/column&gt;
___________________ Dump a structure in utf8.
$VAR1 = 'first';
$VAR2 = [
          "\x{3042}\x{3044}\x{3046}\x{3048}\x{304a}",
          "\x{30a2}\x{30a4}\x{30a6}\x{30a8}\x{30aa}"
        ];
$VAR3 = 'second';
$VAR4 = [
          "\x{304b}\x{304d}\x{304f}\x{3051}\x{3053}",
          "\x{30ab}\x{30ad}\x{30af}\x{30b1}\x{30b3}"
        ];
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;If $decode is 1;&lt;/b&gt;&lt;/p&gt;
&lt;pre class="code"&gt;
___________________ Dump a node in utf8.
&amp;lt;column firstChar="あ"&gt;
        &amp;lt;hiragana&gt;あいうえお&amp;lt;/hiragana&gt;
        &amp;lt;katakana&gt;アイウエオ&amp;lt;/katakana&gt;
    &amp;lt;/column&gt;
___________________ Dump a structure in utf8.
$VAR1 = 'first';
$VAR2 = [
          "あいうえお",
          "アイウエオ"
        ];
$VAR3 = 'second';
$VAR4 = [
          "かきくけこ",
          "カキクケコ"
        ];
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-6164827451639089026?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/6164827451639089026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=6164827451639089026&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/6164827451639089026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/6164827451639089026'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/07/how-to-dump-xml-and-structure-on-perl.html' title='How to Dump XML and Structure on Perl'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-3433468432057151184</id><published>2009-06-22T12:22:00.007+09:00</published><updated>2009-08-18T08:58:45.031+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc.'/><title type='text'>An Announcement of A Seminar</title><content type='html'>&lt;p&gt;「DTPの勉強部屋」で告知がありましたように、&lt;a href="http://study-room.info/dtp/index.php?date=2009-06-20"&gt;平成21年7月25日（土）の『第14回勉強会』&lt;/a&gt;でスピーチさせて頂くことになりました。テーマは“自動組版システム構築” のための「はじめの一歩」です。私は英語を全くしゃべれません。日本語オンリーでございます。安心してご参加ください！(^^) 資料もすべて日本語です。&lt;/p&gt;

&lt;p&gt;&lt;b&gt;上記サイトの案内文より引用&lt;/b&gt;&lt;/p&gt;
&lt;blockquote&gt;InDesignのドキュメント中のオブジェクトの操作に限らず、ファイル管理やDataBase接続を含めた “自動組版システム構築” のための「はじめの一歩」としてスクリプトを紹介します。XMLの解析とか、SQL Data Baseに対するクエリーのスクリプトを紹介するわけではないので、ビギナーレベルの方にも十分に分かる内容になる予定です。&lt;/blockquote&gt;
&lt;p&gt;&lt;b&gt;主な内容&lt;/b&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;はじめに、自動組版についての心得&lt;/li&gt;
&lt;li&gt;AppleScriptの短所と長所&lt;/li&gt;
&lt;li&gt;自動組版システムを構築する際のアドバイス&lt;/li&gt;
&lt;li&gt;AppleScriptの弱点を克服するためのスクリプト紹介（← これがメイン）&lt;/li&gt;
&lt;li&gt;XMLによる自動組版について（← 時間があれば...）&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;　紹介するスクリプトのサンプルは、デザイン・編集の現場で明日からすぐに役に立つようなものはありません。しかし、DTPから開発業務へ勤務内容をシフトされたばかりのビギナーの方には、明日からでも利用できるサンプルを多数用意するつもりです。スクリプトの内容は基本的に “AppleScriptとPerlの連携” にスポットを当てています。具体的な例はPerlのコードになりますが、現在、学習者人口の最も多いRubyに置き換えても参考になると思います。&lt;p&gt;

&lt;p&gt;　え〜、みなさん。人前でしゃべるのは初めてのことなので、分りにくい点があるかもしれませんが、よろしくお願いいたします。&lt;/p&gt;

&lt;p&gt;&lt;span style="font-weight:bold;"&gt;後日追記&lt;/span&gt;：レジュメと参考スクリプトを掲載しているURL&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Script Text Book：&lt;a href="http://psychocat.net/note/ScriptTextBook/"&gt;http://psychocat.net/note/ScriptTextBook/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-3433468432057151184?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/3433468432057151184/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=3433468432057151184&amp;isPopup=true' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/3433468432057151184'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/3433468432057151184'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/06/announcement-of-seminar.html' title='An Announcement of A Seminar'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-5820046251024654655</id><published>2009-05-14T11:05:00.004+09:00</published><updated>2009-05-14T11:16:35.855+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cappuccino'/><title type='text'>Cappuccino 0.7 beta</title><content type='html'>&lt;p&gt;I wanted to use a tableView on Cappuccino but my AppKit didn’t have CPTableView.j. If I searched the Google for CPTableView.j, I could find the word on the result page. Why didn’t my framework have the resource file? I had been reading &lt;a href="http://www.nice-panorama.com/Programmation/cappuccino/"&gt;a tutorial site&lt;/a&gt; of Objective-J with thinking that. &lt;/p&gt;

&lt;p&gt;After that, on &lt;a href="http://www.nice-panorama.com/Programmation/cappuccino/Tutorial-cappuccino-07b.html"&gt;a page&lt;/a&gt; of the site, I knew that CPTableView was supported from “Cappuccino 0.7 beta”. Immediately I tried to install new version the framework. However I could not download the version archive as a package. I needed to downlaod from another site and build it. It seemed more easy to use git command. Then first installing failed because there was not “ojunit” in the Cappuccino source by default. But “ojunit” is required to compile Cappuccino.&lt;/p&gt;


&lt;p&gt;To install these sources, let’s look at &lt;a href="http://www.creanium.net/2009/04/20/downloading-and-building-cappuccino-07b-on-os-x-leopard/"&gt;this page on creanium.net&lt;/a&gt;. Maybe it was more good if we also would refer to&lt;a href="http://www.nice-panorama.com/Programmation/cappuccino/Tutorial-objj-and-ojunit.html"&gt; this page&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-5820046251024654655?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/5820046251024654655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=5820046251024654655&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/5820046251024654655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/5820046251024654655'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/05/cappuccino-07-beta.html' title='Cappuccino 0.7 beta'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-6273037276937619053</id><published>2009-05-13T17:25:00.001+09:00</published><updated>2009-05-13T18:33:22.280+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cappuccino'/><title type='text'>A Tutorial Site to Learn Objective-J</title><content type='html'>&lt;p&gt;If you bothered over learning &lt;a href="http://cappuccino.org/"&gt;Cappuccino&lt;/a&gt;, I would encourage you to read &lt;a href="http://www.nice-panorama.com/Programmation/cappuccino/"&gt;this site&lt;/a&gt;. There aren’t available finished applications and description writing is a few lines, but there are some sample code to carefully explain how to use the cappuccino’s framework in my eyes. We could see also how to HTTP Basic authentification and user interface for login with MySQL.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-6273037276937619053?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/6273037276937619053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=6273037276937619053&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/6273037276937619053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/6273037276937619053'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/05/tutorial-site-to-learn-objective-j.html' title='A Tutorial Site to Learn Objective-J'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-7583576102481708570</id><published>2009-05-11T11:42:00.006+09:00</published><updated>2009-06-12T11:04:04.985+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='InDesign'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>How to Get a Reference of Page Item</title><content type='html'>&lt;p&gt;This morning, on Google Group ‘adobe.scripting.indesign’ I found a question that “How can I get a Graphic or Text frame associated to a XMLElement from this XMLElement?” I’m using the following script code when I get a reference of a page item which is linking with a XML element. Run the script after selecting any element. If a page item associated exists, the page item will be selected.&lt;/p&gt;

&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;script=tell%20application%20%22Adobe%20InDesign%20CS4%22%0a%20%20tell%20active%20document%0a%20%20%20%20set%20a_element%20to%20object%20reference%20of%20item%201%20of%20selection%0a%20%20%20%20set%20the_item%20to%20get_pageItem_linkWith_theElement%20of%20me%20given%20reference%3aa_element%0a%20%20%20%20if%20the_item%20is%20not%20missing%20value%20then%0a%20%20%20%20%20%20select%20the_item%0a%20%20%20%20end%20if%0a%20%20end%20tell%0aend%20tell%0a%0athe_item%0a%0a---------------------------------------------------------------------------------------------------------------------------------%0a%28*get%20reference%20of%20page%20item%20using%20XMLelement*%29%0aon%20get_pageItem_linkWith_theElement%20given%20reference%3aelement_reference%0a%20%20set%20targetFrame%20to%20null%0a%20%20tell%20application%20%22Adobe%20InDesign%20CS4%22%0a%20%20%20%20tell%20active%20document%0a%20%20%20%20%20%20set%20targetFrame%20to%20item%201%20of%20%28every%20item%20of%20all%20page%20items%29%20%c2%ac%0a%20%20%20%20%20%20%20%20whose%20%28object%20reference%20of%20associated%20XML%20element%20of%20it%29%20is%20element_reference%0a%20%20%20%20%20%20try%0a%20%20%20%20%20%20%20%20if%20targetFrame%20is%20not%20null%20then%20return%20object%20reference%20of%20targetFrame%0a%20%20%20%20%20%20on%20error%0a%20%20%20%20%20%20%20%20return%20missing%20value%0a%20%20%20%20%20%20end%20try%0a%20%20%20%20end%20tell%0a%20%20end%20tell%0aend%20get_pageItem_linkWith_theElement"&gt;Script Editor opens a new window with following the script.&lt;/a&gt;
&lt;/div&gt;

&lt;pre class="code"&gt;
tell application "Adobe InDesign CS4"
  tell active document
    set a_element to object reference of item 1 of selection
    set the_item to get_pageItem_linkWith_theElement of me given reference:a_element
    if the_item is not missing value then
      select the_item
    end if
  end tell
end tell

the_item

---------------------------------------------------------------------------------------------------------------------------------
(*get reference of page item using XMLelement*)
on get_pageItem_linkWith_theElement given reference:element_reference
  set targetFrame to null
  tell application "Adobe InDesign CS4"
    tell active document
      set targetFrame to item 1 of (every item of all page items) ¬
        whose (object reference of associated XML element of it) is element_reference
      try
        if targetFrame is not null then return object reference of targetFrame
      on error
        return missing value
      end try
    end tell
  end tell
end get_pageItem_linkWith_theElement
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-7583576102481708570?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/7583576102481708570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=7583576102481708570&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7583576102481708570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7583576102481708570'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/05/how-to-get-reference-of-page-item.html' title='How to Get a Reference of Page Item'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-3062043324224025304</id><published>2009-05-10T10:51:00.019+09:00</published><updated>2009-05-10T23:58:09.621+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc.'/><title type='text'>Ebook on Stanza</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_vCoDJp475R0/SgYzO_Du6XI/AAAAAAAABCM/SQKciPIO1GU/s1600-h/IMG_0001.PNG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 134px; height: 200px;" src="http://2.bp.blogspot.com/_vCoDJp475R0/SgYzO_Du6XI/AAAAAAAABCM/SQKciPIO1GU/s200/IMG_0001.PNG" border="0" alt=""id="BLOGGER_PHOTO_ID_5334007141205207410" /&gt;&lt;/a&gt;&lt;p&gt;I purchase a Ebook at an online shopping. The book was “&lt;a href="http://oreilly.com/catalog/9780596101992/"&gt;JavaScript: The Definitive Guide, Fifth Edition&lt;/a&gt;”. I purchased some paperback book for English-learner before this, however, to purchase a technical document which is written in English was the first for me. Of course there is a book which is written in Japanese, but I want to try to read one which is written in English, also if I purchase Ebooks with using the application Stanza, it will be discounted. Above all things, I’m pleased that it’s possible to read on my iPod Touch. So I purchased the Ebook which is written in English.&lt;/p&gt;

&lt;p&gt;Digital format of Japanese’s Ebook is only PDF. It’s certainly possible to read some PDF documents on iPod/iPod Touch. But PDF documents that are not optimized are very very difficult to read. If I make font size bigger, I frequency must scroll a view left and right. A reason that I purchased it on Stanza is one of several reasons.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-3062043324224025304?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/3062043324224025304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=3062043324224025304&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/3062043324224025304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/3062043324224025304'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/05/ebook-on-stanza.html' title='Ebook on Stanza'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_vCoDJp475R0/SgYzO_Du6XI/AAAAAAAABCM/SQKciPIO1GU/s72-c/IMG_0001.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-1916450623136883083</id><published>2009-04-30T11:41:00.007+09:00</published><updated>2009-04-30T12:04:22.630+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Objective-C'/><title type='text'>Core Data and Bindings</title><content type='html'>&lt;p&gt;I had tried to understand Core Data from last week. I had a hard time to catch on to bindings operation because I haven't been using the bindings until now. Especially the faltering start; what I was feeling difficult to understand was to organize some Array Controllers that have the same name. My skills of Objective-C had stopped improving at 2003. Even so if I couldn’t get perfect understanding, at anyhow I want to run my application with Core Data.  After removing a Array Controller, I must bind relationships to another the same Array Controller. I failed to do it many times.&lt;/p&gt;

&lt;p&gt;So I sought and thought a procedure to do bindings for sure on Core Data. I read some documents and archives of mailing list on Internet, and tried the bindings many times. And I realized there is a way to bind relationships without question.&lt;/p&gt;

&lt;p&gt;To bind again after removing a Array Controller is to transcribe relationships to another Array Controller. Then I should have captured a HUD Window of a Array Controller I would remove. There is information of bindings in the HUD Window. Leave the view of it. Even if I don’t well understand some binding information I removed, I can bind with looking the capture.&lt;/p&gt;

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_vCoDJp475R0/SfkRmtexVKI/AAAAAAAABB8/vf_rgqovF6c/s1600-h/sample_HUDWindow.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 150px;" src="http://3.bp.blogspot.com/_vCoDJp475R0/SfkRmtexVKI/AAAAAAAABB8/vf_rgqovF6c/s320/sample_HUDWindow.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5330310990711051426" /&gt;&lt;/a&gt;

&lt;p&gt;Before I didn’t understand bindings well and referred nothing, nevertheless I would try to bind relationships. That’s why I failed them.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-1916450623136883083?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/1916450623136883083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=1916450623136883083&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/1916450623136883083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/1916450623136883083'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/04/core-data-and-bindings.html' title='Core Data and Bindings'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_vCoDJp475R0/SfkRmtexVKI/AAAAAAAABB8/vf_rgqovF6c/s72-c/sample_HUDWindow.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-4812480635028995252</id><published>2009-04-10T18:38:00.002+09:00</published><updated>2009-04-10T23:28:21.533+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Objective-C'/><title type='text'>Shifting A Main Language</title><content type='html'>&lt;p&gt;I have been usually writing programs with Perl language. I have seldom made a new project file of Objective-C for many years since I made a few applications six or seven years ago, I did nothing other than fixing and extending them only a bit. I begin to forget how to use Interface Builder and to have a bit of bother of even launching Xcode. If nothing is done here, I will really forget Objective-C.&lt;/p&gt;

&lt;p&gt;But I intend to shift main a language from Perl to Objective-C. That’s why I have been writing with Objective-C in nearly a week. So I made ready to briefly implement NSAppleScript, NSTask, and osascript for controlling other applications. Now I think that script code in text files and NSTextView can be used easily. And I also tested RegexKit.framework. After all this effort, perhaps I can shift my environment.&lt;/p&gt;

&lt;p&gt;By the way, NSTextField’s delegate method, textDidEndEditing was not called but controlTextDidEndEditing was OK. I got into a mess. What is correct use?&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-4812480635028995252?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/4812480635028995252/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=4812480635028995252&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/4812480635028995252'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/4812480635028995252'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/04/shifting-main-language.html' title='Shifting A Main Language'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-8986890369749794086</id><published>2009-03-30T00:04:00.007+09:00</published><updated>2009-04-17T23:28:13.914+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='InDesign'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>The Beginning Script for InDesign</title><content type='html'>&lt;p&gt;Always when I make a new window of Script Editor for InDesign, am using following script. And when I want to know an attribute’s names and practical values, too. There is a script to access InDeign there. It’s very simple and elementary content but I think it’s useful. This script itself doesn’t operate InDesign but makes another window of Script Editor. A script I actually want is in the second window. &lt;span style="font-weight:bold;"&gt;I want to get the script from Script menu in menu bar&lt;/span&gt;. Of course I know that if I select the script file in Script menu with the option key, am able to open the file. But immediately the script must be saved as another file name, otherwise the file is updated by me. I failed many times because of forgetting to do that.&lt;/p&gt;

&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;script=property%20window_size%20%3a%20%7b800%2c%20500%7d%0a%0aon%20getContents%28%29%0a%20%20return%20%22tell%20application%20%5c%22Adobe%20InDesign%20CS4%5c%22%0a%20%20tell%20active%20document%0a%20%20%20%20set%20a_object%20to%20object%20reference%20of%20item%201%20of%20selection%0a%20%20%20%20properties%20of%20a_object%0a%20%20end%20tell%0aend%20tell%22%0aend%20getContents%0a%0aon%20get_window_bounds%28%29%0a%20%20tell%20application%20%22Finder%22%20to%20set%20bounds_data%20to%20bounds%20of%20window%20of%20desktop%0a%20%20set%20%7bx%2c%20y%7d%20to%20%7b%28item%203%20of%20bounds_data%29%20%2f%202%2c%20%28item%204%20of%20bounds_data%29%20%2f%202%7d%0a%20%20return%20%7bx%20-%20%28%28item%201%20of%20window_size%29%20%2f%202%29%2c%20y%20-%20%28%28item%202%20of%20window_size%29%20%2f%202%29%7d%0aend%20get_window_bounds%0a%0aon%20run%0a%20%20set%20%7blocation_X%2c%20location_Y%7d%20to%20get_window_bounds%28%29%20of%20me%0a%20%20tell%20application%20%22Script%20Editor%22%0a%20%20%20%20set%20contents_text%20to%20getContents%28%29%20of%20me%0a%20%20%20%20make%20new%20document%20at%20beginning%20with%20properties%20%7bcontents%3acontents_text%7d%0a%20%20%20%20tell%20window%201%20to%20set%20bounds%20to%20%7blocation_X%2c%20location_Y%2c%20%c2%ac%0a%20%20%20%20%20%20%28location_X%20%2b%20%28item%201%20of%20window_size%29%29%2c%20%c2%ac%0a%20%20%20%20%20%20%28location_Y%20%2b%20%28item%202%20of%20window_size%29%29%7d%0a%20%20end%20tell%0aend%20run"&gt;Script Editor opens a new window with following the script.&lt;/a&gt;
&lt;/div&gt;

&lt;pre class="code"&gt;
property window_size : {800, 500}

on getContents()
  return "tell application \"Adobe InDesign CS4\"
  tell active document
    set a_object to object reference of item 1 of selection
    properties of a_object
  end tell
end tell"
end getContents

on get_window_bounds()
  tell application "Finder" to set bounds_data to bounds of window of desktop
  set {x, y} to {(item 3 of bounds_data) / 2, (item 4 of bounds_data) / 2}
  return {x - ((item 1 of window_size) / 2), y - ((item 2 of window_size) / 2)}
end get_window_bounds

on run
  set {location_X, location_Y} to get_window_bounds() of me
  tell application "Script Editor"
    set contents_text to getContents() of me
    make new document at beginning with properties {contents:contents_text}
    tell window 1 to set bounds to {location_X, location_Y, ¬
      (location_X + (item 1 of window_size)), ¬
      (location_Y + (item 2 of window_size))}
  end tell
end run
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-8986890369749794086?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/8986890369749794086/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=8986890369749794086&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/8986890369749794086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/8986890369749794086'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/03/beginning-script-for-indesign.html' title='The Beginning Script for InDesign'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-6267958471533051763</id><published>2009-03-25T09:50:00.004+09:00</published><updated>2009-03-25T09:54:39.186+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><title type='text'>Three Tips About Perl I Have Known in Recent Days</title><content type='html'>&lt;p&gt;Three tips about perl I have known in recent days.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;1. about File::Path module&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The latest version of it is 2.07 and the default version the Leopard installed is 1.08. They have a point of difference in argument of mkpath function between two versions. The first argument of mkpath function is the path to create. If they are plural number, send an anonymous arrays as a argument. But that is the case that the version of File::Path module is 1.08. We must not use a reference in the version 2.07.&lt;/p&gt;

&lt;p&gt;
-&lt;b&gt;legacy&lt;/b&gt;&lt;br /&gt;
 mkpath( ['/foo/bar/baz', 'blurfl/quux'], {verbose =&gt; 1, mode =&gt; 0777} );&lt;br /&gt;
-&lt;b&gt;newness&lt;/b&gt;&lt;br /&gt;
 mkpath( '/foo/bar/baz', 'blurfl/quux', {verbose =&gt; 1, mode =&gt; 0777} );&lt;br /&gt;
&lt;/p&gt;

&lt;p&gt;I took notice of the difference when I ran my program on an another Mac. I have no recollection of updating of the module on the Mac. It's strange.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;2. about file handle&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;I think many people already has known this but haven’t known until recently. To store a file handle in a scalar variable, this way is able to check which a file handle is defined or not defined. It is only necessary to open a file handle when it is only time a script requires for outputting any data. So I don’t have to make a needless file.&lt;/p&gt; 

&lt;pre class="code"&gt;
if ( $error_contents ){
  unless ( defined $fh ){
    open ($fh, "&gt;$dir_store/report.txt");
  }
  print $fh "$error_contents\n";
}
&lt;/pre&gt;&lt;br /&gt;


&lt;p&gt;&lt;b&gt;3. about a directory where a script file is in&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;It’s very easy to know that.&lt;/p&gt;

&lt;pre class="code"&gt;
use FindBin;
$boot_dir = "$FindBin::Bin";
print "$boot_dir\n";
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-6267958471533051763?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/6267958471533051763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=6267958471533051763&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/6267958471533051763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/6267958471533051763'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/03/three-tips-about-perl-i-have-known-in.html' title='Three Tips About Perl I Have Known in Recent Days'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-8078024941440519094</id><published>2009-03-18T12:37:00.006+09:00</published><updated>2009-03-18T12:51:48.476+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><category scheme='http://www.blogger.com/atom/ns#' term='InDesign'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>Space Characters at Different Width</title><content type='html'>&lt;p&gt;The InDesign has some space characters at different width. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ideographics Space&lt;/li&gt;
&lt;li&gt;EM Space&lt;/li&gt;
&lt;li&gt;EN Space&lt;/li&gt;
&lt;li&gt;Nonbreaking Space&lt;/li&gt;
&lt;li&gt;Nonbreaking Space (Fixed Width)&lt;/li&gt;
&lt;li&gt;Hair Space&lt;/li&gt;
&lt;li&gt;Sixth Space&lt;/li&gt;
&lt;li&gt;Thin Space&lt;/li&gt;
&lt;li&gt;Quarter Space&lt;/li&gt;
&lt;li&gt;Third Space&lt;/li&gt;
&lt;li&gt;Punctuation Space&lt;/li&gt;
&lt;li&gt;Figure Space&lt;/li&gt;
&lt;li&gt;Flush Space&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I checked those English names using &lt;a href="http://help.adobe.com/en_US/InDesign/6.0/WSa285fff53dea4f8617383751001ea8cb3f-6f73a.html"&gt;this page&lt;/a&gt;. Maybe the Ideographics Space doesn’t exist in the version except Japanese one. &lt;/p&gt;

&lt;p&gt;If you want to know Japanese names of them, see below the figure:&lt;/p&gt;

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_vCoDJp475R0/ScBuPM4fWLI/AAAAAAAABBk/a5EdSf3Ikuk/s1600-h/spaces_of_Indd.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 158px;" src="http://2.bp.blogspot.com/_vCoDJp475R0/ScBuPM4fWLI/AAAAAAAABBk/a5EdSf3Ikuk/s320/spaces_of_Indd.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5314368767732439218" /&gt;&lt;/a&gt;

&lt;p&gt;The following script creates unicode characters from code number and outputs a file with the result to your desktop. Even if you open the file, you can see nothing but there are some spaces there as invisible characters. If you would like to do hexdump. You can confirm the character codes.&lt;/p&gt;

&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;script=global%20decordCommand%0aglobal%20speaces%0a%0aset%20speaces_encode%20to%20%7b%220x3000%22%2c%20%220x2003%22%2c%20%220x2002%22%2c%20%c2%ac%0a%20%20%220x00A0%22%2c%20%220x202F%22%2c%20%c2%ac%0a%20%20%220x200A%22%2c%20%220x2006%22%2c%20%220x2009%22%2c%20%220x2005%22%2c%20%220x2004%22%2c%20%c2%ac%0a%20%20%220x2008%22%2c%20%220x2007%22%2c%20%220x2001%22%7d%0aset%20result_file_path%20to%20%28path%20to%20desktop%20folder%20as%20Unicode%20text%29%20%26%20%22spaces.txt%22%20as%20Unicode%20text%0aset%20speaces%20to%20%7b%7d%0a%0amake_perlScript%28%29%20of%20me%0arepeat%20with%20encode%20in%20speaces_encode%0a%20%20set%20speaces%20to%20speaces%20%26%20decode_unicode%28encode%29%20of%20me%20as%20Unicode%20text%0aend%20repeat%0a%0aexists_file%20of%20me%20given%20mac_path%3aresult_file_path%0awrite%20speaces%20as%20Unicode%20text%20to%20file%20result_file_path%20--%20No%20BOM%2c%20big%20endian%0a--write%20speaces%20as%20%c2%abclass%20utf8%c2%bb%20to%20file%20result_file_path%0a%0a%28*%0atell%20application%20%22Adobe%20InDesign%20CS4%22%0a%20%20tell%20active%20document%0a%20%20%20%20set%20contents%20of%20selection%20to%20speaces%0a%20%20end%20tell%0aend%20tell%0a*%29%0a%0aspeaces%0a%0a--%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%0a%0aon%20decode_unicode%28encode_data%29%0a%20%20do%20shell%20script%20decordCommand%20%26%20%22%20%22%20%26%20encode_data%0aend%20decode_unicode%0a%0aon%20make_perlScript%28%29%0a%20%20set%20perlScript%20to%20quoted%20form%20of%20%22binmode%28STDOUT%2c%20%27%3autf8%27%29%3b%20print%20pack%20%27U%27%2c%20%28eval%20%24ARGV%5b0%5d%29%3b%20%22%0a%20%20set%20decordCommand%20to%20%22perl%20-e%20%22%20%26%20perlScript%0aend%20make_perlScript%0a%0aon%20exists_file%20given%20mac_path%3aa_path%0a%20%20tell%20application%20%22Finder%22%0a%20%20%20%20set%20posix_path%20to%20quoted%20form%20of%20%28POSIX%20path%20of%20a_path%29%0a%20%20%20%20if%20%28exists%20file%20a_path%29%20then%20do%20shell%20script%20%22unlink%20%22%20%26%20%22%20%22%20%26%20posix_path%0a%20%20%20%20do%20shell%20script%20%22touch%22%20%26%20%22%20%22%20%26%20posix_path%0a%20%20end%20tell%0aend%20exists_file%0a"&gt;Script Editor opens a new window with following the script.&lt;/a&gt;
&lt;/div&gt;

&lt;pre class="code"&gt;
global decordCommand
global speaces

set speaces_encode to {"0x3000", "0x2003", "0x2002", ¬
  "0x00A0", "0x202F", ¬
  "0x200A", "0x2006", "0x2009", "0x2005", "0x2004", ¬
  "0x2008", "0x2007", "0x2001"}
set result_file_path to (path to desktop folder as Unicode text) &amp; "spaces.txt" as Unicode text
set speaces to {}

make_perlScript() of me
repeat with encode in speaces_encode
  set speaces to speaces &amp; decode_unicode(encode) of me as Unicode text
end repeat

exists_file of me given mac_path:result_file_path
write speaces as Unicode text to file result_file_path -- No BOM, big endian
--write speaces as «class utf8» to file result_file_path

(*
tell application "Adobe InDesign CS4"
  tell active document
    set contents of selection to speaces
  end tell
end tell
*)

speaces

--=========================================

on decode_unicode(encode_data)
  do shell script decordCommand &amp; " " &amp; encode_data
end decode_unicode

on make_perlScript()
  set perlScript to quoted form of "binmode(STDOUT, ':utf8'); print pack 'U', (eval $ARGV[0]); "
  set decordCommand to "perl -e " &amp; perlScript
end make_perlScript

on exists_file given mac_path:a_path
  tell application "Finder"
    set posix_path to quoted form of (POSIX path of a_path)
    if (exists file a_path) then do shell script "unlink " &amp; " " &amp; posix_path
    do shell script "touch" &amp; " " &amp; posix_path
  end tell
end exists_file
&lt;/pre&gt;

&lt;p&gt;As next step, there is a thing I want somebody to test. That is to enable a part of comment out with “(* *)” to run, and after selecting one text frame on a document of InDesign, run the script. I expect some space characters will be inputted into the text frame. Those characters are correct, aren’t them?&lt;/p&gt;

&lt;p&gt;But but but ... A case that the data in result area of Script Editor are done “copy &amp; paste” into the text frame, it seems strange. Flush Space is the same character with EM Space.&lt;/p&gt;

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_vCoDJp475R0/ScBuPsOgMDI/AAAAAAAABBs/zWT8RLifU1g/s1600-h/spaces_viaClipboard.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 114px;" src="http://1.bp.blogspot.com/_vCoDJp475R0/ScBuPsOgMDI/AAAAAAAABBs/zWT8RLifU1g/s320/spaces_viaClipboard.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5314368776146268210" /&gt;&lt;/a&gt;

&lt;p&gt;Why does that occur? When the data goes through the clipboard, something happens.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-8078024941440519094?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/8078024941440519094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=8078024941440519094&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/8078024941440519094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/8078024941440519094'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/03/space-characters-at-different-width.html' title='Space Characters at Different Width'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_vCoDJp475R0/ScBuPM4fWLI/AAAAAAAABBk/a5EdSf3Ikuk/s72-c/spaces_of_Indd.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-990624550278789208</id><published>2009-03-11T18:48:00.004+09:00</published><updated>2009-03-11T19:19:09.249+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IDML'/><title type='text'>The IDMLWiki</title><content type='html'>&lt;p&gt;Today we have opened a Mediawiki site about InDesign’s IDML that have been preparing with two buddies for a month. That’s the &lt;a href="http://psychocat.net/IDMLWiki/index.php/Main_Page/ja"&gt;IDMLWiki/ja&lt;/a&gt;. Now mainly, we are translating some public documents of Adobe Systems Inc. into Japanese.  That means, the site doesn’t have enough pages in English for English native speakers: &lt;a href="http://psychocat.net/IDMLWiki/index.php/Main_Page"&gt;IDMLWiki&lt;/a&gt;. But we intend to write some pages for you and will make the effort to do so. &lt;/p&gt;

&lt;p&gt;I hope that more author members and more readers increase, then wish it grew up as a portal site of IDML.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-990624550278789208?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/990624550278789208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=990624550278789208&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/990624550278789208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/990624550278789208'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/03/idmlwiki.html' title='The IDMLWiki'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-1955529362745623211</id><published>2009-02-17T16:42:00.009+09:00</published><updated>2009-09-10T18:44:42.295+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Finder'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>Resume Finder Windows</title><content type='html'>&lt;p&gt;During working with Mac, anyone open a lot of Finder Windows on your desktop. After the operation, all windows are closed. And then, I think that there are times when we want to put the same windows with the same condition many times at a later date. In a case like that, How about using the following script? This script resumes Finder Windows with operation condition on your desktop.&lt;/p&gt;

&lt;p&gt;But I want you to take care of “Universal Access” and “Keyboard Viewer.” The script requires to check “Enable access for assistive device.” Then I also want you to read my blog article “&lt;a href="http://cross-the-sea.blogspot.com/2008/12/is-option-key-pressed.html"&gt;Is Option Key Pressed?&lt;/a&gt;”&lt;/p&gt;

&lt;p&gt;&lt;span style="font-weight:bold;"&gt;How to use:&lt;/span&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Save this script as application or application bundle.&lt;/li&gt;
&lt;li&gt;When you make this script memorize the infomation of Finder Windows, Double-clicking the applet with the option key.&lt;/li&gt;
&lt;li&gt;When you resume Finder Windows, only double-clicking the applet.&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;script=property%20folder_properties%20%3a%20%7b%7d%0a--%20If%20the%20option%20key%20is%20pressed%20when%20this%20script%20runs%2c%20call%20record_properties%28%29.%0aif%20checkOptionKeyDown%28%29%20of%20me%20then%0a%20%20set%20folder_properties%20to%20%7b%7d%0a%20%20record_properties%28%29%20of%20me%0aelse%0a%20%20repeat%20with%20a_folder%20in%20folder_properties%0a%20%20%20%20tell%20a_folder%20to%20resume%28%29%0a%20%20end%20repeat%0aend%20if%0a%0a%0a--%e3%80%80------------------------------------------------------------------------%0aon%20record_properties%28%29%0a%20%20tell%20application%20%22Finder%22%0a%20%20%20%20set%20every_window%20to%20every%20Finder%20window%0a%20%20%20%20repeat%20with%20a_window%20in%20every_window%0a%20%20%20%20%20%20set%20folder_properties%20to%20folder_properties%20%26%20%28new_ResumeFolder%20of%20me%20given%20window_ref%3aa_window%29%0a%20%20%20%20end%20repeat%0a%20%20%20%20display%20dialog%20%22Recording%20was%20completed.%22%0a%20%20end%20tell%0aend%20record_properties%0a%0aon%20checkOptionKeyDown%28%29%0a%20%20try%0a%20%20%20%20tell%20application%20%22System%20Events%22%0a%20%20%20%20%20%20if%20not%20%28%28some%20process%20whose%20name%20contains%20%22KeyboardViewerServer%22%29%20exists%29%20then%0a%20%20%20%20%20%20%20%20tell%20application%20%22KeyboardViewerServer%22%20to%20activate%0a%20%20%20%20%20%20end%20if%0a%20%20%20%20end%20tell%0a%20%20on%20error%0a%20%20%20%20tell%20application%20%22KeyboardViewerServer%22%20to%20activate%0a%20%20end%20try%0a%20%20%0a%20%20tell%20application%20%22System%20Events%22%0a%20%20%20%20set%20optionKeyDown%20to%20%28get%20value%20of%20checkbox%20%22%e2%8c%a5%22%20of%20window%201%20of%20application%20process%20%22KeyboardViewerServer%22%29%20as%20boolean%0a%20%20end%20tell%0a%20%20if%20optionKeyDown%20then%0a%20%20%20%20return%20true%0a%20%20else%0a%20%20%20%20return%20false%0a%20%20end%20if%0aend%20checkOptionKeyDown%0a%0a%0a--%20%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%0a--%20Script%20Object%0a--%20%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%0aon%20new_ResumeFolder%20given%20window_ref%3aa_window%0a%20%20script%20ResumeFolder%0a%20%20%20%20%0a%20%20%20%20property%20the_alias%20%3a%20null%0a%20%20%20%20property%20the_bounds%20%3a%20null%0a%20%20%20%20property%20the_position%20%3a%20null%0a%20%20%20%20property%20the_zoomed%20%3a%20null%0a%20%20%20%20property%20the_collapsed%20%3a%20null%0a%20%20%20%20property%20the_currentView%20%3a%20null%0a%20%20%20%20property%20the_toolbarVisible%20%3a%20null%0a%20%20%20%20property%20the_statusbarVisible%20%3a%20null%0a%20%20%20%20property%20the_sidebarWidth%20%3a%20null%0a%20%20%20%20%0a%20%20%20%20--%20record%0a%20%20%20%20on%20record_windows%20given%20window_ref%3aa_window%0a%20%20%20%20%20%20tell%20application%20%22Finder%22%0a%20%20%20%20%20%20%20%20set%20the_alias%20to%20%28target%20of%20a_window%29%20as%20alias%0a%20%20%20%20%20%20%20%20set%20%7bthe_bounds%2c%20the_position%2c%20the_zoomed%2c%20the_collapsed%2c%20the_currentView%2c%20%c2%ac%0a%20%20%20%20%20%20%20%20%20%20the_toolbarVisible%2c%20the_statusbarVisible%2c%20the_sidebarWidth%7d%20%c2%ac%0a%20%20%20%20%20%20%20%20%20%20to%20%7bbounds%2c%20position%2c%20zoomed%2c%20collapsed%2c%20current%20view%2c%20%c2%ac%0a%20%20%20%20%20%20%20%20%20%20toolbar%20visible%2c%20statusbar%20visible%2c%20sidebar%20width%7d%20of%20a_window%0a%20%20%20%20%20%20%20%20%0a%20%20%20%20%20%20%20%20if%20statusbar%20visible%20of%20a_window%20is%20false%20then%20%c2%ac%0a%20%20%20%20%20%20%20%20%20%20set%20item%204%20of%20the_bounds%20to%20%28item%204%20of%20the_bounds%29%20%2b%2020%0a%20%20%20%20%20%20end%20tell%0a%20%20%20%20end%20record_windows%0a%20%20%20%20%0a%20%20%20%20--%20resume%0a%20%20%20%20on%20resume%28%29%0a%20%20%20%20%20%20tell%20application%20%22Finder%22%0a%20%20%20%20%20%20%20%20try%0a%20%20%20%20%20%20%20%20%20%20open%20the_alias%0a%20%20%20%20%20%20%20%20%20%20set%20properties%20of%20window%201%20to%20%7bbounds%3athe_bounds%2c%20position%3athe_position%2c%20zoomed%3athe_zoomed%2c%20collapsed%3athe_collapsed%2c%20current%20view%3athe_currentView%2c%20toolbar%20visible%3athe_toolbarVisible%2c%20statusbar%20visible%3athe_statusbarVisible%2c%20sidebar%20width%3athe_sidebarWidth%7d%0a%20%20%20%20%20%20%20%20on%20error%0a%20%20%20%20%20%20%20%20%20%20set%20msg%20to%20%22Failure%20to%20open%20a%20folder.%22%0a%20%20%20%20%20%20%20%20%20%20set%20msgDescription%20to%20%28%22The%20folder%20path%20is%20%5c%22%22%20%26%20the_alias%20as%20Unicode%20text%29%20%26%20%22%5c%22.%22%0a%20%20%20%20%20%20%20%20%20%20set%20msgDescription%20to%20msgDescription%20%26%20%22Maybe%2c%20it%20had%20been%20deleted.%22%0a%20%20%20%20%20%20%20%20%20%20display%20alert%20msg%20message%20msgDescription%20buttons%20%7b%22Proceed%22%7d%20%c2%ac%0a%20%20%20%20%20%20%20%20%20%20%20%20default%20button%201%20giving%20up%20after%205%20as%20warning%0a%20%20%20%20%20%20%20%20end%20try%0a%20%20%20%20%20%20end%20tell%0a%20%20%20%20end%20resume%0a%20%20%20%20%0a%20%20%20%20---------------------------------------------------------------------------------------------------------------------------------%0a%20%20%20%20--%20run%20handler%20of%20this%20script%20object%0a%20%20%20%20record_windows%20of%20me%20given%20window_ref%3aa_window%0a%20%20%20%20%0a%20%20end%20script%0a%20%20%0a%20%20tell%20ResumeFolder%20to%20run%0a%20%20return%20ResumeFolder%0aend%20new_ResumeFolder"&gt;Script Editor opens a new window with following the script.&lt;/a&gt;
&lt;/div&gt;

&lt;pre class="code"&gt;
property folder_properties : {}
-- If the option key is pressed when this script runs, call record_properties().
if checkOptionKeyDown() of me then
  set folder_properties to {}
  record_properties() of me
else
  repeat with a_folder in folder_properties
    tell a_folder to resume()
  end repeat
end if


--　------------------------------------------------------------------------
on record_properties()
  tell application "Finder"
    set every_window to every Finder window
    repeat with a_window in every_window
      set folder_properties to folder_properties &amp; (new_ResumeFolder of me given window_ref:a_window)
    end repeat
    display dialog "Recording was completed."
  end tell
end record_properties

on checkOptionKeyDown()
  try
    tell application "System Events"
      if not ((some process whose name contains "KeyboardViewerServer") exists) then
        tell application "KeyboardViewerServer" to activate
      end if
    end tell
  on error
    tell application "KeyboardViewerServer" to activate
  end try
  
  tell application "System Events"
    set optionKeyDown to (get value of checkbox "⌥" of window 1 of application process "KeyboardViewerServer") as boolean
  end tell
  if optionKeyDown then
    return true
  else
    return false
  end if
end checkOptionKeyDown


-- ========================================
-- Script Object
-- ========================================
on new_ResumeFolder given window_ref:a_window
  script ResumeFolder
    
    property the_alias : null
    property the_bounds : null
    property the_position : null
    property the_zoomed : null
    property the_collapsed : null
    property the_currentView : null
    property the_toolbarVisible : null
    property the_statusbarVisible : null
    property the_sidebarWidth : null
    
    -- record
    on record_windows given window_ref:a_window
      tell application "Finder"
        set the_alias to (target of a_window) as alias
        set {the_bounds, the_position, the_zoomed, the_collapsed, the_currentView, ¬
          the_toolbarVisible, the_statusbarVisible, the_sidebarWidth} ¬
          to {bounds, position, zoomed, collapsed, current view, ¬
          toolbar visible, statusbar visible, sidebar width} of a_window
        
        if statusbar visible of a_window is false then ¬
          set item 4 of the_bounds to (item 4 of the_bounds) + 20
      end tell
    end record_windows
    
    -- resume
    on resume()
      tell application "Finder"
        try
          open the_alias
          set properties of window 1 to {bounds:the_bounds, position:the_position, zoomed:the_zoomed, collapsed:the_collapsed, current view:the_currentView, toolbar visible:the_toolbarVisible, statusbar visible:the_statusbarVisible, sidebar width:the_sidebarWidth}
        on error
          set msg to "Failure to open a folder."
          set msgDescription to ("The folder path is \"" &amp; the_alias as Unicode text) &amp; "\"."
          set msgDescription to msgDescription &amp; "Maybe, it had been deleted."
          display alert msg message msgDescription buttons {"Proceed"} ¬
            default button 1 giving up after 5 as warning
        end try
      end tell
    end resume
    
    ---------------------------------------------------------------------------------------------------------------------------------
    -- run handler of this script object
    record_windows of me given window_ref:a_window
    
  end script
  
  tell ResumeFolder to run
  return ResumeFolder
end new_ResumeFolder
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-1955529362745623211?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/1955529362745623211/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=1955529362745623211&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/1955529362745623211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/1955529362745623211'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/02/resume-finder-windows.html' title='Resume Finder Windows'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-1595385856542902777</id><published>2009-02-13T15:07:00.007+09:00</published><updated>2009-02-13T15:47:40.065+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cappuccino'/><title type='text'>A Figure of a Hierarchy in The Scrapbook App</title><content type='html'>&lt;p&gt;I read &lt;a href="http://cappuccino.org/learn/tutorials/scrapbook-tutorial-1/"&gt;scrapbook-tutorial-1&lt;/a&gt; but I couldn’t imagine a hierarchy of some objects in the scrapbook application. So I drew a figure to view the hierarchy of them.&lt;/p&gt;

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_vCoDJp475R0/SZUXftBh7wI/AAAAAAAABA8/gmJ5PE2K47k/s1600-h/scrapBook_layerView.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 229px;" src="http://3.bp.blogspot.com/_vCoDJp475R0/SZUXftBh7wI/AAAAAAAABA8/gmJ5PE2K47k/s320/scrapBook_layerView.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5302169969728024322" /&gt;&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;There are three files as implementation but the number of class is four. The PaneLayer is written in the PageView.j file.&lt;/li&gt;
&lt;li&gt;A CPImage is set in a CPLayer.&lt;/li&gt;
&lt;li&gt;A CALayer is similar to a CPView, but with the ability to have a transform applied to it.&lt;/li&gt;
&lt;li&gt;The _borderlayer become translucence during editing.&lt;/li&gt;
&lt;li&gt;The _borderlayer and the _paneLayer are set in the _rootlayer as sub-layer.&lt;/li&gt;
&lt;li&gt;The inspectore retains a reference of the _paneLayer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I’m pleased that I saw a bit prospect of understanding Cappuccino.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-1595385856542902777?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/1595385856542902777/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=1595385856542902777&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/1595385856542902777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/1595385856542902777'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/02/figure-of-hierarchy-in-scrapbook-app.html' title='A Figure of a Hierarchy in The Scrapbook App'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_vCoDJp475R0/SZUXftBh7wI/AAAAAAAABA8/gmJ5PE2K47k/s72-c/scrapBook_layerView.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-7056567317145731975</id><published>2009-02-11T23:23:00.008+09:00</published><updated>2009-02-12T08:24:07.329+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Shell command'/><category scheme='http://www.blogger.com/atom/ns#' term='Finder'/><title type='text'>Mount_afp And Mount_smbfs</title><content type='html'>&lt;p&gt;I wrote an article about a way to mount a shared directory in a pgae of “&lt;a href="http://cross-the-sea.blogspot.com/2008/12/mount-volume-using-script.html"&gt;Mount Volume using Script&lt;/a&gt;.” AppleScript is used in the script there. After then I realized that that script has an trouble. &lt;/p&gt;

&lt;p&gt;Certainly that script is able to mount a shared folder. There isn’t any trouble to access some files via Finder. But there are times when there is a trouble to try to access files using Perl and shell command. A mount point directory name is indeterminate. Typically a directory is made with the same name as a shared folder’s name just beneath Volumes directory. But sometimes, the mount point directory’s name doesn’t equal the shared directory’s one. The name is added with a number that is “-1”, “-2”, etc. as postfix. AppleScript’s command “mount volume” doesn’t tell me the name as result. Then I can’t know the mount point directory’s name and can’t write the full path of the directory.&lt;/p&gt;

&lt;p&gt;That's why I’ll use a shell command “mount_afp” and “mount_smbfs.” I intend I don’t use AppleScript to mount a shared directory on a server. Before mounting, these shell command require the mount point directory’s path and existing the directory. In other words, I need to make the new directory but can name for free. Consequently I certainly know the mount point directory’s name.&lt;/p&gt;

&lt;p&gt;If you don’t want the mounted point directory to appear in Finder, add an option “-o automounted.” For example:&lt;/p&gt;

&lt;pre class="code"&gt;
mkdir /Volumes/mntpnt
mount_afp [-o automounted] afp://username:userpass@foo.local/volumename/ /Volumes/mntpnt
&lt;/pre&gt;

&lt;p&gt;When you use SMB, look at following sample:&lt;/p&gt;

&lt;pre class="code"&gt;
mkdir /Volumes/mntpnt
mount_smbfs [-o automounted] //username:userpass@foo.local/volumename/ /Volumes/mntpnt
&lt;/pre&gt;

&lt;p&gt;And that’s another thing. How do we eject it?&lt;/p&gt;

&lt;pre class="code"&gt;
umount /Volumes/mntpnt
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-7056567317145731975?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/7056567317145731975/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=7056567317145731975&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7056567317145731975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7056567317145731975'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/02/mountafp-and-mountsmbfs.html' title='Mount_afp And Mount_smbfs'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-7401760556303394732</id><published>2009-02-03T15:29:00.022+09:00</published><updated>2009-02-14T09:19:01.200+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='InDesign'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>The Best Way When Using the Filter Reference Form</title><content type='html'>&lt;p&gt;Before I wrote a script how to get references of text frames that include table objects. 
This is &lt;a href="http://cross-the-sea.blogspot.com/2008/12/every-text-frame-including-table.html"&gt;here&lt;/a&gt;. I had thought it was possible to get those by doing that. But there is a better way and it’s the best way.&lt;/p&gt;

&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;script=tell%20application%20%22Adobe%20InDesign%20CS4%22%0a%20%20tell%20active%20document%0a%20%20%20%20try%0a%20%20%20%20%20%20set%20fill%20color%20of%20every%20item%20of%20all%20page%20items%20%c2%ac%0a%20%20%20%20%20%20%20%20whose%20%28ASCII%20character%2022%29%20is%20in%20contents%20of%20it%20%c2%ac%0a%20%20%20%20%20%20%20%20to%20swatch%20%22Black%22%0a%20%20%20%20end%20try%0a%20%20end%20tell%0aend%20tell"&gt;Script Editor opens a new window with following the script.&lt;/a&gt;
&lt;/div&gt;

&lt;pre class="code"&gt;
tell application "Adobe InDesign CS4"
  tell active document
    try
      set fill color of every item of all page items ¬
        whose (ASCII character 22) is in contents of it ¬
        to swatch "Black"
    end try
  end tell
end tell
&lt;/pre&gt;

&lt;p&gt;I want you to focus attention on “&lt;span style="color:#C13057"&gt;&lt;b&gt;every item&lt;/b&gt;&lt;/span&gt; of all page items.” It’s not &lt;i&gt;every text frame&lt;/i&gt;, but &lt;b&gt;every item&lt;/b&gt;. I had been using also &lt;i&gt;every page item&lt;/i&gt; instead of every text frame until now. It wasn’t correct, either. If you want all reference of objects lower level on the told object, you should write “every item of all page items” together with the filter reference form. And you can get some references at one time.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-7401760556303394732?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/7401760556303394732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=7401760556303394732&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7401760556303394732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7401760556303394732'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/02/best-way-when-using-filter-reference.html' title='The Best Way When Using the Filter Reference Form'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-5212517743759188014</id><published>2009-01-29T15:26:00.008+09:00</published><updated>2009-01-30T15:17:34.141+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><category scheme='http://www.blogger.com/atom/ns#' term='IDML'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>Export IDML and Decompress it without IDMLTools</title><content type='html'>&lt;p&gt;The following script exports a IDML package using active document on InDesign CS4 and decompressed it without IDMLTools. It means this script works on a machine that doesn’t have development environment, perhaps.&lt;p&gt;

&lt;p&gt;A IDML file is outputed in the same folder with the .indd file. Then after making a new folder in the same folder, the script stores decompressed UCF files in the folder.&lt;p&gt;

&lt;p&gt;This script was done checking of operations on Leopard. I don’t recommend using on Tiger. I think that especially this script may not works on Tiger with Japanese system.&lt;/p&gt;


&lt;pre class="code"&gt;
#!/usr/bin/perl -w
use strict;
use utf8;
use open ":utf8";
use open ":std";

# Make osascripts.
my $InD_path_osa = new_InD_path();
my $export_osa   = new_export();
my $package_osa  = new_package();

# Get a file path that is active document of InDesign.
my ( $dir_path, $docu_name ) = get_active_document_path();

# Export a IDML package.
my $IDML_name = $docu_name;
$IDML_name =~ s/\.indd$/\.idml/;
# If you want to export a IDML to another directory else, rewrite $dir_path.
# Then, don’t forget that $dir_path is Mac path.
# And a colon is needed on the end.
export_IDML( $dir_path, $IDML_name );

# Decompress the IDML package.
decompress( $dir_path, $IDML_name );


#-----------------------------------------------------------------------------
sub get_active_document_path{
  my $result = readpipe $InD_path_osa;
  if( $? != 0 ){ die "error : the ". __LINE__. "th line of “$0.”\n" };

  utf8::decode($result);
  chomp $result;
  if ( $result eq 'missing value' ){
    print "There isn’t even one document.";
    exit;
  }
  my ( $the_path, $the_name ) = split /, /, $result;
  return ( $the_path, $the_name );
}

#-----------------------------------------------------------------------------
sub export_IDML{
  my ( $destination_path, $idml_name ) = @_;
  my $idml_path = "$destination_path$idml_name";
  my $result = readpipe "$export_osa '$idml_path'";
  if( $? != 0 ){ die "error : the ". __LINE__. "th line of “$0.”\n" };

  utf8::decode($result);
  chomp $result;
  if ( $result ne 'true' ){
    print "AppleScript error : export_IDML() $result\n";
    exit;
  }  
}

#-----------------------------------------------------------------------------
sub decompress{
  my ( $idml_dir_path, $idml_name ) = @_;
  my $idml_path = "$idml_dir_path$idml_name";
  my ( $destination_path, $source_dir_name ) = ('', '');
  my @ARGV_for_as;  

  $source_dir_name = $idml_name;
  $source_dir_name =~ s/\.idml$//;
  $destination_path = "$idml_dir_path$source_dir_name";

  push @ARGV_for_as, 'd';
  push @ARGV_for_as, "'$idml_path'";
  push @ARGV_for_as, "'$destination_path'";
  $package_osa .= " @ARGV_for_as"; 

  my $result = readpipe "$package_osa";
  if( $? != 0 ){ die "error : the ". __LINE__. "th line of “$0.”\n" };

  utf8::decode($result);
  chomp $result;
  if ( $result ne 'true' ){
    print "AppleScript error : decompress() $result\n";
    exit;
  }  
}

#-----------------------------------------------------------------------------
# Make osascripts.
#-----------------------------------------------------------------------------
sub compress_osa{
  my $source_ref = shift;
  my $osascript = 'osascript ';
  map{
    s/^[\t ]*//g;
    s/"/\\"/g;
    $osascript .= ' -e "'. $_. '"';
  } @$source_ref;
  return $osascript;
}

sub new_InD_path{
  my @AS = &lt;&lt;"__EOD__" =~ m/(.*)\n/g;
  on run ARGV
    tell application "Adobe InDesign CS4"
      if (count of document) = 0 then return missing value
      set a_dir_path to (file path of active document) as Unicode text
      set a_docu_name to (name of active document) as Unicode text
    end tell
    return {a_dir_path, a_docu_name}
  end run
__EOD__
  return compress_osa( \@AS );
}

sub new_export{
  my @AS = &lt;&lt;"__EOD__" =~ m/(.*)\n/g;
  on run ARGV
    set idml_path to ARGV as Unicode text
    tell application "Adobe InDesign CS4"
      tell active document
        export format InDesign markup to idml_path without showing options
      end tell
    end tell
    return true
  end run
__EOD__
  return compress_osa( \@AS );
}

sub new_package{
  my @AS = &lt;&lt;"__EOD__" =~ m/(.*)\n/g;
  on run ARGV
    set {operation_mode, source_path, destination_path} to {item 1 of ARGV, item 2 of ARGV, item 3 of ARGV}
    tell application "Adobe InDesign CS4"
      if operation_mode is "c" then
        package UCF source folder source_path UCF file destination_path
      else if operation_mode is "d" then
        unpackage UCF UCF file source_path destination folder destination_path
      else
        return "The operation mode is wrong."
      end if
    end tell
    return true
  end run
__EOD__
  return compress_osa( \@AS );
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-5212517743759188014?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/5212517743759188014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=5212517743759188014&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/5212517743759188014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/5212517743759188014'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/01/export-idml-and-decompress-it-without.html' title='Export IDML and Decompress it without IDMLTools'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-5229912815627961415</id><published>2009-01-28T17:08:00.013+09:00</published><updated>2009-01-28T17:16:52.638+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IDML'/><title type='text'>Schema Checking</title><content type='html'>&lt;p&gt;Oh, I’m sorry that I skipped a step. I sholud check a IDML using a schema before the IDML will be opened by the InDesign. I have forgotten to do that.&lt;/p&gt;

&lt;p&gt;Today, I tried to check &lt;i&gt;the helloworld-2.idml&lt;/i&gt; file. This file wasn’t exported by the InDesign but edited by a text editor. The InDesign properly opened this IDML package. However the IDML wasn’t validated and there were some error in the results. According to the INXErrorLogging plugin, error is nothing.&lt;/p&gt;

&lt;p&gt;Also I tried to check with Schema.zip on the Adobe site: http://www.adobe.com/devnet/indesign/docs/idml-schema.zip. The result was the same. Well, I’ll find out the cause next.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-5229912815627961415?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/5229912815627961415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=5229912815627961415&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/5229912815627961415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/5229912815627961415'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/01/schema-checking.html' title='Schema Checking'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-3428508271499312264</id><published>2009-01-23T18:27:00.012+09:00</published><updated>2009-03-09T16:07:06.107+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IDML'/><title type='text'>The Debugger for IDML</title><content type='html'>&lt;p&gt;When we do developing software, if there isn’t a debugger we must be arduous. It’s time when a IDML package has errors, nevertheless InDesign CS4 opens the package. It is silent. Unexpected data and scripting errors are ignored. Otherwise correct IDML packages aren’t treated in continuity. The progress is stopped. So, I appreciate that errors are ignored. But this behavior makes it difficult to debug IDML files. If there isn’t the error information, to find where wrong deta is in is difficult. I think that it’s better to install a debugger for IDML before starting to generate xml files.&lt;/p&gt;

&lt;p&gt;Let’s look &lt;a href="http://www.adobe.com/devnet/indesign/pdfs/idml-cookbook.pdf"&gt;a COOKBOOK PDF&lt;/a&gt;. There is a description at 14th page. The debugger for IDML is provided to us as plugins. We need to compile the source files but without coding. I’m a mac user, therefore I will introduce only the way forward to making plugins with Xcode.&lt;/p&gt;

&lt;p&gt;The project files are in &amp;lt;SDK&gt;/build/mac/prj/. The file names of them are INXErrorLogging.sdk.xcodeproj and INXErrorLoggingUI.sdk.xcodeproj.&lt;/p&gt;
  
&lt;p&gt;After one of them will be opened, at first select Release mode from popup menu at the top-left on window.&lt;/p&gt;

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_vCoDJp475R0/SXmUnsaejwI/AAAAAAAABAA/WEw_WQv-fwg/s1600-h/IDML_debug_release.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 120px;" src="http://4.bp.blogspot.com/_vCoDJp475R0/SXmUnsaejwI/AAAAAAAABAA/WEw_WQv-fwg/s320/IDML_debug_release.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5294426246608752386" /&gt;&lt;/a&gt;

&lt;p&gt;Then click a build button. The plugin will be made on &amp;lt;sdk&gt;/build/mac/release/SDK/. To show the completed plugin on Finder is easy. Look at the following picture.&lt;/p&gt;
  
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_vCoDJp475R0/SXmUn7qQl8I/AAAAAAAABAI/X90CeqBE6hY/s1600-h/pickup_plugin.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 170px;" src="http://3.bp.blogspot.com/_vCoDJp475R0/SXmUn7qQl8I/AAAAAAAABAI/X90CeqBE6hY/s320/pickup_plugin.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5294426250701477826" /&gt;&lt;/a&gt;

&lt;p&gt;Select the name of Products folder on left of window, in this case INXErrorLogging.sdk.InDesignPlugin, and select “Reveal in Finder” using  context menu. After then move it to Plug-Ins folder of Indesign CS4; /Applications/Adobe InDesign CS4/Plug-Ins/UI/. Of course, don’t forget &lt;span style="font-weight:bold;"&gt;INXErrorLogging&lt;span style="color:#C13057;"&gt;UI&lt;/span&gt;.sdk.xcodeproj&lt;/span&gt;, too.&lt;/p&gt;

&lt;p&gt;At the last, we need to tell InDesign CS4 a reference of log file. Make an empty text file and display a dialog to select the file from menu bar as below.&lt;/p&gt;

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_vCoDJp475R0/SXmUn_qgK-I/AAAAAAAABAQ/cSds_L6mDZA/s1600-h/select_log_file.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 47px;" src="http://3.bp.blogspot.com/_vCoDJp475R0/SXmUn_qgK-I/AAAAAAAABAQ/cSds_L6mDZA/s320/select_log_file.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5294426251776240610" /&gt;&lt;/a&gt;

&lt;p&gt;So, let’s mistake for effect (^.^) and try to out put error log! I used the most simple IDML package. I edited Spread_spread1.xml. I deleted one character of attribute name, then compressed the folder and opened the IDML package.&lt;/p&gt;

&lt;pre class="code"&gt;
&amp;lt;PathPointArray&gt;
 &amp;lt;PathPoint Anchor="36 36" LeftDirection="36 36" RightDirection="36 36"/&gt;
 &amp;lt;PathPoint Anchor="36 186" LeftDirection="36 186" RightDirection="36 186"/&gt;
 &amp;lt;PathPoint &lt;span style="color:#C13057;"&gt;Ancho&lt;/span&gt;="172 186" LeftDirection="172 186" RightDirection="172 186"/&gt;
 &amp;lt;PathPoint Anchor="172 36" LeftDirection="172 36" RightDirection="172 36"/&gt;
&amp;lt;/PathPointArray&gt;
&lt;/pre&gt;

&lt;p&gt;This was the result.&lt;/p&gt;

&lt;pre class="code"&gt;Begin a new INX Import Error Log

Scripting Property Error: set property 'path geometry' on object 'text frame' failed with error 0x770d 'セットのプロパティ 'PathGeometry' の値が無効です。予想される値は Array of GeometryPathType ですが、値 (((((36.0, 36.0), (36.0, 36.0), (36.0, 36.0)), ((36.0, 186.0), (36.0, 186.0), (36.0, 186.0)), (nothing, (172.0, 186.0), (172.0, 186.0)), ((172.0, 36.0), (172.0, 36.0), (172.0, 36.0))), FALSE)) を受け取りました。'
End of a session
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-3428508271499312264?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/3428508271499312264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=3428508271499312264&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/3428508271499312264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/3428508271499312264'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/01/debugger-for-idml.html' title='The Debugger for IDML'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_vCoDJp475R0/SXmUnsaejwI/AAAAAAAABAA/WEw_WQv-fwg/s72-c/IDML_debug_release.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-4842812118715459440</id><published>2009-01-21T18:32:00.002+09:00</published><updated>2009-01-21T23:38:07.646+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IDML'/><title type='text'>Java Isn’t Essential</title><content type='html'>&lt;blockquote&gt;The samples use Java to accomplish those tasks that are not easily achieved in XLSLT. Another programming language could be substituted easily.&lt;/blockquote&gt;

&lt;p&gt;Those phrase are at the 22th page in a document “idml-cookbook.pdf.” I was so relieved when I have read those lines. To learn Java besides IDML is bitter for me. I’m glad it became clear that Java isn’t essential. From now on, I’ll concentrate on understanding the format specification.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-4842812118715459440?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/4842812118715459440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=4842812118715459440&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/4842812118715459440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/4842812118715459440'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/01/java-isnt-essential.html' title='Java Isn’t Essential'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-7771864855549402844</id><published>2009-01-16T17:35:00.003+09:00</published><updated>2010-01-08T17:35:41.814+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cappuccino'/><title type='text'>Reading Scrapbook Part 1</title><content type='html'>&lt;p&gt;I’m going to read “&lt;a href="http://cappuccino.org/learn/tutorials/scrapbook-tutorial-1/"&gt;Scrapbook Part 1&lt;/a&gt;” on cappuccino.org and writing memos to each line on &lt;s&gt;AppleFarm&lt;/s&gt;(closed). But all of them are Japanese language because I don't have the ability to write ones in English. I’m tied up with trying to understand cappuccino’s framework.&lt;/p&gt;

&lt;p&gt;I feel that _borderLayer is difficult for me to understand. Especially, CGContext... It seems to be descended from Quartz of Cocoa framework. I have never handled Quartz till now.&lt;/p&gt;

&lt;p&gt;There are PhotoInspector.j as rest and also “&lt;a href="http://cappuccino.org/learn/tutorials/scrapbook-tutorial-2/"&gt;Scrapbook Part 2&lt;/a&gt;”, “&lt;a href="http://cappuccino.org/learn/tutorials/automatic-layout/"&gt;Automatic Layout Support&lt;/a&gt;”, “&lt;a href="http://cappuccino.org/discuss/2008/10/08/xmlhttprequest-jsonp-cappuccino/"&gt;XMLHTTPRequest, JSONP &amp; Cappuccino&lt;/a&gt;” and so on. I should like to make my time more to learn.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-7771864855549402844?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/7771864855549402844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=7771864855549402844&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7771864855549402844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7771864855549402844'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/01/reading-scrapbook-part-1.html' title='Reading Scrapbook Part 1'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-4558266730756786065</id><published>2009-01-08T12:25:00.002+09:00</published><updated>2009-01-08T12:55:12.150+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IDML'/><title type='text'>RELAX NG, Jing and Java</title><content type='html'>&lt;p&gt;I was the first to check some source files of Java because of anxiety.&lt;/p&gt;

&lt;p&gt;There was a code that called some files of Java in addcatalogpages.sh. I was not sure that “.jar” were class files of Java: idmltest.jar, idmltools.jar, xercesImpl.jar and all the rest. I thought it was like including libraries. But even if those files was opened, I wouldn't understand them because of bainary files. Then where were those source files? What did “com.adobe.idml.samples.AddCatalogPages” means? It seemed to look like a file path. I searched Spotlight for “AddCatalogPages.” There was a file “AddCatalogPages.java” in a dirctory “&lt;SDK&gt;/devtools/sdktools/idmltools/src/com/adobe/idml/samples/.” I read those sources and felt a bit reassured. I don’t know Java but dimly understood it. If I spend a lot of time reading, perhaps I would understand it.&lt;/p&gt;

&lt;p&gt;After that, I unachieved “&lt;SDK&gt;/devtools/sdktools/idmltools/docs.zip” and browsed docs/api/index.html. It’s “Overview (IDML Tools).” How to use was here.&lt;/p&gt;

&lt;p&gt;I thought I would need to check two keywords: RELAX NG(&lt;a href="http://www.ibm.com/developerworks/xml/library/x-matters25.html"&gt;English&lt;/a&gt;, &lt;a href="http://www.ibm.com/developerworks/jp/xml/library/x-matters25/"&gt;Japanese&lt;/a&gt;) and &lt;a href="http://www.thaiopensource.com/relaxng/jing.html"&gt;Jing&lt;/a&gt;, and learn Java a little.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-4558266730756786065?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/4558266730756786065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=4558266730756786065&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/4558266730756786065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/4558266730756786065'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/01/relax-ng-jing-and-java.html' title='RELAX NG, Jing and Java'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-7898616059601603815</id><published>2009-01-06T16:42:00.007+09:00</published><updated>2009-01-06T16:59:56.911+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IDML'/><title type='text'>The First Step of  IDML</title><content type='html'>&lt;p&gt;Yesterday, I had installed InDesign CS4 and began to learn IDML from today.&lt;/p&gt;

&lt;p&gt;At first, I accessed &lt;a href="http://www.adobe.com/devnet/indesign/"&gt;InDesign Developer Center&lt;/a&gt;. There were two tabs there: [HOME] and [DOCUMENTATION]. Then I clicked [DOCUMENTATION] tab and downloaded three PDF files and a zip file at the most bottom of the page.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;InDesign CS4 IDML ReadMe&lt;/li&gt;
&lt;li&gt;Adobe InDesign CS4 IDML Language Specification&lt;/li&gt;
&lt;li&gt;Adobe InDesign CS4 IDML Cookbook&lt;/li&gt;
&lt;li&gt;Adobe InDesign CS4 DML Schema.zip&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And after I clicked a link “&lt;a href="http://www.adobe.com/devnet/indesign/sdk/eula_cs4.html"&gt;Download the InDesign CS4 Products SDK&lt;/a&gt;” on [HOME] tab, downloaded follwing the zip file:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;fileadobe_indesign_cs4_products_sdk_352mac.dmg&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I read idml-specification.pdf about 22 pages, eight chapters, then changed the document and started reading idml-cookbook.pdf.&lt;/p&gt;

&lt;p&gt;Knowledge of Java is necessary or not? Now that’s what I’m afraid of. I intend to look some sample codes tomorrow.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-7898616059601603815?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/7898616059601603815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=7898616059601603815&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7898616059601603815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7898616059601603815'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2009/01/first-step-of-idml.html' title='The First Step of  IDML'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-7360658899181342075</id><published>2008-12-25T17:01:00.006+09:00</published><updated>2009-10-28T19:57:32.988+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='misc.'/><title type='text'>Setting of MediaWiki</title><content type='html'>&lt;p&gt;Even if the latest version of MediaWiki was installed, MediaWiki can’t show contents and isn’t available for some functions like Wikipedia. We have to install some extensions, write setup in LocalSettings.php and if necessary, make new pages as Template. It’s mean MediaWiki is not Wikipedia whitout contents but Wikipedia is a system that was customized from MediaWiki. I had been under the misconception.&lt;/p&gt;

&lt;p&gt;Here, I’m going to list what I went over to a MediaWiki on my work.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;span style="font-weight:bold;"&gt;Extensions added&lt;/span&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href="http://www.mediawiki.org/wiki/Extension:ParserFunctions"&gt;ParserFunctions&lt;/a&gt; &lt;span style="font-style:italic; font-size:90%"&gt;(Enhances parser with logical functions.)&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="http://www.mediawiki.org/wiki/Extension:Cite/Cite.php"&gt;Cite&lt;/a&gt; &lt;span style="font-style:italic; font-size:90%"&gt;(Add footnotes in a document.)&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi"&gt;SyntaxHighlight_GeSHi&lt;/a&gt; &lt;span style="font-style:italic; font-size:90%"&gt;(Display preformatted code with coloring.)&lt;/span&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;span style="font-weight:bold;"&gt;Templates&lt;/span&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href="http://www.mediawiki.org/wiki/Template:Languages"&gt;Template:Languages&lt;/a&gt; &lt;span style="font-style:italic; font-size:90%"&gt;(Display the other language page that have the same name.)&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="http://www.mediawiki.org/wiki/Template:Languages/Lang"&gt;Template:Languages/Lang&lt;/a&gt; &lt;span style="font-style:italic; font-size:90%"&gt;(a sub template of above this one.)&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="http://www.mediawiki.org/wiki/Template:Note"&gt;Template:Note&lt;/a&gt; &lt;span style="font-style:italic; font-size:90%"&gt;(Display a note.)&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Template:Stub"&gt;Template:Stub&lt;/a&gt; &lt;span style="font-style:italic; font-size:90%"&gt;(Display visited people that this page is working article.)&lt;/span&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;span style="font-weight:bold;"&gt;CSS&lt;/span&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href="http://www.mediawiki.org/wiki/MediaWiki:Common.css"&gt;MediaWiki:Common.css&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As a whole, it’s difficult to know things to do for using functions on MediaWiki. And almost what I wanted to do were not available as I listed above. I was tired. But I think MediaWiki is exciting.&lt;/p&gt;

&lt;p&gt;By the way, I’m using the XREA for private MediaWiki. Its server’s PHP runs in safe mode. This mode is a troublemaker. I experienced some troubles when I deleted pages and image files. On these occasions, MediaWiki trys to make some directories. However PHP fails because of file permission problems. I read support pages in XREA but I couldn’t solve it. After all, I found the solution in &lt;a href="http://jehy.ru/articles/2008/09/29/mediawiki-in-safe-mode_images-deleted-thumbnails-timezone-etc/"&gt;this page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;And one more point, if you want to use URL PROTOCOL SUPPORT of AppleScript, you need to write $wgUrlProtocols in LocalSettings.php as following:&lt;/p&gt;

&lt;pre class="code"&gt;
$wgUrlProtocols[] = "applescript:";
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-7360658899181342075?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/7360658899181342075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=7360658899181342075&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7360658899181342075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/7360658899181342075'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2008/12/setting-of-mediawiki.html' title='Setting of MediaWiki'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-4162969100407937254</id><published>2008-12-18T15:34:00.015+09:00</published><updated>2008-12-18T16:26:42.905+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>Is Option Key Pressed?</title><content type='html'>&lt;p&gt;For a long time, I really have wanted to know how to use modified key when an AppleScript’s application starts. Because I want to change behavior of the application. But it seemed impossible. Only using "System Events" isn’t enough to detect which any key is pressed.&lt;/p&gt;

&lt;p&gt;Today I have found the way to do that on &lt;a href="http://lists.apple.com/archives/applescript-users/2008/Dec/msg00320.html"&gt;Apple Mailing Lists&lt;/a&gt;. It worked well to my expectation! Oh, was I happy!!!!&lt;/p&gt;

&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;script=try%0d%09tell%20application%20%22System%20Events%22%0d%09%09if%20not%20%28%28some%20process%20whose%20name%20contains%20%22KeyboardViewerServer%22%29%20exists%29%20then%0d%09%09%09tell%20application%20%22KeyboardViewerServer%22%20to%20activate%0d%09%09end%20if%0d%09end%20tell%0don%20error%0d%09tell%20application%20%22KeyboardViewerServer%22%20to%20activate%0dend%20try%0d%0dtell%20application%20%22System%20Events%22%0d%09set%20optionKeyDown%20to%20%28get%20value%20of%20checkbox%20%22%e2%8c%a5%22%20of%20window%201%20of%20application%20process%20%22KeyboardViewerServer%22%29%20as%20boolean%0dend%20tell%0d%0dtell%20application%20%22Finder%22%0d%09activate%0d%09if%20optionKeyDown%20then%0d%09%09display%20dialog%20%22The%20option%20key%20was%20pressed%2e%22%0d%09else%0d%09%09display%20dialog%20%22The%20option%20key%20wasn%e2%80%99t%20pressed%2e%22%0d%09end%20if%0dend%20tell" title="This script detects modified key when itself starts."&gt;ScriptEditor opens a new window with following the script.&lt;/a&gt;&lt;/div&gt;
&lt;pre class="code"&gt;
try
  tell application "System Events"
    if not ((some process whose name contains "KeyboardViewerServer") exists) then
      tell application "KeyboardViewerServer" to activate
    end if
  end tell
on error
  tell application "KeyboardViewerServer" to activate
end try

tell application "System Events"
  set optionKeyDown to (get value of checkbox "⌥" of window 1 of application process "KeyboardViewerServer") as boolean
end tell

tell application "Finder"
  activate
  if optionKeyDown then
    display dialog "The option key was pressed."
  else
    display dialog "The option key wasn’t pressed."
  end if
end tell
&lt;/pre&gt;

&lt;p&gt;But the script didn’t work on some co-worker’s Mac the same Leopard. What was different to compare my mac to their ones? I was asked where was “KeyboardViewer&lt;span style="font-weight:bold;"&gt;Server&lt;/span&gt;” by a dialog. I didn’t know the appliction called such a name but knew if it was “Keyboard Viewer.” I couldn’t find the “KeyboardViewerServer” in the choose application window. After checking in on those machine, the riddle became clear. Apparently, application “Keyboard Viewer” was never used on those Mac, not once.&lt;/p&gt;

&lt;p&gt;Let’s open [System Preference] and select [International] -&gt; [Input Menu] tab and check [Keyboard Viewer].&lt;/p&gt;

&lt;p&gt;Then select [Show Keyboard Viewer] from Input Menu Bar. After “Keyboard Viewer” was used once, this script worked well. You don’t need to show the Keyboard Viewer hereafter. &lt;/p&gt;

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_vCoDJp475R0/SUn1xLaP_ZI/AAAAAAAAA-0/R5EiM9cUd44/s1600-h/KeyboardViewer.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 120px;" src="http://3.bp.blogspot.com/_vCoDJp475R0/SUn1xLaP_ZI/AAAAAAAAA-0/R5EiM9cUd44/s320/KeyboardViewer.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5281022263293902226" /&gt;&lt;/a&gt;

&lt;p&gt;When this script run on Tiger, the Keyboard Viewer was displayed. I wondered this is not available on Tiger.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-4162969100407937254?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/4162969100407937254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=4162969100407937254&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/4162969100407937254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/4162969100407937254'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2008/12/is-option-key-pressed.html' title='Is Option Key Pressed?'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_vCoDJp475R0/SUn1xLaP_ZI/AAAAAAAAA-0/R5EiM9cUd44/s72-c/KeyboardViewer.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-8295999407678335490</id><published>2008-12-15T15:53:00.018+09:00</published><updated>2009-03-21T09:15:24.774+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><category scheme='http://www.blogger.com/atom/ns#' term='InDesign'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>A Color Gradation and Angle</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_vCoDJp475R0/SUYCGJnETxI/AAAAAAAAA9w/jR2kDDXqS0U/s1600-h/gradation_angle.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5279909917820735250" src="http://1.bp.blogspot.com/_vCoDJp475R0/SUYCGJnETxI/AAAAAAAAA9w/jR2kDDXqS0U/s400/gradation_angle.jpg" style="cursor: hand; cursor: pointer; float: left; height: 204px; margin: 0 10px 10px 0; width: 283px;" /&gt;&lt;/a&gt;
&lt;p&gt;In InDesign, when we want to fill a page item: text frames or rectangle etc. with a color gradation and angle, we need three values. They are a base point, hypotenuse and angle. It’s easy to get coordinates of the base point. And to get the hypotenuse is possible in only AppleScript even without any OSAX. For example:&lt;/p&gt;
&lt;br style="clear: both;"/&gt;
&lt;pre class="code"&gt;set hypotenuse to ((width ^ 2) + (height ^ 2)) ^ 0.5&lt;/pre&gt;

&lt;p&gt;But It’s impossible to calculate only angle in AppleScript. Of course if I could make me write the function, it would be good. However I don’t have such ability. There is a good way more than do that. Make the Perl to work out the angle. Let’s prepare the one liner just below:&lt;/p&gt;

&lt;pre class="code"&gt;perl -MMath::Trig -e 'print atan($ARGV[0]/$ARGV[1]) *(180 /pi)'
&lt;/pre&gt;
&lt;p&gt;Functions AppleScript has in oneself are poorly-function, nevertheless linkage working between other languages is very smooth.&lt;/p&gt;
&lt;p&gt;
By the way, when you try this sample script, don’t forget to prepare a swatch color in a document.&lt;/p&gt;
&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;amp;script=%2d%2d%20require%20two%20values%2e%0dset%20gradation_swatch_name%20to%20%22G_M100%22%0dset%20direction%20to%20%22rightDown%22%20%2d%2d%20rightUp%20or%20rightDown%0d%2d%2d%0dset%20one_liner%20to%20%22perl%20%2dMMath%3a%3aTrig%20%2de%20%27print%20atan%28%24ARGV%5b0%5d%2f%24ARGV%5b1%5d%29%20%2a%28180%20%2fpi%29%27%22%0d%0dtell%20application%20%22Adobe%20InDesign%20CS2%22%0d%09tell%20active%20document%0d%09%09set%20a_rectangle%20to%20item%201%20of%20selection%0d%09%09set%20gradation_swatch_obj%20to%20swatch%20gradation_swatch_name%0d%09%09tell%20a_rectangle%0d%09%09%09set%20bounds_data%20to%20visible%20bounds%0d%09%09%09set%20W%20to%20%28item%204%20of%20bounds_data%29%20%2d%20%28item%202%20of%20bounds_data%29%0d%09%09%09set%20H%20to%20%28item%203%20of%20bounds_data%29%20%2d%20%28item%201%20of%20bounds_data%29%0d%09%09%09%0d%09%09%09set%20hypotenuse%20to%20%28%28W%20%5e%202%29%20%2b%20%28H%20%5e%202%29%29%20%5e%200%2e5%20%2d%2d%e3%80%80%22%5e%200%2e5%22%20is%20%20instead%20of%20%e2%88%9a%2e%0d%09%09%09set%20atan_command%20to%20one_liner%20%26%20%22%20%22%20%26%20H%20%26%20%22%20%22%20%26%20W%0d%09%09%09set%20theAngle%20to%20%28do%20shell%20script%20atan_command%29%20as%20number%0d%09%09%09%0d%09%09%09if%20direction%20is%20%22rightUp%22%20then%0d%09%09%09%09set%20gradient_start_point%20to%20%7bitem%202%20of%20bounds_data%2c%20item%203%20of%20bounds_data%7d%0d%09%09%09else%20if%20direction%20is%20%22rightDown%22%20then%0d%09%09%09%09set%20theAngle%20to%200%20%2d%20theAngle%0d%09%09%09%09set%20gradient_start_point%20to%20%7bitem%202%20of%20bounds_data%2c%20item%201%20of%20bounds_data%7d%0d%09%09%09else%0d%09%09%09%09set%20msg%20to%20%22A%20value%20you%20enterd%20is%20%5c%22%22%20%26%20direction%20%26%20%22%2e%5c%22%22%20%26%20return%20%26%20%c2%ac%0d%09%09%09%09%09%22Reqiure%20%5c%22rightUp%5c%22%20or%20%5c%22rightDown%2e%5c%22%22%0d%09%09%09%09display%20alert%20%22Error%20%3a%20direction%20is%20wrong%2e%22%20message%20msg%0d%09%09%09%09error%20number%20%2d128%0d%09%09%09end%20if%0d%09%09%09%0d%09%09%09set%20fill%20color%20to%20gradation_swatch_obj%0d%09%09%09set%20gradient%20fill%20start%20to%20gradient_start_point%0d%09%09%09set%20gradient%20fill%20angle%20to%20theAngle%0d%09%09%09set%20gradient%20fill%20length%20to%20hypotenuse%0d%09%09end%20tell%0d%09end%20tell%0dend%20tell%0d%0d%7bW%2c%20H%2c%20hypotenuse%2c%20theAngle%7d" title="This script fills with a gradation."&gt;ScriptEditor opens a new window with following the script.&lt;/a&gt;&lt;/div&gt;
&lt;pre class="code"&gt;-- require two values.
set gradation_swatch_name to "G_M100"
set direction to "rightDown" -- rightUp or rightDown
--
set one_liner to "perl -MMath::Trig -e 'print atan($ARGV[0]/$ARGV[1]) *(180 /pi)'"

tell application "Adobe InDesign CS2"
 tell active document
   set a_rectangle to item 1 of selection
   set gradation_swatch_obj to swatch gradation_swatch_name
   tell a_rectangle
     set bounds_data to visible bounds
     set W to (item 4 of bounds_data) - (item 2 of bounds_data)
     set H to (item 3 of bounds_data) - (item 1 of bounds_data)
    
     set hypotenuse to ((W ^ 2) + (H ^ 2)) ^ 0.5 --　"^ 0.5" is  instead of √.
     set atan_command to one_liner &amp;amp; " " &amp;amp; H &amp;amp; " " &amp;amp; W
     set theAngle to (do shell script atan_command) as number
    
     if direction is "rightUp" then
       set gradient_start_point to {item 2 of bounds_data, item 3 of bounds_data}
     else if direction is "rightDown" then
       set theAngle to 0 - theAngle
       set gradient_start_point to {item 2 of bounds_data, item 1 of bounds_data}
     else
       set msg to "A value you enterd is \"" &amp;amp; direction &amp;amp; ".\"" &amp;amp; return &amp;amp; ¬
         "Reqiure \"rightUp\" or \"rightDown.\""
       display alert "Error : direction is wrong." message msg
       error number -128
     end if
    
     set fill color to gradation_swatch_obj
     set gradient fill start to gradient_start_point
     set gradient fill angle to theAngle
     set gradient fill length to hypotenuse
   end tell
 end tell
end tell

{W, H, hypotenuse, theAngle}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-8295999407678335490?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/8295999407678335490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=8295999407678335490&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/8295999407678335490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/8295999407678335490'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2008/12/color-gradation-and-angle.html' title='A Color Gradation and Angle'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_vCoDJp475R0/SUYCGJnETxI/AAAAAAAAA9w/jR2kDDXqS0U/s72-c/gradation_angle.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-2200394415001862074</id><published>2008-12-11T15:34:00.007+09:00</published><updated>2009-02-03T15:41:52.758+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='InDesign'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>Every Text Frame Including Table Objects</title><content type='html'>&lt;p&gt;How do you get some references of text frames that include teble objects? The following code seems to do well at first glance. But even if certainly table objects exists, the thing you want to do will be fail.&lt;/p&gt;

&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;script=set%20textFrames%20to%20%7b%7d%0atell%20application%20%22Adobe%20InDesign%20CS2%22%0a%20%20tell%20active%20document%0a%20%20%20%20try%0a%20%20%20%20%20%20set%20textFrames%20to%20%c2%ac%0a%20%20%20%20%20%20%20%20every%20text%20frame%20whose%20%28count%20of%20every%20table%20of%20it%29%20%3e%200%0a%20%20%20%20end%20try%0a%20%20end%20tell%0aend%20tell%0a%0a%7bcount%20of%20textFrames%2c%20textFrames%7d"&gt;ScriptEditor opens a new window with following the script.&lt;/a&gt;&lt;/div&gt;
&lt;pre class="code"&gt;
set textFrames to {}
tell application "Adobe InDesign CS2"
  tell active document
    try
      set textFrames to ¬
        every text frame whose (count of every table of it) &gt; 0
    end try
  end tell
end tell

{count of textFrames, textFrames}
&lt;/pre&gt;

&lt;p&gt;The “count” of “(count of every table of it)” isn’t a property of the object. I guess, in my understanding, the filter reference form has to evaluate some values of properties and asks for the truth-value. Then, does a text frame have any property that indicates including some table objects else? I wondered what was that? For example, it is like &lt;i&gt;isIncludingTable:true&lt;/i&gt;. However it seemed there wasn’t such a property in the application’s dictionary of InDesign.&lt;/p&gt;

&lt;p&gt;After a while, I came up with an idea. If a text frame had a table object, was there a control character in contents of a text frame? Just as I expected, there was ascii code 22 there. Then we can use “is in.”&lt;/p&gt;

&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;script=tell%20application%20%22Adobe%20InDesign%20CS2%22%0d%20%20tell%20active%20document%0d%20%20%20%20try%0d%20%20%20%20%20%20set%20textFrames%20to%20%20%c2%ac%0d%20%20%20%20%20%20%20%20every%20text%20frame%20whose%20%28ASCII%20character%2022%29%20is%20in%20contents%20of%20it%0d%20%20%20%20end%20try%0d%20%20end%20tell%0dend%20tell"&gt;ScriptEditor opens a new window with following the script.&lt;/a&gt;&lt;/div&gt;
&lt;pre class="code"&gt;
tell application "Adobe InDesign CS2"
  tell active document
    try
      set textFrames to  ¬
        every text frame whose (ASCII character 22) is in contents of it
    end try
  end tell
end tell
&lt;/pre&gt;

&lt;p&gt;But this isn't enough to get every objects have table objects. It’s impossible to get ones in group objects. In this case, let’s use “all page items”, and fill background with swatch color “Black” instead of getting references for obviously checking result.&lt;/p&gt;

&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;script=tell%20application%20%22Adobe%20InDesign%20CS2%22%0d%09tell%20active%20document%0d%09%09try%0d%09%09%09set%20fill%20color%20of%20%28every%20text%20frame%20whose%20%28ASCII%20character%2022%29%20is%20in%20contents%20of%20it%29%20%c2%ac%0d%09%09%09%09to%20swatch%20%22Black%22%0d%09%09end%20try%0d%09%09try%0d%09%09%09set%20fill%20color%20of%20%28every%20text%20frame%20of%20all%20page%20items%20whose%20%28ASCII%20character%2022%29%20is%20in%20contents%20of%20it%29%20%c2%ac%0d%09%09%09%09to%20swatch%20%22Black%22%0d%09%09end%20try%0d%09end%20tell%0dend%20tell" title="This script fills every text frame including table objects with swatch color “Black.”"&gt;ScriptEditor opens a new window with following the script.&lt;/a&gt;&lt;/div&gt;
&lt;pre class="code"&gt;tell application "Adobe InDesign CS2"
  tell active document
    try
      set fill color of (every text frame whose (ASCII character 22) is in contents of it) ¬
        to swatch "Black"
    end try
    try
      set fill color of (every text frame of all page items whose (ASCII character 22) is in contents of it) ¬
        to swatch "Black"
    end try
  end tell
end tell
&lt;/pre&gt;

&lt;p&gt;Is there anyway else?&lt;/P&gt;

&lt;p&gt;Postscript:&lt;br /&gt;&lt;a href="http://cross-the-sea.blogspot.com/2009/02/best-way-when-using-filter-reference.html"&gt;The Best Way When Using the Filter Reference Form&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-2200394415001862074?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/2200394415001862074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=2200394415001862074&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/2200394415001862074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/2200394415001862074'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2008/12/every-text-frame-including-table.html' title='Every Text Frame Including Table Objects'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-2423104536926971725</id><published>2008-12-09T12:20:00.007+09:00</published><updated>2009-01-30T12:59:27.363+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>How to Access to MySQL with AppleScript</title><content type='html'>&lt;p&gt;There is &lt;a href="http://oddeye.blogspot.com/2008/01/applescript-and-mysql.html"&gt;a past page&lt;/a&gt; that is accessed every day every day in my diary blog. The title is “AppleScript and MySQL.” Its body has about only 70 words. There are almost never beneficial tips. So I have been sorry some people visited my blog. I think, at the very least, I should have shown a sample script. But it isn’t the code I wrote. I got the tips from &lt;a href="http://macscripter.net/"&gt;http://macscripter.net/&lt;/a&gt; and don’t know the permanent link. But let’s share that code.&lt;/p&gt;

&lt;p&gt;As additional if your MySQL was made with a option “--with-charset=utf8” by yourself, “&lt;span style="font-weight:bold;"&gt;--default-character-set=utf8&lt;/span&gt;” is the unnecessary option. But If it was downloaded MySQL as a compiled package, the option is perhaps necessary. And following the code was modified from original by me.&lt;/p&gt;

&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;script=global%20mysql%0d%2d%2d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%0dset%20mysql%20to%20%22%2fusr%2flocal%2fmysql%2fbin%2fmysql%22%0dset%20user_name%20to%20%22mysql%e2%80%99s%20account%22%0dset%20pass_word%20to%20%22mysql%e2%80%99s%20pass%20word%22%0dset%20host_name%20to%20%22hoge%2elocal%22%0dset%20DB_name%20to%20%22foo%22%0dset%20table_name%20to%20%22any%20table%20name%22%0dset%20field_name%20to%20%22any%20filed%20name1%2cany%20filed%20name2%22%20%2d%2d%20Of%20course%2c%20a%20delimiter%20character%20is%20%e2%80%9c%2c%e2%80%9d%0dset%20limit%20to%20100%0d%2d%2d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%0d%0dset%20mysql%20to%20mysql%20%26%20%22%20%2du%22%20%26%20user_name%20%26%20%22%20%2dp%22%20%26%20pass_word%20%26%20%22%20%2dD%22%20%26%20DB_name%20%26%20%22%20%2dh%22%20%26%20host_name%20%c2%ac%0d%09%26%20%22%20%2d%2ddefault%2dcharacter%2dset%3dutf8%22%20%26%20%22%20%2de%20%22%20as%20Unicode%20text%0dset%20query%20to%20%22SELECT%20%22%20%26%20field_name%20%26%20%22%20FROM%20%22%20%26%20table_name%20%26%20%22%20LIMIT%20%22%20%26%20limit%0dset%20DB_DATA%20to%20%7b%7d%0dsend_query%20of%20me%20given%20string%3aquery%2c%20reference%3aa%20reference%20to%20DB_DATA%0dDB_DATA%0d%0don%20send_query%20given%20string%3aquery%2c%20reference%3adata_ref%0d%09set%20query%20to%20%22%5c%22%22%20%26%20query%20%26%20%22%5c%22%22%0d%09set%20db_records%20to%20paragraphs%20of%20%28do%20shell%20script%20mysql%20%26%20query%29%0d%09set%20%7bdefault_delimita%2c%20AppleScript%27s%20text%20item%20delimiters%7d%20to%20%7bAppleScript%27s%20text%20item%20delimiters%2c%20tab%7d%0d%09repeat%20with%20i%20from%201%20to%20%28count%20db_records%29%0d%09%09set%20the%20end%20of%20data_ref%20to%20every%20text%20item%20of%20item%20i%20of%20db_records%0d%09end%20repeat%0d%09set%20AppleScript%27s%20text%20item%20delimiters%20to%20default_delimita%0dend%20send_query" title="This script gets data of MySQL."&gt;ScriptEditor opens a new window with following the script.&lt;/a&gt;&lt;/div&gt;
&lt;pre class="code"&gt;global mysql
--==========
set mysql to "/usr/local/mysql/bin/mysql"
set user_name to "mysql’s account"
set pass_word to "mysql’s pass word"
set host_name to "hoge.local"
set DB_name to "foo"
set table_name to "any table name"
set field_name to "any filed name1,any filed name2" -- Of course, a delimiter character is “,”
set limit to 100
--==========

set mysql to mysql &amp; " -u" &amp; user_name &amp; " -p" &amp; pass_word &amp; " -D" &amp; DB_name &amp; " -h" &amp; host_name ¬
  &amp; " --default-character-set=utf8" &amp; " -e " as Unicode text
set query to "SELECT " &amp; field_name &amp; " FROM " &amp; table_name &amp; " LIMIT " &amp; limit
set DB_DATA to {}
send_query of me given string:query, reference:a reference to DB_DATA
DB_DATA

on send_query given string:query, reference:data_ref
  set query to "\"" &amp; query &amp; "\""
  set db_records to paragraphs of (do shell script mysql &amp; query)
  set {default_delimita, AppleScript's text item delimiters} to {AppleScript's text item delimiters, tab}
  repeat with i from 1 to (count db_records)
    set the end of data_ref to every text item of item i of db_records
  end repeat
  set AppleScript's text item delimiters to default_delimita
end send_query
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-2423104536926971725?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/2423104536926971725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=2423104536926971725&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/2423104536926971725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/2423104536926971725'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2008/12/how-to-access-to-mysql-with-applescript.html' title='How to Access to MySQL with AppleScript'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-2429665678750349841</id><published>2008-12-06T09:59:00.009+09:00</published><updated>2008-12-09T13:24:10.173+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cappuccino'/><title type='text'>Learning of Cappuccino Is Quite Primitive</title><content type='html'>&lt;p&gt;My work during this year were almost finished. At last I have been starting Cappuccino. This week I checked Build Tools of Cappuccino I haven’t understood. There are several commands in the Build Tools; objjc, steam, press and bake. And ant command that is written in a page of the blog, &lt;a href="http://cappuccino.org/discuss/2008/10/14/objjc-and-steam/"&gt;Cappuccino Tools: “objjc” and “steam”&lt;/a&gt; is enigma, too.&lt;/p&gt;

&lt;p&gt;This was the first question. Do I need to compile my Cappuccino appliction to run it? Why I had such a question. Because a application in the Starter Package can run without compiling, even after editing the source files. But There are some things called “Build Tools.” On SproutCore, I’m not sure the compiler seemed to delete comment lines and some spaces for reducing the amount of code. Is it a similar thing that the build tool of Cappuccino does? But It's impossible. SproutCore is JavaScript in first place. Objective-J needs to be transformed to JavaScript code certainly.&lt;/p&gt;

&lt;p&gt;I read a page of cappuccino.org’s blog that is &lt;a href="http://cappuccino.org/discuss/2008/10/06/the-cappuccino-build-tools/"&gt;The Cappuccino and Objective-J Build Tools&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;If you’re just getting started with Objective-J and Cappuccino you don’t even need to worry about the build tools, they’re entirely optional.&lt;/blockquote&gt;

&lt;p&gt;A staff of cappuccino.org said that you don’t even need to worry. All right, I’ll get it out of my mind for a while. I think it's enough that even I know how to create a new form of cappuccino application using steam command.&lt;/p&gt;

&lt;p&gt;Learning of Cappuccino is quite primitive.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-2429665678750349841?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/2429665678750349841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=2429665678750349841&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/2429665678750349841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/2429665678750349841'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2008/12/learning-of-cappuccino-is-quite.html' title='Learning of Cappuccino Is Quite Primitive'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-408194117796307941</id><published>2008-12-04T16:50:00.012+09:00</published><updated>2009-02-11T23:28:18.474+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><category scheme='http://www.blogger.com/atom/ns#' term='Finder'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>Mount Volume using Script</title><content type='html'>&lt;p&gt;Since I shifted my development environmen from Tiger to Leopard, there were a few scripts didn’t work. So I fixed them. This is one of them. This script mounts server and opens the folder specified as a command of menu bar; “Connect to Server.” This script works well on Leopard.&lt;/p&gt;

&lt;pre class="code"&gt;#!/usr/bin/perl
use strict;
use utf8;
use open ":utf8";
use open ":std";

my $protocol    = 'afp';           # choose afp or smb.
my $account     = 'foo';
my $pass_word   = 'bar';
my $server_name = 'foobar.local';  # If a server name is not available, use an IP address.
my $volume_name = 'hoge';          # Don’t add slash characters to front of the name and end.
my $directory   = '/common/DTP';   # Don’t forget to add a slash character to front of them.

$volume_name =~ s/\/$//;
$directory   =~ s/\/$//;
if ( $directory !~ /^\// ){ $directory = "/$directory" }

if ( mount_server( $protocol, $account, $pass_word, $server_name, $volume_name, $directory ) != 1 ){
  print "Mounting failed.\n";
}

# ----------------------------------------------------------------------------
sub mount_server{
  my @ARGV = @_;
  my $AppleScript = 'osascript ';

  map { $_ = "'$_'" } @ARGV;

  while (&amp;#60;data&amp;#62;){
    chomp;
    s/"/\\"/g;
    $AppleScript .= " -e \"$_\"";
  }
  $AppleScript .= " @ARGV";

  my $result = readpipe $AppleScript;
  utf8::decode($result);
  chop $result;

  return $result;
}

__DATA__
on run argv
  set {protocol, user_name, pass_word, server_name, volume_name, directory} to argv
  set connection to protocol &amp;amp; "://" &amp;amp; user_name &amp;amp; ":" &amp;amp; pass_word &amp;amp; "@" &amp;amp; server_name &amp;amp; "/" &amp;amp; volume_name as Unicode text
  set tried_count to 1
  set try_limit to 3

  tell application "Finder"
    repeat until exists disk volume_name
      try
        mount volume connection
      on error
        if tried_count ≥ try_limit then return 0
        set tried_count to tried_count + 1
        delay 1
      end try
    end repeat
    --(* If you don’t want to open a window of Finder, comment out following three lines code.
    activate
    tell me to set target_folder to POSIX file ("/Volumes/" &amp;amp; volume_name &amp;amp; directory)
    if exists target_folder then open target_folder
    --*)
  end tell

  return 1
end run
&lt;/pre&gt;

&lt;p&gt;On the Leopard, almost trouble with osascript are about POSIX file or POSIX path as for me. POSIX file and POSIX path mainly are tied to Finder. But They are’t available command in a block; tell application "Finder." So I have placed them outside the block. It means POSIX file and POSIX path aren’t bound up by a tell block. They are naked. I should have fixed only that point, nevertheless remade all lines. Then I had  another trouble.&lt;/p&gt;

&lt;p&gt;The osascript is able to handle texts encoded as utf-8 from the Leopard. So I cut out encoding to Shift-JIS and instead made another script else for the Tiger.&lt;/p&gt;

&lt;p&gt;I didn't recognize a character “&lt;span style="color:#C13057;"&gt;≥&lt;/span&gt;”. This character is not available on Shift-JIS. I had typed “&lt;span style="color:#C13057;"&gt;&amp;gt;=&lt;/span&gt;” on AppleScript but the character changed “&lt;span style="color:#C13057;"&gt;≥&lt;/span&gt;” by itself after compiling the script. In consequence, I have to retype “&lt;span style="color:#C13057;"&gt;&amp;gt;=&lt;/span&gt;” on Perl script.&lt;/p&gt;

&lt;p&gt;Now, I desire to sort out the same volume names that are already mounting to eject the selected volume. But it seems difficult.&lt;/p&gt;

&lt;br /&gt;
&lt;h3&gt;
AppleScript&lt;/h3&gt;
&lt;div class="aups"&gt;
&lt;a href="applescript://com.apple.scripteditor?action=new&amp;amp;script=global%20try_limit%0d%0dset%20protocol%20to%20%22afp%22%20%2d%2d%20%20choose%20afp%20or%20smb%2e%0dset%20user_name%20to%20%22foo%22%0dset%20pass_word%20to%20%22bar%22%0dset%20server_name%20to%20%22foobar%2elocal%22%20%2d%2d%20If%20a%20server%20name%20is%20not%20available%2c%20use%20an%20IP%20address%2e%0dset%20volume_name%20to%20%22hoge%22%20%2d%2d%20Don%e2%80%99t%20add%20slash%20characters%20to%20front%20of%20the%20name%20and%20end%2e%0dset%20directory%20to%20%22%2fcommon%2fDTP%22%20%2d%2d%20Don%e2%80%99t%20forget%20to%20add%20a%20slash%20character%20to%20front%20of%20them%2e%0dset%20try_limit%20to%203%0d%0dset%20account_info%20to%20%7bprotocol%2c%20user_name%2c%20pass_word%2c%20server_name%2c%20volume_name%2c%20directory%7d%0dmount_volume%28account_info%29%20of%20me%0d%0d%2d%2d%20%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%2d%0don%20mount_volume%28argv%29%0d%09set%20%7bprotocol%2c%20user_name%2c%20pass_word%2c%20server_name%2c%20volume_name%2c%20directory%7d%20to%20argv%0d%09set%20connection%20to%20protocol%20%26%20%22%3a%2f%2f%22%20%26%20user_name%20%26%20%22%3a%22%20%26%20pass_word%20%26%20%22%40%22%20%26%20server_name%20%26%20%22%2f%22%20%26%20volume_name%20as%20Unicode%20text%0d%09set%20tried_count%20to%201%0d%09%0d%09tell%20application%20%22Finder%22%0d%09%09repeat%20until%20exists%20disk%20volume_name%0d%09%09%09try%0d%09%09%09%09mount%20volume%20connection%0d%09%09%09on%20error%0d%09%09%09%09if%20tried_count%20%e2%89%a5%20try_limit%20then%20return%20false%0d%09%09%09%09set%20tried_count%20to%20tried_count%20%2b%201%0d%09%09%09%09delay%201%0d%09%09%09end%20try%0d%09%09end%20repeat%0d%09%09%2d%2d%28%2a%20If%20you%20don%e2%80%99t%20want%20to%20open%20a%20window%20of%20Finder%2c%20comment%20out%20following%20three%20lines%20code%2e%0d%09%09activate%0d%09%09tell%20me%20to%20set%20target_folder%20to%20POSIX%20file%20%28%22%2fVolumes%2f%22%20%26%20volume_name%20%26%20directory%29%0d%09%09if%20exists%20target_folder%20then%20open%20target_folder%0d%09%09%2d%2d%2a%29%0d%09end%20tell%0d%09%0d%09return%20true%0dend%20mount_volume" title="This script mounts a server volume on your Mac."&gt;ScriptEditor opens a new window with following the script.&lt;/a&gt;&lt;/div&gt;
&lt;pre class="code"&gt;
global try_limit

set protocol to "afp" --  choose afp or smb.
set user_name to "foo"
set pass_word to "bar"
set server_name to "foobar.local" -- If a server name is not available, use an IP address.
set volume_name to "hoge" -- Don’t add slash characters to front of the name and end.
set directory to "/common/DTP" -- Don’t forget to add a slash character to front of them.
set try_limit to 3

set account_info to {protocol, user_name, pass_word, server_name, volume_name, directory}
mount_volume(account_info) of me

-- ----------------------------------------------------------------------------
on mount_volume(argv)
  set {protocol, user_name, pass_word, server_name, volume_name, directory} to argv
  set connection to protocol &amp;amp; "://" &amp;amp; user_name &amp;amp; ":" &amp;amp; pass_word &amp;amp; "@" &amp;amp; server_name &amp;amp; "/" &amp;amp; volume_name as Unicode text
  set tried_count to 1

  tell application "Finder"
    repeat until exists disk volume_name
      try
        mount volume connection
      on error
        if tried_count ≥ try_limit then return false
        set tried_count to tried_count + 1
        delay 1
      end try
    end repeat
    --(* If you don’t want to open a window of Finder, comment out following three lines code.
    activate
    tell me to set target_folder to POSIX file ("/Volumes/" &amp;amp; volume_name &amp;amp; directory)
    if exists target_folder then open target_folder
    --*)
  end tell

  return true
end mount_volume
&lt;/pre&gt;

&lt;p&gt;postscript:&lt;br /&gt;&lt;a href="http://cross-the-sea.blogspot.com/2009/02/mountafp-and-mountsmbfs.html"&gt;Mount_afp And Mount_smbfs&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-408194117796307941?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/408194117796307941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=408194117796307941&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/408194117796307941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/408194117796307941'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2008/12/mount-volume-using-script.html' title='Mount Volume using Script'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-8026253896830759098</id><published>2008-11-28T19:10:00.006+09:00</published><updated>2009-03-24T23:42:07.261+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='about this blog'/><title type='text'>About This Blog - Japanese</title><content type='html'>&lt;p&gt;　私のニックネームは PsychoCat だ。「さいちょきゃっと」と読んではいけない。「さいこきゃっと」だ。&lt;/p&gt;

&lt;p&gt;　以前、four というハンドルで別のブログを書いていた。名古屋で同じような仕事に従事している “DTP出身者のMac環境でのプログラマー” を見つけるのが目的だった。１年半ほど、かなりの時間をさいて更新を続けたが、ただのひとりも見つけられなかった。名古屋の人からはメールのひとつも、コメントすらもらえなかった。それでもネット上では数人の知り合いができた。この業界でとても有名な方とも知り合いになれたし、Objective-Cの開発者なら必ず一度は訪れているだろうサイトの運営者とも知りあいになれた。ただ、すべてが関東、関西だ。名古屋からのコンタクトは一人もいなかった。意気消沈した上、さらにDTPの自動組版環境も Windows が大半を占めるようになってきた。プロのプログラマーが自動組版を手がけ始めたためだ。さらにスクリプト自体も JavaScript に 勢いを感じ「もう、潮時か...」とブログの更新を止めてしまった。そしてブログやSNSへの書き込みもろくにしなくなった。&lt;/p&gt;

&lt;p&gt;　ネット引きこもりが１年ほど続いた。最近、寂しさ感じ始め「ブログを再開しよかな？」と思い始めた。その意思をポロッとあるブログに書き込んだら、快く向かい入れていただけるレスを頂いたので再開を決心した。&lt;/p&gt;

&lt;p&gt;　以前のブログでは、“地元でリアルな同業者を探すこと” に意識し過ぎたあまり、とても狭い視野になってしまった。その反動というわけでもないが、このブログでは海外に目を向けてみようと考えている。せっかく世界につながっているインターネットを利用しているのだから、海外の情報に接しない手はない。それに開発者である以上、日々眺めているのが日本語のサイトばかりでは情けない。&lt;/p&gt;

&lt;p&gt;　再開を決心したときは、海外のDTP情報などを読んで回り、それをネタにしようと考えた。背伸びをして目標を立てるとしたら、Mac DTP Developer版 “&lt;a href="http://maclalala2.wordpress.com/"&gt;maclalala2&lt;/a&gt;” だ。無理だけど... 。私の遠〜い最終目標なんだから構わないだろう？ ^.^&lt;/p&gt;

&lt;p&gt;　… と目ろんでいたら、どうも雲行きが怪しい。私のブログ再開を「待っているよ」と応援していただいた方のブログが、海外サイトの紹介ブログになりつつあるではないか。これはまずい。私は競争には弱いのだ。しかも内容がダブりまくるのは目に見えている。内容を変更しなくてはいけなくなった。しかし日本語でブログを書くことに多くの時間を取られたくない。英語学習は話すにしても書くにしてもアウトプットする習慣を保つことが大切だと実感しているので、英語学習を絡めてブログを続けたい。それなら、いっそのことすべて英語で書くか？ そんなことできるのか？&lt;/p&gt;

&lt;p&gt;　悩んだ末、私は腹を括った。新しく始める技術系ブログも英語で書くことにした。みんなは「気負い過ぎだ」と感じるかもしれないが、本人は気楽な気持ちでいる。英語日記の&lt;a href="http://oddeye.blogspot.com/search/label/Programming"&gt;Programmingカテゴリー&lt;/a&gt;をこちらに書き込むと思えば気も楽だ。私の英語日記は未熟な英文だし、テキスト量も少ないからネイティヴからコメントをもらうこともないだろう。だから、それを期待した文章を書かない。しかしせめて英語日記よりはもう少し情報量を多く書くことを目標にしたい。&lt;/p&gt;

&lt;p&gt;　英語日記は恥ずかしいが意外と続いている。それは気負いがないからだと思っている。２週間３週間程度だったら更新できなくてもかまわないつもりでいる。なんだか消極的な話だが “志” だけは立派なんだよ（笑）&lt;/p&gt;

&lt;p&gt;　あ、そうだ。願い事が一つある。&lt;br /&gt;「&lt;span style="font-weight:bold;"&gt;どうか私に、海外サイトに書き込みをする勇気をお与えください&lt;/span&gt;」&lt;br /&gt;　いつになったら英語でコメントできるんだろう？&lt;/p&gt;

&lt;p&gt;　そんなわけで、たぶん少なくなりつつある DTP出身の Macプログラマー（スクリプター）の生き残りとして恥を晒していくので応援して欲しい。&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-8026253896830759098?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/8026253896830759098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=8026253896830759098&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/8026253896830759098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/8026253896830759098'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2008/11/about-this-blog-japanese.html' title='About This Blog - Japanese'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7200358175562922597.post-4090318478417740304</id><published>2008-11-28T18:45:00.006+09:00</published><updated>2010-01-08T17:33:56.315+09:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Perl'/><category scheme='http://www.blogger.com/atom/ns#' term='about this blog'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>About This Blog - English</title><content type='html'>&lt;p&gt;This blog is mentioning of developments for auto publishing system. Mainly AppleScript, Perl, Objective-C and JavaScript are leveraged as programming languages. And the platform they move on is OS X.&lt;/p&gt;

&lt;p&gt;And I recently got an interest in Cappuccino that is a framework like Objective-C to make web applications, and MediaWiki of Wikipedia’s engine. One more thing I have an interest in is IDML of InDesgin CS4. I’ll also writing them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A list of languages covered in this blog
&lt;ul&gt;
  &lt;li&gt;AppleScript&lt;/li&gt;
  &lt;li&gt;Perl&lt;/li&gt;
  &lt;li&gt;Objective-C (Cocoa)&lt;/li&gt;
  &lt;li&gt;Objective-J (Cappuccino)&lt;/li&gt;
  &lt;li&gt;JavaScript&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
  &lt;li&gt;A list of what I’m interested in right now
&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://cappuccino.org/"&gt;Cappuccino&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="http://www.mediawiki.org/"&gt;MediaWiki&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="http://www.adobe.com/products/indesign/scripting/"&gt;IDML&lt;/a&gt; (But I haven’t had the CS4 yet.)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;span style="font-weight:bold;"&gt;And&lt;/span&gt;, I’m Japanese who uses English as second language. So I’m afraid I can’t describe those topics. There may be wrong contents and expression. If you can't bear to see my poor English, I may want you to tell me one of the better qualities.&lt;/p&gt;

&lt;br /&gt;
&lt;h3&gt;About the URL Encode of AppleScript&lt;/h3&gt;

&lt;p&gt;On this blog, I’m using URL Encode of AppleScript with a herf link. If you click a link text above a sample script, immediately you can try to run the sample script.&lt;/p&gt;

&lt;div class="aups"&gt;&lt;a title="This script makes some folders." href="applescript://com.apple.scripteditor?action=new&amp;script=set%20dir_completed_path%20to%20%22%2fUsers%2f%28your%20account%29%2fDocuments%2fApple%2fOrange_Peach%22%20as%20Unicode%20text%0aset%20perlScript%20to%20%22utf8%3a%3adecode%28%24ARGV%5b0%5d%29%3b%20if%28%20%21%20%2de%20%24ARGV%5b0%5d%20%29%7b%20mkpath%20%5b%24ARGV%5b0%5d%5d%20or%20die%20%24%21%20%7d%22%20%26%20%22%20print%201%3b%22%20as%20Unicode%20text%0aset%20perlScript%20to%20quoted%20form%20of%20perlScript%0aset%20shellCommand%20to%20%22perl%20%2dMutf8%20%2dMFile%3a%3aPath%20%2de%20%22%20%26%20perlScript%20%26%20%22%20%22%20%26%20quoted%20form%20of%20dir_completed_path%0ado%20shell%20script%20shellCommand"&gt;ScriptEditor opens a new window with following the script.&lt;/a&gt;&lt;/div&gt;
&lt;pre class="code"&gt;
set dir_completed_path to "/Users/(your account)/Documents/Apple/Orange_Peach" as Unicode text
set perlScript to "utf8::decode($ARGV[0]); if( ! -e $ARGV[0] ){ mkpath [$ARGV[0]] or die $! }" &amp; " print 1;" as Unicode text
set perlScript to quoted form of perlScript
set shellCommand to "perl -Mutf8 -MFile::Path -e " &amp; perlScript &amp; " " &amp; quoted form of dir_completed_path
do shell script shellCommand
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7200358175562922597-4090318478417740304?l=cross-the-sea.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cross-the-sea.blogspot.com/feeds/4090318478417740304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7200358175562922597&amp;postID=4090318478417740304&amp;isPopup=true' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/4090318478417740304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7200358175562922597/posts/default/4090318478417740304'/><link rel='alternate' type='text/html' href='http://cross-the-sea.blogspot.com/2008/11/about-this-blog-english.html' title='About This Blog - English'/><author><name>PsychoCat</name><uri>http://www.blogger.com/profile/16856909601285947594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/_vCoDJp475R0/SvkLDjAPhEI/AAAAAAAABOo/SglUjGYwK0A/S220/meetboul.jpg'/></author><thr:total>4</thr:total></entry></feed>
