Mac applescipt Auto-complete button

Source: Internet
Author: User

I use AppleScript successfully implemented the open Ruijie app, and in the User verification box enter my user password, and then force quit Ruijie. (As for why?) With the pain of campus network, long story Ah! )

Learn the following, first you have to self-Baidu information to learn a little content, learn how to use the Script Editor and Automatorinside the utility tool. Practical tools, really useful ah!

--script Completion key combination Press by Ficowtell application"System Events"Key Code -using {command-down, option Down}end tell----this symbol is a comment symbol, (* *This is also an annotation symbol, similar to//and/**/in C language--key Code 53 means that the ESC key is pressed, and the meaning of 53 is shown in the following list--the key pressed with the using {} Brace section functions together with the previous key event--command down, the meaning of option down is to press command and option--so the purpose of this script is to start the Force Exit window (COMMAND+OPTION+ESC) (*Apple key code list:0 0x00ansi_a1 0x01ansi_s2 0x02Ansi_d3 0x03Ansi_f4 0x04Ansi_h5 0x05Ansi_g6 0x06ansi_z7 0x07ansi_x8 0x08Ansi_c9 0x09Ansi_vTen 0x0Aiso_section One 0x0BAnsi_b A 0x0Cansi_q - 0x0DAnsi_w - 0x0Eansi_e the 0x0FAnsi_r - 0x10ansi_y - 0x11ansi_t - 0x12ansi_1 + 0x13ansi_2 - 0x14Ansi_3 + 0x15Ansi_4 A 0x16Ansi_6 at 0x17ansi_5 - 0x18ansi_equal - 0x19Ansi_9 - 0x1Aansi_7 - 0x1BAnsi_minus - 0x1CAnsi_8 in 0x1DAnsi_0 - 0x1EAnsi_rightbracket to 0x1FAnsi_o + 0x20Ansi_u - 0x21Ansi_leftbracket the 0x22ansi_i * 0x23ansi_p $ 0x24ReturnPanax Notoginseng 0x25ansi_l - 0x26Ansi_j the 0x27Ansi_quote + 0x28Ansi_k A 0x29Ansi_semicolon the 0x2AAnsi_backslash + 0x2BAnsi_comma - 0x2CAnsi_slash $ 0x2DAnsi_n $ 0x2eansi_m - 0x2FAnsi_period - 0x30Tab the 0x31Space - 0x32Ansi_graveWuyi 0x33Delete - 0x35Escape - 0x37Command About 0x38Shift $ 0x39CapsLock - 0x3AOption - 0x3BControl - 0x3CRightShift A 0x3drightoption + 0x3eRightcontrol the 0x3FFunction - 0x40F17 $ 0x41Ansi_keypaddecimal the 0x43ansi_keypadmultiply the 0x45Ansi_keypadplus in 0x47Ansi_keypadclear the 0x48Volumeup the 0x49Volumedown About 0x4AMute the 0x4BAnsi_keypaddivide the 0x4CAnsi_keypadenter + 0x4EAnsi_keypadminus - 0x4fF18 the 0x50F19Bayi 0x51ansi_keypadequals the 0x52ansi_keypad0 the 0x53Ansi_keypad1 - 0x54ansi_keypad2 - 0x55ansi_keypad3 the 0x56Ansi_keypad4 the 0x57Ansi_keypad5 the 0x58Ansi_keypad6 the 0x59Ansi_keypad7 - 0x5AF20 the 0x5bAnsi_keypad8 the 0x5Cansi_keypad9 the 0x5dJis_yen94 0x5EJis_underscore the 0x5fJis_keypadcomma the 0x60F5 the 0x61F698 0x62F7 About 0x63F3 - 0x64F8101 0x65F9102 0x66Jis_eisu103 0x67F11104 0x68Jis_kana the 0x69F13106 0x6AF16107 0x6bF14109 0x6dF10111 0x6FF12113 0x71F15 the 0x72 Help the 0x73Home the 0x74PageUp117 0x75Forwarddelete118 0x76F4119 0x77End - 0x78F2121 0x79PageDown122 0x7AF1123 0x7BLeftarrow124 0x7CRightArrow the 0x7dDownArrow126 0x7EUpArrow*)

Enclosed here is my own Automator service:

First, in Automator, add the service.

Open Automator, create a new service,

Then, add the ability to start Ruijie (double-click to open the application, right back to the functional block that can be configured):

After the start of the Ruijie need to enter their own user password, so immediately insert the completion of the button press the script, complete the password automatic input:

Your script goes here, OK, here's the script that starts typing the password:

On Run {input, parameters}        (* Your script goes here *)    1 -- delay after 1S to perform the following        content "System Events " 1--Here is a demonstration, only the lowercase s,code code is entered, please refer to        key code list,   Enter the carriage return,           To confirm the password input    end        tell-- delay 10S, wait for Ruijie to start and automatically login complete        return inputend run 

Next, add another script and enter the script code to end the Ruijie:

On Run {input, parameters} (* Your script goes here *)        Beep--let the Mac make a sound tell application"System Events"Key Code -Using {command-down, option-down}--press the key combination of the Open Force exit box to delay1Key Code the--Determine select Delay1Key Code the--OK exit Ruijie end Tell--Tell and end tell need to be paired using return Inputend run

Available References:

http://www.guokr.com/blog/792617/

Http://apple.stackexchange.com/questions/36943/how-do-i-automate-a-key-press-in-applescript

Mac applescipt Auto-complete button

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.