কম্পিউটার

উৎপাদনশীলতা উন্নত করতে ম্যাকের অ্যাপলস্ক্রিপ্টের 5 ব্যবহার

উৎপাদনশীলতা উন্নত করতে ম্যাকের অ্যাপলস্ক্রিপ্টের 5 ব্যবহার

অ্যাপলস্ক্রিপ্ট অ্যাপলের কিছুটা অস্পষ্ট স্ক্রিপ্টিং ভাষা, তবে এটি নতুন প্রোগ্রামগুলির সুবিধা নেওয়ার জন্য একটি শক্তিশালী হাতিয়ার। বিরক্তিকর কাজগুলি পরিচালনা করে এমন কয়েকটি চতুর অ্যাপলস্ক্রিপ্টের সাহায্যে, আমরা উত্পাদনশীলতা বাড়াতে পারি এবং আপনার ব্লুজগুলিকে স্বয়ংক্রিয়ভাবে দূরে রাখতে পারি৷

অ্যাপলস্ক্রিপ্ট কি?

উৎপাদনশীলতা উন্নত করতে ম্যাকের অ্যাপলস্ক্রিপ্টের 5 ব্যবহার

ফাইন্ডার, আইটিউনস, কুইকটাইম এবং মেইলের মতো বেশিরভাগ ম্যাক অ্যাপ্লিকেশনগুলির সাথে অ্যাপলস্ক্রিপ্ট ইন্টারফেস। আপনি যদি অটোমেটরের সাথে পরিচিত হন তবে অ্যাপলস্ক্রিপ্ট সেই অ্যাপ্লিকেশনটির একটি পাওয়ার ব্যবহারকারীর সংস্করণ।

1. লুকানো ফাইল টগল করুন

এটিকে একটি অ্যাপ্লিকেশন হিসাবে সংরক্ষণ করুন এবং ফাইন্ডারে লুকানো ফাইলগুলি প্রকাশ করতে আপনার কাছে একটি ক্লিকযোগ্য টগল থাকবে৷

set newHiddenState to "YES"
try
    set oldHiddenState to do shell script "defaults read com.apple.finder AppleShowAllFiles"
    if oldHiddenState is in {"1", "YES"} then
        set newHiddenState to "NO"
    end if
end try
do shell script "defaults write com.apple.finder AppleShowAllFiles " & newHiddenState
do shell script "killAll Finder"

2. ব্যাচ ফাইলের নাম পরিবর্তন করুন

এই স্ক্রিপ্টটি ব্যবহারকারীকে একটি ফাইলের নামের জন্য অনুরোধ করবে এবং তারপর স্বয়ংক্রিয়ভাবে সেই পাঠ্য স্ট্রিং এবং একটি বর্ধিত সূচক সহ নির্বাচিত ফাইলগুলির নাম পরিবর্তন করবে। এমনকি এটি সহায়কভাবে এক থেকে দশ ফাইলের জন্য অগ্রণী শূন্য যোগ করে।

-- This code comes from https://gist.github.com/oliveratgithub/
-- Open in AppleScript Editor and save as Application
-- ------------------------------------------------------------
--this is required to break the filename into pieces (separate name and extension)
set text item delimiters to "."
tell application "Finder"
    set all_files to every item of (choose file with prompt "Choose the Files you'd like to rename:" with multiple selections allowed) as list
    display dialog "New file name:" default answer ""
    set new_name to text returned of result
    --now we start looping through all selected files. 'index' is our counter that we initially set to 1 and then count up with every file.
    --the 'index' number is of course required for the sequential renaming of our files!
    repeat with index from 1 to the count of all_files
        --using our index, we select the appropriate file from our list
        set this_file to item index of all_files
        set file_name_count to text items of (get name of this_file)
        --if the index number is lower than 10, we will add a preceding "0" for a proper filename sorting later
        if index is less than 10 then
            set index_prefix to "0"
        else
            set index_prefix to "" 
        end if
        --
        --lets check if the current file from our list (based on index-number) has even any file-extension
        if number of file_name_count is 1 then
            --file_name-count = 1 means, we extracted only 1 text-string from the full file name. So there is no file-extension present.
            set file_extension to ""
        else
            --yup, we are currently processing a file that has a file-extension
            --we have to re-add the original file-extension after changing the name of the file!
            set file_extension to "." & item -1 of file_name_count
        end if
        --let's rename our file, add the sequential number from 'index' and add the file-extension to it
        set the name of this_file to new_name & index_prefix & index & file_extension as string
    end repeat
    --congratulations for successfully accomplishing the batch renaming task :)
    display alert "All done! Renamed " & index & " files with '" & new_name & "' for you. Have a great day! :)"
end tell

3. শতাংশ দ্বারা একটি ছবি মাপ করুন

এই স্ক্রিপ্টটি ছবিগুলিকে তাদের আসল আকারের 50% স্কেল করবে৷

-- Prompt for an image
set theImageFile to choose file of type "public.image" with prompt "Please select an image:"
 
-- Locate an output folder
set theOutputFolder to (path to desktop folder as string)
 
-- Launch Image Events
tell application "Image Events"
    launch
 
    -- Open the image
    set theImage to open theImageFile
    tell theImage
 
        -- Determine a save name for the image
        set theName to name
        set theSaveName to "smlr-" & theName
 
        -- Scale the image by 50%
        scale by factor 0.5
 
        -- Save the image to the output folder, using the save name
        save as file type in (theOutputFolder & theSaveName)
 
        -- Close the image
        close
    end tell
end tell

4. ছবিকে পিক্সেল প্রস্থে স্কেল করুন

এটি পূর্ববর্তী স্ক্রিপ্টগুলির শুরুর বেশিরভাগই ব্যবহার করে কিন্তু পরিবর্তে পিক্সেল প্রস্থে স্কেল করে। এটি ব্যবহারকারীকে পছন্দসই পিক্সেল প্রস্থের জন্য অনুরোধ করবে এবং সেই পিক্সেল প্রস্থটিকে নতুন ফাইলের নামের শুরুতে যুক্ত করবে৷

-- Prompt for an image
set theImageFile to choose file of type "public.image" with prompt "Please select an image:"
 
set dialogResult to (display dialog "Enter desired pixel width:" default answer "") try set pixelWidth to (text returned of dialogResult) as integer end try 
 
-- Locate an output folder
set theOutputFolder to (path to desktop folder as string)
 
-- Launch Image Events
tell application "Image Events"
    launch
 
    -- Open the image
    set theImage to open theImageFile
    tell theImage
 
        -- Determine a save name for the image
        set theName to name
        set theSaveName to (pixelWidth as text) & "-px-" & theName
 
        -- Scale the image to pixelWidth
        scale to size pixelWidth
 
        -- Save the image to the output folder, using the save name
        save as file type in (theOutputFolder & theSaveName)
 
        -- Close the image
        close
    end tell
end tell

5. নির্বাচিত গন্তব্যে ফোল্ডার ব্যাক আপ করুন

এই সহজ স্ক্রিপ্টটি একটি নির্বাচিত ফোল্ডারকে একটি নির্বাচিত গন্তব্যে সদৃশ করে যা জটিল টেনে-আন-ড্রপ কপি করাকে কিছুটা কম বেদনাদায়ক করে তুলতে পারে৷

set backupTarget to (choose folder with prompt "Select a Backup Target")
set backupDestination to (choose folder with prompt "Select a Backup Destination")
tell application "Finder"
    duplicate folder backupTarget to folder backupDestination
end tell

উপসংহার

অ্যাপলস্ক্রিপ্ট সম্পর্কে আরও জানতে, আপনি অ্যাপলের নিজস্ব ডকুমেন্টেশন পরীক্ষা করে দেখতে পারেন। আরও ভাল এখনও MacOSXAutomation.com, যা আরও নূব-বান্ধব৷


  1. ম্যাকের জন্য ফাইলপেন:আপনার উত্পাদনশীলতা উন্নত করতে দরকারী ড্র্যাগ-এন্ড-ড্রপ অ্যাকশন যোগ করুন

  2. একটি অ্যাডওয়্যার অপসারণ অ্যাপলস্ক্রিপ্ট খুঁজছেন?

  3. উইন্ডোজ এবং ম্যাকের জন্য সেরা ডিজে সফ্টওয়্যার

  4. 8 ম্যাকের জন্য সেরা ব্যাকআপ সফ্টওয়্যার