Kết quả 1 đến 9 của 9
  1. #1
    Ngày tham gia
    Dec 2014
    Bài viết
    0

    [PopClip Extensions] Vietnam Dictionaries

    #PopClip là một ứng dụng rất tiện dụng. Một trong những điểm tiện dụng của nó là cho phép người dùng có thể tự tạo thêm các extension.



    >>> Create Your Own Custom Extension for PopClip

    >>> PopClip: Scripting Extensions



    Sau khi tham khảo hai bài viết ở trang tutsplus, mình tạo thử extension tự động tra từ trên ứng dụng Vietnam Dictionaries của Vũ Tiến Thịnh bằng một applescript đơn giản. Thấy cũng vui vui nên mạo muội share với mọi người. Ai dùng ủng hộ mình thì có thể download theo link ở bên dưới [IMG]styles/default/xenforo/clear.png[/IMG]



    Link Download: http://bit.ly/1cVOP5O

  2. #2
    Ngày tham gia
    Dec 2014
    Bài viết
    0
    Trích dẫn Gửi bởi kamikaze129
    #PopClip là một ứng dụng rất tiện dụng. Một trong những điểm tiện dụng của nó là cho phép người dùng có thể tự tạo thêm các extension.



    >>> Create Your Own Custom Extension for PopClip

    >>> PopClip: Scripting Extensions



    Sau khi tham khảo hai bài viết ở trang tutsplus, mình tạo thử extension tự động tra từ trên ứng dụng Vietnam Dictionaries của Vũ Tiến Thịnh bằng một applescript đơn giản. Thấy cũng vui vui nên mạo muội share với mọi người. Ai dùng ủng hộ mình thì có thể download theo link ở bên dưới [IMG]styles/default/xenforo/clear.png[/IMG]



    Link Download: http://bit.ly/1cVOP5O
    nhưng cái từ điển đó mất tiền mua mà bác [IMG]styles/default/xenforo/clear.png[/IMG] https://itunes.apple.com/jp/app/viet...816?l=en&mt=12 bác nào có share e xin với [IMG]styles/default/xenforo/clear.png[/IMG]

  3. #3
    Ngày tham gia
    Dec 2014
    Bài viết
    0
    Trích dẫn Gửi bởi heo_rung86
    nhưng cái từ điển đó mất tiền mua mà bác [IMG]styles/default/xenforo/clear.png[/IMG] https://itunes.apple.com/jp/app/viet...816?l=en&mt=12 bác nào có share e xin với [IMG]styles/default/xenforo/clear.png[/IMG]
    Thì mình chỉ chia sẻ plugin của PopClip và cách tự tạo thôi mà. Nó làm hộ người dùng thao tác



    Command+C -> mở từ điển -> Command+V -> Bấm Enter



    Điều kiện cần là đang dùng PopClip và phần mềm từ điển kia [IMG]styles/default/xenforo/clear.png[/IMG]



    Còn nói về từ điển kia mất tiền nhưng mà cũng chỉ có 240¥ tương đương khoảng 40.000 vnd, bằng một bát phở nóng [IMG]styles/default/xenforo/clear.png[/IMG] Về chất lượng cũng khá ổn, tra được nhiều ngôn ngữ (mình dùng tiếng Anh và tiếng Nhật).



    Nếu chỉ dùng Anh-Việt thì bạn có thể dùng từ điển mà Tinh Tế đã share (Link bài viết). Từ điển của Tinh Tế tích hợp luôn vào hệ thống nên khi tra rất tiện (đưa con trỏ đến từ cần tra rồi bấm 3 ngón tay cùng lúc lên trackpad sẽ hiện ra popup định nghĩa bên dưới từ)

  4. #4
    Trích dẫn Gửi bởi kamikaze129
    #PopClip là một ứng dụng rất tiện dụng. Một trong những điểm tiện dụng của nó là cho phép người dùng có thể tự tạo thêm các extension.



    >>> Create Your Own Custom Extension for PopClip

    >>> PopClip: Scripting Extensions



    Sau khi tham khảo hai bài viết ở trang tutsplus, mình tạo thử extension tự động tra từ trên ứng dụng Vietnam Dictionaries của Vũ Tiến Thịnh bằng một applescript đơn giản. Thấy cũng vui vui nên mạo muội share với mọi người. Ai dùng ủng hộ mình thì có thể download theo link ở bên dưới [IMG]styles/default/xenforo/clear.png[/IMG]



    Link Download: http://bit.ly/1cVOP5O
    Bác có thể chia sẻ cho anh em biết cách code extension để popclip tra được từ từ 1 ứng dụng từ điển khác ko ạ. Em dùng nhiều tiếng trung mà cá từ điển khác tra chán quá có 1 bộ em thích và rất muốn dyfng popclip tra cho tiẹn ạ

  5. #5
    Ngày tham gia
    Dec 2014
    Bài viết
    0
    Trích dẫn Gửi bởi huycuong7290
    Bác có thể chia sẻ cho anh em biết cách code extension để popclip tra được từ từ 1 ứng dụng từ điển khác ko ạ. Em dùng nhiều tiếng trung mà cá từ điển khác tra chán quá có 1 bộ em thích và rất muốn dyfng popclip tra cho tiẹn ạ
    Cách tạo extension cho PopClip thì rất linh hoạt. Hướng dẫn có trong 2 bài viết bằng tiếng Anh mình dẫn trên kia. Mình chỉ xin tóm tắt lại cách làm cái extension đơn giản của mình.



    Bước 1: Tạo một thư mục có tên là tên của extension (VietnamDict)



    Bước 2: Chuẩn bị 3 file cho thư mục



    (1) Config.plist : file lưu thông tin config của extention. Có 3 trường quan trọng là

    + AppleScript File: Tên file script chính của extension

    + Image File: Tên file ảnh dùng làm icon của extension trong PopClip

    + Extension Name: Tên của extension cũng chính là tên thư mục





    Mã nguồn HTML:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Actions</key>
        <array>
            <dict>
                <key>AppleScript File</key>
                <string>tudien.applescript</string>
                <key>Image File</key>
                <string>tudien.png</string>
                <key>Title</key>
                <string>Vietnam Dictionaries</string>
            </dict>
        </array>
        <key>Extension Description</key>
        <string>Search the selected word in Vietnam Dictionaries application</string>
        <key>Extension Identifier</key>
        <string>popclip.extension.vietnamdict</string>
        <key>Extension Name</key>
        <string>VietnamDict</string>
        <key>Required Software Version</key>
        <integer>701</integer>
    </dict>
    </plist>
    (2) tudien.applescript: mình dùng applescript để tạo extension (có thể tạo bằng ngôn ngữ khác)



    <div class="bbCodeBlock bbCodePHP">
    <div class="type">PHP:</div>
    <div class="code"><code>
    --&nbsp;Process&nbsp;seletected&nbsp;string
    set&nbsp;oldWord&nbsp;to&nbsp;
    "{popclip&nbsp;text}"&nbsp;--&nbsp;từ&nbsp;đã&nbsp;chọn
    set&nbsp;theCmd&nbsp;to&nbsp;
    ("echo&nbsp;"&nbsp;&&nbsp;quoted&nbsp;form&nbsp;of&nbsp;oldWord&nbsp;&&nbsp;"&nbsp;|&nbsp;perl&nbsp;-pe&nbsp;"&nbsp;&&nbsp;quoted&nbsp;form&nbsp;of&nbsp;"s/[-&nbsp;]//g"&nbsp;as&nbsp;string)&nbsp;--&nbsp;dùng&nbsp;perl&nbsp;(hoặc&nbsp;sed,&nbsp;awk,&nbsp;...)&nbsp;để&nbsp;chỉnh&nbsp;lại&nbsp;từ&nbsp;đã& nbsp;chọn&nbsp;theo&nbsp;nhu&nbsp;cầu&nbsp;(ví&nbsp;dụ&nbsp;như&nbsp;mình&nbsp;muốn&nbs p;bỏ&nbsp;dấu&nbsp;cách&nbsp;trắng&nbsp;và &nbsp;dấu&nbsp;gạch&nbsp;ngang)
    set&nbsp;newWord&nbsp;to&nbsp;do&nbsp;shell&nbsp;script&nbsp;theCmd
    set&nbsp;the&nbsp;clipboard&nbsp;to&nbsp;newWord&n bsp;
    --&nbsp;copy&nbsp;từ&nbsp;đã&nbsp;chọn&nbsp;vào&nbs p;clipboard
    tell&nbsp;application&nbsp;
    "Vietnam&nbsp;Dictionaries"&nbsp;to&nbsp;activate&nbsp;--&nbsp;gọi&nbsp;đến&nbsp;ứng&nbsp;dụng&nbsp;từ &nbsp;điển
    repeat
    &nbsp;&nbsp;&nbsp;&nbsp;
    if&nbsp;application&nbsp;"Vietnam&nbsp;Dictionaries"&nbsp;is&nbsp;running&nbsp;then&nbsp;exit&nbsp;repeat&nbsp;--&nbsp;chờ&nbsp;đến&nbsp;khi&nbsp;ứng&nbsp;dụng& nbsp;khởi&nbsp;động&nbsp;xong
    &nbsp;&nbsp;&nbsp;&nbsp;delay&nbsp;0.5
    end&nbsp;repeat
    delay&nbsp;0.5
    tell&nbsp;application&nbsp;
    "System&nbsp;Events"
    &nbsp;&nbsp;&nbsp;&nbsp;
    tell&nbsp;process&nbsp;"Vietnam&nbsp;Dictionaries"&nbsp;--&nbsp;focus&nbsp;vào&nbsp;ô&nbsp;để&nbsp;nhập&nbs p;từ&nbsp;trong&nbsp;ứng&nbsp;dụng&nbsp;từ &nbsp;điển
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pe rform&nbsp;action&nbsp;
    "AXRaise"&nbsp;of&nbsp;window&nbsp;1
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;se t&nbsp;value&nbsp;of&nbsp;attribute&nbsp;
    "AXFocused"&nbsp;of&nbsp;UI&nbsp;element&nbsp;4&nbsp;of&nbsp;front& nbsp;window&nbsp;to&nbsp;true
    &nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;tell
    &nbsp;&nbsp;&nbsp;&nbsp;keystroke&nbsp;
    "a"&nbsp;using&nbsp;command&nbsp;down&nbsp;--&nbsp;thực&nbsp;hiện&nbsp;Command+A&nbsp;để&nbsp;select&nbsp;toàn&nbsp;bộ&nbsp ;ô
    &nbsp;&nbsp;&nbsp;&nbsp;delay&nbsp;0.1
    &nbsp;&nbsp;&nbsp;&nbsp;keystroke&nbsp;
    (ASCII&nbsp;character&nbsp;8)&nbsp;--&nbsp;thực&nbsp;hiện&nbsp;Delete&nbsp;để&nbsp;xó a&nbsp;từ&nbsp;đã&nbsp;có
    &nbsp;&nbsp;&nbsp;&nbsp;delay&nbsp;0.1
    &nbsp;&nbsp;&nbsp;&nbsp;keystroke&nbsp;
    "v"&nbsp;using&nbsp;command&nbsp;down&nbsp;--&nbsp;thực&nbsp;hiện&nbsp;Command+V&nbsp;để&nbsp;paste&nbsp;từ&nbsp;đã&nbsp;c họn
    &nbsp;&nbsp;&nbsp;&nbsp;delay&nbsp;0.1
    &nbsp;&nbsp;&nbsp;&nbsp;keystroke&nbsp;
    return&nbsp;--&nbsp;thực&nbsp;hiện&nbsp;bấm&nbsp;Enter&nbsp;(hay&nbsp;Return)&nbsp;để&nbsp;tra&nbsp;từ
    end&nbsp;tell


    </code></div>
    </div>Chú ý

    - Dựa vào thao tác trong từ điển mình dùng để code.

    - Để focus vào ô nhập dữ liệu thì phải xác định được UI element bao nhiêu (trong từ điển mình dùng là 4). Bạn có thể dùng Accessibility Inspector của XCode để tìm hiểu (Link tut Accessibility Inspector - All this)



    (3) tudien.png: file icon của extension hiển thị trong PopClip với kích thước chính xác là 256x256 và thuộc tính transparent đen trắng.



    Bước 3: Thêm vào đằng sau tên thư mục đuôi .popclipext. Khi đó thư mục sẽ tự động đổi thành extenstion của PopClip. Done [IMG]styles/default/xenforo/clear.png[/IMG]



    Trên đây là một số kinh nghiệm của mình. Chúc bạn sớm tạo được extension cho riêng mình [IMG]styles/default/xenforo/clear.png[/IMG]

  6. #6
    Ngày tham gia
    Dec 2014
    Bài viết
    0
    Trích dẫn Gửi bởi kamikaze129
    Cách tạo extension cho PopClip thì rất linh hoạt. Hướng dẫn có trong 2 bài viết bằng tiếng Anh mình dẫn trên kia. Mình chỉ xin tóm tắt lại cách làm cái extension đơn giản của mình.



    Bước 1: Tạo một thư mục có tên là tên của extension (VietnamDict)



    Bước 2: Chuẩn bị 3 file cho thư mục



    (1) Config.plist : file lưu thông tin config của extention. Có 3 trường quan trọng là

    + AppleScript File: Tên file script chính của extension

    + Image File: Tên file ảnh dùng làm icon của extension trong PopClip

    + Extension Name: Tên của extension cũng chính là tên thư mục





    Mã nguồn HTML:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Actions</key>
        <array>
            <dict>
                <key>AppleScript File</key>
                <string>tudien.applescript</string>
                <key>Image File</key>
                <string>tudien.png</string>
                <key>Title</key>
                <string>Vietnam Dictionaries</string>
            </dict>
        </array>
        <key>Extension Description</key>
        <string>Search the selected word in Vietnam Dictionaries application</string>
        <key>Extension Identifier</key>
        <string>popclip.extension.vietnamdict</string>
        <key>Extension Name</key>
        <string>VietnamDict</string>
        <key>Required Software Version</key>
        <integer>701</integer>
    </dict>
    </plist>
    (2) tudien.applescript: mình dùng applescript để tạo extension (có thể tạo bằng ngôn ngữ khác)



    <div class="bbCodeBlock bbCodePHP">
    <div class="type">PHP:</div>
    <div class="code"><code>
    --&nbsp;Process&nbsp;seletected&nbsp;string
    set&nbsp;oldWord&nbsp;to&nbsp;
    "{popclip&nbsp;text}"&nbsp;--&nbsp;từ&nbsp;đã&nbsp;chọn
    set&nbsp;theCmd&nbsp;to&nbsp;
    ("echo&nbsp;"&nbsp;&&nbsp;quoted&nbsp;form&nbsp;of&nbsp;oldWord&nbsp;&&nbsp;"&nbsp;|&nbsp;perl&nbsp;-pe&nbsp;"&nbsp;&&nbsp;quoted&nbsp;form&nbsp;of&nbsp;"s/[-&nbsp;]//g"&nbsp;as&nbsp;string)&nbsp;--&nbsp;dùng&nbsp;perl&nbsp;(hoặc&nbsp;sed,&nbsp;awk,&nbsp;...)&nbsp;để&nbsp;chỉnh&nbsp;lại&nbsp;từ&nbsp;đã& nbsp;chọn&nbsp;theo&nbsp;nhu&nbsp;cầu&nbsp;(ví&nbsp;dụ&nbsp;như&nbsp;mình&nbsp;muốn&nbs p;bỏ&nbsp;dấu&nbsp;cách&nbsp;trắng&nbsp;và &nbsp;dấu&nbsp;gạch&nbsp;ngang)
    set&nbsp;newWord&nbsp;to&nbsp;do&nbsp;shell&nbsp;script&nbsp;theCmd
    set&nbsp;the&nbsp;clipboard&nbsp;to&nbsp;newWord&n bsp;
    --&nbsp;copy&nbsp;từ&nbsp;đã&nbsp;chọn&nbsp;vào&nbs p;clipboard
    tell&nbsp;application&nbsp;
    "Vietnam&nbsp;Dictionaries"&nbsp;to&nbsp;activate&nbsp;--&nbsp;gọi&nbsp;đến&nbsp;ứng&nbsp;dụng&nbsp;từ &nbsp;điển
    repeat
    &nbsp;&nbsp;&nbsp;&nbsp;
    if&nbsp;application&nbsp;"Vietnam&nbsp;Dictionaries"&nbsp;is&nbsp;running&nbsp;then&nbsp;exit&nbsp;repeat&nbsp;--&nbsp;chờ&nbsp;đến&nbsp;khi&nbsp;ứng&nbsp;dụng& nbsp;khởi&nbsp;động&nbsp;xong
    &nbsp;&nbsp;&nbsp;&nbsp;delay&nbsp;0.5
    end&nbsp;repeat
    delay&nbsp;0.5
    tell&nbsp;application&nbsp;
    "System&nbsp;Events"
    &nbsp;&nbsp;&nbsp;&nbsp;
    tell&nbsp;process&nbsp;"Vietnam&nbsp;Dictionaries"&nbsp;--&nbsp;focus&nbsp;vào&nbsp;ô&nbsp;để&nbsp;nhập&nbs p;từ&nbsp;trong&nbsp;ứng&nbsp;dụng&nbsp;từ &nbsp;điển
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pe rform&nbsp;action&nbsp;
    "AXRaise"&nbsp;of&nbsp;window&nbsp;1
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;se t&nbsp;value&nbsp;of&nbsp;attribute&nbsp;
    "AXFocused"&nbsp;of&nbsp;UI&nbsp;element&nbsp;4&nbsp;of&nbsp;front& nbsp;window&nbsp;to&nbsp;true
    &nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;tell
    &nbsp;&nbsp;&nbsp;&nbsp;keystroke&nbsp;
    "a"&nbsp;using&nbsp;command&nbsp;down&nbsp;--&nbsp;thực&nbsp;hiện&nbsp;Command+A&nbsp;để&nbsp;select&nbsp;toàn&nbsp;bộ&nbsp ;ô
    &nbsp;&nbsp;&nbsp;&nbsp;delay&nbsp;0.1
    &nbsp;&nbsp;&nbsp;&nbsp;keystroke&nbsp;
    (ASCII&nbsp;character&nbsp;8)&nbsp;--&nbsp;thực&nbsp;hiện&nbsp;Delete&nbsp;để&nbsp;xó a&nbsp;từ&nbsp;đã&nbsp;có
    &nbsp;&nbsp;&nbsp;&nbsp;delay&nbsp;0.1
    &nbsp;&nbsp;&nbsp;&nbsp;keystroke&nbsp;
    "v"&nbsp;using&nbsp;command&nbsp;down&nbsp;--&nbsp;thực&nbsp;hiện&nbsp;Command+V&nbsp;để&nbsp;paste&nbsp;từ&nbsp;đã&nbsp;c họn
    &nbsp;&nbsp;&nbsp;&nbsp;delay&nbsp;0.1
    &nbsp;&nbsp;&nbsp;&nbsp;keystroke&nbsp;
    return&nbsp;--&nbsp;thực&nbsp;hiện&nbsp;bấm&nbsp;Enter&nbsp;(hay&nbsp;Return)&nbsp;để&nbsp;tra&nbsp;từ
    end&nbsp;tell


    </code></div>
    </div>Chú ý

    - Dựa vào thao tác trong từ điển mình dùng để code.

    - Để focus vào ô nhập dữ liệu thì phải xác định được UI element bao nhiêu (trong từ điển mình dùng là 4). Bạn có thể dùng Accessibility Inspector của XCode để tìm hiểu (Link tut Accessibility Inspector - All this)



    (3) tudien.png: file icon của extension hiển thị trong PopClip với kích thước chính xác là 256x256 và thuộc tính transparent đen trắng.



    Bước 3: Thêm vào đằng sau tên thư mục đuôi .popclipext. Khi đó thư mục sẽ tự động đổi thành extenstion của PopClip. Done [IMG]styles/default/xenforo/clear.png[/IMG]



    Trên đây là một số kinh nghiệm của mình. Chúc bạn sớm tạo được extension cho riêng mình [IMG]styles/default/xenforo/clear.png[/IMG]
    Tuyệt vời

    Bác hướng dẫn quá là kĩ luôn

    Lát từ office về e sẽ mò thử ạ

    Bác có trang nào hay sỏuce nào hữu icgs để học apple script ko ạ chia sẻ em với. E thấy nó hay hay mà k biết học từ đâu ạ

    tiện thể bác có cần office 365 ko ạ

  7. #7
    Ngày tham gia
    Dec 2014
    Bài viết
    0
    Trích dẫn Gửi bởi kamikaze129
    Cách tạo extension cho PopClip thì rất linh hoạt. Hướng dẫn có trong 2 bài viết bằng tiếng Anh mình dẫn trên kia. Mình chỉ xin tóm tắt lại cách làm cái extension đơn giản của mình.



    Bước 1: Tạo một thư mục có tên là tên của extension (VietnamDict)



    Bước 2: Chuẩn bị 3 file cho thư mục



    (1) Config.plist : file lưu thông tin config của extention. Có 3 trường quan trọng là

    + AppleScript File: Tên file script chính của extension

    + Image File: Tên file ảnh dùng làm icon của extension trong PopClip

    + Extension Name: Tên của extension cũng chính là tên thư mục





    Mã nguồn HTML:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Actions</key>
        <array>
            <dict>
                <key>AppleScript File</key>
                <string>tudien.applescript</string>
                <key>Image File</key>
                <string>tudien.png</string>
                <key>Title</key>
                <string>Vietnam Dictionaries</string>
            </dict>
        </array>
        <key>Extension Description</key>
        <string>Search the selected word in Vietnam Dictionaries application</string>
        <key>Extension Identifier</key>
        <string>popclip.extension.vietnamdict</string>
        <key>Extension Name</key>
        <string>VietnamDict</string>
        <key>Required Software Version</key>
        <integer>701</integer>
    </dict>
    </plist>
    (2) tudien.applescript: mình dùng applescript để tạo extension (có thể tạo bằng ngôn ngữ khác)



    <div class="bbCodeBlock bbCodePHP">
    <div class="type">PHP:</div>
    <div class="code"><code>
    --&nbsp;Process&nbsp;seletected&nbsp;string
    set&nbsp;oldWord&nbsp;to&nbsp;
    "{popclip&nbsp;text}"&nbsp;--&nbsp;từ&nbsp;đã&nbsp;chọn
    set&nbsp;theCmd&nbsp;to&nbsp;
    ("echo&nbsp;"&nbsp;&&nbsp;quoted&nbsp;form&nbsp;of&nbsp;oldWord&nbsp;&&nbsp;"&nbsp;|&nbsp;perl&nbsp;-pe&nbsp;"&nbsp;&&nbsp;quoted&nbsp;form&nbsp;of&nbsp;"s/[-&nbsp;]//g"&nbsp;as&nbsp;string)&nbsp;--&nbsp;dùng&nbsp;perl&nbsp;(hoặc&nbsp;sed,&nbsp;awk,&nbsp;...)&nbsp;để&nbsp;chỉnh&nbsp;lại&nbsp;từ&nbsp;đã& nbsp;chọn&nbsp;theo&nbsp;nhu&nbsp;cầu&nbsp;(ví&nbsp;dụ&nbsp;như&nbsp;mình&nbsp;muốn&nbs p;bỏ&nbsp;dấu&nbsp;cách&nbsp;trắng&nbsp;và &nbsp;dấu&nbsp;gạch&nbsp;ngang)
    set&nbsp;newWord&nbsp;to&nbsp;do&nbsp;shell&nbsp;script&nbsp;theCmd
    set&nbsp;the&nbsp;clipboard&nbsp;to&nbsp;newWord&n bsp;
    --&nbsp;copy&nbsp;từ&nbsp;đã&nbsp;chọn&nbsp;vào&nbs p;clipboard
    tell&nbsp;application&nbsp;
    "Vietnam&nbsp;Dictionaries"&nbsp;to&nbsp;activate&nbsp;--&nbsp;gọi&nbsp;đến&nbsp;ứng&nbsp;dụng&nbsp;từ &nbsp;điển
    repeat
    &nbsp;&nbsp;&nbsp;&nbsp;
    if&nbsp;application&nbsp;"Vietnam&nbsp;Dictionaries"&nbsp;is&nbsp;running&nbsp;then&nbsp;exit&nbsp;repeat&nbsp;--&nbsp;chờ&nbsp;đến&nbsp;khi&nbsp;ứng&nbsp;dụng& nbsp;khởi&nbsp;động&nbsp;xong
    &nbsp;&nbsp;&nbsp;&nbsp;delay&nbsp;0.5
    end&nbsp;repeat
    delay&nbsp;0.5
    tell&nbsp;application&nbsp;
    "System&nbsp;Events"
    &nbsp;&nbsp;&nbsp;&nbsp;
    tell&nbsp;process&nbsp;"Vietnam&nbsp;Dictionaries"&nbsp;--&nbsp;focus&nbsp;vào&nbsp;ô&nbsp;để&nbsp;nhập&nbs p;từ&nbsp;trong&nbsp;ứng&nbsp;dụng&nbsp;từ &nbsp;điển
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pe rform&nbsp;action&nbsp;
    "AXRaise"&nbsp;of&nbsp;window&nbsp;1
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;se t&nbsp;value&nbsp;of&nbsp;attribute&nbsp;
    "AXFocused"&nbsp;of&nbsp;UI&nbsp;element&nbsp;4&nbsp;of&nbsp;front& nbsp;window&nbsp;to&nbsp;true
    &nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;tell
    &nbsp;&nbsp;&nbsp;&nbsp;keystroke&nbsp;
    "a"&nbsp;using&nbsp;command&nbsp;down&nbsp;--&nbsp;thực&nbsp;hiện&nbsp;Command+A&nbsp;để&nbsp;select&nbsp;toàn&nbsp;bộ&nbsp ;ô
    &nbsp;&nbsp;&nbsp;&nbsp;delay&nbsp;0.1
    &nbsp;&nbsp;&nbsp;&nbsp;keystroke&nbsp;
    (ASCII&nbsp;character&nbsp;8)&nbsp;--&nbsp;thực&nbsp;hiện&nbsp;Delete&nbsp;để&nbsp;xó a&nbsp;từ&nbsp;đã&nbsp;có
    &nbsp;&nbsp;&nbsp;&nbsp;delay&nbsp;0.1
    &nbsp;&nbsp;&nbsp;&nbsp;keystroke&nbsp;
    "v"&nbsp;using&nbsp;command&nbsp;down&nbsp;--&nbsp;thực&nbsp;hiện&nbsp;Command+V&nbsp;để&nbsp;paste&nbsp;từ&nbsp;đã&nbsp;c họn
    &nbsp;&nbsp;&nbsp;&nbsp;delay&nbsp;0.1
    &nbsp;&nbsp;&nbsp;&nbsp;keystroke&nbsp;
    return&nbsp;--&nbsp;thực&nbsp;hiện&nbsp;bấm&nbsp;Enter&nbsp;(hay&nbsp;Return)&nbsp;để&nbsp;tra&nbsp;từ
    end&nbsp;tell


    </code></div>
    </div>Chú ý

    - Dựa vào thao tác trong từ điển mình dùng để code.

    - Để focus vào ô nhập dữ liệu thì phải xác định được UI element bao nhiêu (trong từ điển mình dùng là 4). Bạn có thể dùng Accessibility Inspector của XCode để tìm hiểu (Link tut Accessibility Inspector - All this)



    (3) tudien.png: file icon của extension hiển thị trong PopClip với kích thước chính xác là 256x256 và thuộc tính transparent đen trắng.



    Bước 3: Thêm vào đằng sau tên thư mục đuôi .popclipext. Khi đó thư mục sẽ tự động đổi thành extenstion của PopClip. Done [IMG]styles/default/xenforo/clear.png[/IMG]



    Trên đây là một số kinh nghiệm của mình. Chúc bạn sớm tạo được extension cho riêng mình [IMG]styles/default/xenforo/clear.png[/IMG]
    Tuyệt vời

    Bác hướng dẫn quá là kĩ luôn

    Lát từ office về e sẽ mò thử ạ

    Bác có trang nào hay sỏuce nào hữu icgs để học apple script ko ạ chia sẻ em với. E thấy nó hay hay mà k biết học từ đâu ạ

    tiện thể bác có cần office 365 ko ạ. E tặng bác 1 account

  8. #8
    Ngày tham gia
    Dec 2014
    Bài viết
    1
    À bên pilotmoon họ cũng public code của các extension lên Github đó. Bạn có thể vào tham khảo (https://github.com/pilotmoon/PopClip-Extensions)



    Còn vụ apple script thì thực sự mình cũng học bập bõm thôi. Cần làm cái gì thì tìm hiểu cái đó trên Google chứ không xem cố định ở trang nào cả [IMG]styles/default/xenforo/clear.png[/IMG]



    Bạn có thể vào trang sau để tìm hiểu và apple script

    http://macosxautomation.com/applescr...ial/index.html

    hoặc sử dụng tài liệu của apple

    https://developer.apple.com/library...eScriptLangGuide/AppleScriptLanguageGuide.pdf

    etc.... [IMG]styles/default/xenforo/clear.png[/IMG]



    Còn một điều nữa là từ applescript có thể gọi các script khác như shell script hay javascript nên nếu biết thêm cả những cái này nữa thì sẽ còn hay hơn (ví dụ bên trên mình có sử dụng shell script để xử lý text)



    Mình không có nhu cầu dùng Office 365 lắm (bộ office của Apple + TeX là đủ cho nhu cầu của mình rồi). Cảm ơn bạn nhiều [IMG]styles/default/xenforo/clear.png[/IMG]

  9. #9
    Cảm ơn bác và tinh thần chia sẻ tuyệt vời của bác.

    Mong bác tiếp tục nghiên cứu để chia sẻ cho anh em

Các Chủ đề tương tự

  1. Đồ bộ thun mặc nhà hiệu Lys (của cty Scavi Vietnam)
    Bởi seocamau trong diễn đàn Mua Bán Thời Trang
    Trả lời: 5
    Bài viết cuối: 08-30-2012, 06:48 AM

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •