Results 1 to 7 of 7

Thread: Need Applescript to lock computer

  1. #1
    Join Date
    Apr 2010
    Posts
    80

    Need Applescript to lock computer

    Hi, basically i am a Windows Xp user but recently have bought a new pc with Snow Leopard. Am not much familiar with OS yet but liked it. Now as we lock the computer in Windows with the key Win + L, i wanted to do similar in MAC as well. Some friends suggested me to go with Applescript for the same. So, could you guys please let me know where can i get that Applescript ? Also let me know some info about the same. Thanks in advance.

  2. #2
    Join Date
    May 2008
    Posts
    4,085

    Re: Need Applescript to lock computer

    AppleScript is a scripting language created by Apple , and integrated with Mac OS . It is known to possess a rich and elaborate syntax, the closest as possible to a limited pseudo-English. More generally, AppleScript is the word that means the script interface of Mac OS, which is designed to operate in parallel with the graphical environment . It was designed to offer users a smart control applications, information and documents and thus implement an automated management tasks. Automate tasks with AppleScript reduces the time it takes to accomplish these tasks and reduce opportunities for human error.

  3. #3
    Join Date
    Apr 2008
    Posts
    3,267

    Re: Need Applescript to lock computer

    Here is the Applescript that i have taken from one of my friend using Mac os x:
    Code:
    activate application "SystemUIServer"
    tell application "System Events"
        tell process "SystemUIServer"
        	repeat with i from 1 to number of menu bar items of menu bar 1
        		tell menu bar item i of menu bar 1
        			click
        			try
        				if name of menu item 1 of front menu is "Lock Screen" then
        					click menu item "Lock Screen" of front menu
        					exit repeat
        				end if
        			end try
        		end tell
        	end repeat
        end tell
    end tell
    Hope it works.!

  4. #4
    Join Date
    Nov 2009
    Posts
    156

    Re: Need Applescript to lock computer

    Well, alternatively we can activate the screensaver and set it password to end the same. It is also like locking the screen of your MAC system. Here is how to do that:
    Code:
    do shell script "open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app"

  5. #5
    Join Date
    Apr 2008
    Posts
    3,522

    Re: Need Applescript to lock computer

    A major concept is that the AppleScript scripts handle applications in a way fundamentally different from the way users interact with them. The user uses the application through the GUI by selecting options in the menus and clicking buttons, so that scripts request and define the values and actions invoked by the application in internal mode. For example, instead of simulating keystrokes to enter text into fields of application, using AppleScript commands directly fixing the values of the desired fields of the record, even without the application

  6. #6
    Join Date
    Jul 2009
    Posts
    49

    Re: Need Applescript to lock computer

    In Mac OS X , AppleScript is easier to implement by the developers, particularly for applications developed in Cocoa . Unlike Mac OS where the events are handled by applications in Cocoa, events are decoded high-level command by the subject NSApplication , and messages addressed directly to the correct object. Every Cocoa application is "refactored" by default, the developer who (normally) to write the code for handling events but only the "methods" that will be called by these events.

  7. #7
    Join Date
    Feb 2007
    Posts
    234

    Re: Need Applescript to lock computer

    To designate which application is referred by the message, AppleScript uses the verb ""tell"" (said):
    Code:
     tell application ""Microsoft Word""
       quit
     end tell
    This same application can be written in one line using the verb in the infinitive:
    Code:
     tell application ""Microsoft Word"" to quit

Similar Threads

  1. How To Put Child Lock In A Computer?
    By Bohnieta in forum Networking & Security
    Replies: 4
    Last Post: 29-12-2011, 10:47 PM
  2. How to Lock Computer in Linux
    By Maya Angelou in forum Networking & Security
    Replies: 5
    Last Post: 13-03-2010, 08:50 AM
  3. How to Lock My Computer With a Bluetooth Device
    By Leoniee in forum Technology & Internet
    Replies: 5
    Last Post: 29-01-2010, 02:02 AM
  4. How to Lock a computer screen?
    By Corry in forum Windows Software
    Replies: 5
    Last Post: 25-01-2010, 05:20 PM
  5. 3D games lock my computer
    By Carnie in forum Video Games
    Replies: 3
    Last Post: 25-11-2009, 01:07 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,556,386.13788 seconds with 16 queries