Script to change keyboard modifer keys?

I'm trying to create a login script to use with Workgroup Manager that will allow me to change the keyboard modifer keys on a client machine. I've done a search and found a few scripts but they don't seem to work. For example the following script:
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.keyboard"
tell application "System Events"
tell process "System Preferences"
click button "Modifier Keys…" of tab group 1 of window "Keyboard & Mouse"
set curOpt to (get value of pop up button 3 of sheet 1 of window "Keyboard & Mouse")
set curCmd to (get value of pop up button 4 of sheet 1 of window "Keyboard & Mouse")
tell sheet 1 of window "Keyboard & Mouse"
tell pop up button 3
click
click menu item curCmd
end tell
tell pop up button 4
click
click menu item curOpt
end tell
end tell
click button "Ok" of sheet 1 of window "Keyboard & Mouse"
end tell
end tell
quit
end tell
I am trying to get this to work on OS X 10.6 with no luck. Firstly I have seperate options in System Preferences for Keyboard and Mouse settings (the script above points to window "Keyboard & Mouse") and secondly, even after changing the "Keyboard & Mouse" to just "Keyboard" I get an error message about not being about to locate button "Modifier Keys...".
All I'm trying to do is change the Modifier Keys so that Crtl key is set to nothing. Could anyone help me out?

This could work... (tested with 10.6.7)... not very fast...
another idea could be a defaults write command, but I am not sure which prefs-file you would have to edit.. maybe .GlobalPreferences.plist...
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.keyboard"
tell application "System Events"
tell process "System Preferences"
click button 1 of tab group 1 of window 1
set curOpt to (get value of pop up button 3 of sheet 1 of window 1)
set curCmd to (get value of pop up button 4 of sheet 1 of window 1)
click pop up button 4 of sheet 1 of window 1
my setbuttonitem(1)
click pop up button 3 of sheet 1 of window 1
my setbuttonitem(2)
click pop up button 2 of sheet 1 of window 1
my setbuttonitem(3)
click pop up button 1 of sheet 1 of window 1
my setbuttonitem(4)
delay 0.25
keystroke return
end tell
end tell
quit
end tell
on setbuttonitem(valueindex)
tell application "System Events"
tell process "System Preferences"
repeat with i from 1 to 5
key code 126
delay 0.25
end repeat
repeat with i from 1 to valueindex - 1
key code 125
delay 0.25
end repeat
keystroke return
end tell
end tell
end setbuttonitem

Similar Messages

  • Changing keyboard modifier keys

    I use an editor (EMACS) which makes major use of the 'ctrl' key so I swap it with the 'caps lock' key so my little finger can hit it without getting a cramp. It works just fine about 90% of the time but the other 10%, when I hit the 'caps lock' key instead of getting the 'ctrl' function I get the 'caps lock' function and my editing screws up terribly. It is really frustrating because if I don't notice, and if I hit what I think is <ctrl>k to kill a line I get a 'K' in the text instead.
    PowerBook G4    

    I solved this problem by finding and altering an applescript that will change the keyboard modifier keys. I wish I could still find the web page so I could post it, but here's the applescript I used to change to PC layout:
    tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preference.keyboard"
    end tell
    tell application "System Events"
    tell process "System Preferences"
    click radio button "Keyboard" of tab group 1 of window "Keyboard & Mouse"
    click button "Modifier Keys…" of tab group 1 of window "Keyboard & Mouse"
    click pop up button 3 of sheet 1 of window "Keyboard & Mouse"
    click menu item 4 of menu 1 of pop up button 3 of sheet 1 of window "Keyboard & Mouse"
    delay 1
    click pop up button 4 of sheet 1 of window "Keyboard & Mouse"
    click menu item 3 of menu 1 of pop up button 4 of sheet 1 of window "Keyboard & Mouse"
    click button "OK" of sheet 1 of window "Keyboard & Mouse"
    end tell
    end tell
    tell application "System Preferences"
    quit
    end tell
    (end of script)
    And here's the script I used to change it back to Mac layout:
    tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preference.keyboard"
    end tell
    tell application "System Events"
    tell process "System Preferences"
    click radio button "Keyboard" of tab group 1 of window "Keyboard & Mouse"
    click button "Modifier Keys…" of tab group 1 of window "Keyboard & Mouse"
    click button "Restore Defaults" of sheet 1 of window "Keyboard & Mouse"
    click button "OK" of sheet 1 of window "Keyboard & Mouse"
    end tell
    end tell
    tell application "System Preferences"
    quit
    end tell
    (end of script)
    I saved the scripts as executibles with neat Apple and XP custom icons and put them in the Dock. Pretty slick.

  • How can I change the input key language between different languages ?

    the language can't be changed when i press ctrl+alt

    The default keys to rotate the layout is a key combination (Ctrl+Shift or Alt+Shift) that can easily be used in Firefox to activate a menu item.
    It is better to disable the key sequence to rotate layouts (Alt+Shift or Ctr+Shift) to avoid an unintentional switch and instead assign a specific key (Alt/Ctrl + Shift + number) to switch to the keyboard layout.
    Control Panel > Regional and Language Options > Keyboards and Languages > Change keyboards > Advanced key settings > Change key sequence
    http://support.microsoft.com/kb/258824 - How to change your keyboard layout
    You can also use the Language bar on the Windows Taskbar.<br />
    You can make the Language bar visible via the right-click context menu of the Taskbar: Toolbars > Language Bar.
    * http://windows.microsoft.com/en-US/windows7/The-Language-bar-overview The Language bar (overview)

  • WLC: Need to change pre-shared key with a script

    Hello,
    I need to change pre-shared key on a Guest Wi-Fi with a script.
    Does anybody has an idea how to find the right entry in the WLC 2125 MIB to change it through SNMP?
    Gorazd

    Hi,
    That is a textFramePreferences property
    mySelection.textFramePreferences.verticalThreshold = Number (range 0- 8640)
    ID Object Reference says:
    "...The maximum amount of vertical space between two paragraphs. Note: Valid only when vertical justification is justified; the specified amount is applied in addition to the space before or space after values defined for the paragraph..."

  • I want to change the "f" keys on my keyboard, how do I do this?

    hey, I want to change the "F" key functions on my keyboard, how do I do this with mozilla?

    don tishman wrote:
    When my Mac Pro starts up, a rectangular magnyfying glass appears, how can i get rid of this magnyfying glass.?
    By posting the same question numerous times, you are more likely to make people ignore your posts than help. You have been given one reply 3 threads back. Go to System Preferences > Universal Access > and turn off Zoom under (Seeing)
    Pete

  • I want to change the command keys on my Belkin wireless number keypad and on my Mac keyboard. How can I do that?

    I want to change the command keys on my Belkin wireless number keypad and on my Mac keyboard. How can I do that?

    Command key - this one?
    I want to change the command keys
    You want to change it to what?

  • Hi Everyone! My USB Keyboard allows me to log in and type my password, however once logged in I am unable to use the keyboard, the keys do not respond - have I unknowingley changed the setting and how do I fix it?

    HI All, as above, VERY NEW and frustrating issue........
    My USB keyboard works fine to allow me log into a profile, but once in the keyboard then doesn't work whatsoever.
    Please help?

    in the Keyboard pane of the settings there is a button at the bottom left that says change keyboard type, that walks you through the process if Mac cannot find your keyboard

  • Why can't I use AS to change Keyboard prefpane settings?

    Hey y'all, I got a question for you.
    I have a windows keyboard that I plug into my iBook at home. A very common arrangement, I'm sure.
    When I plug the keyboard in, I go into the Keyboard prefpane and use the controls there to swap the <COMMAND> and <OPTION> Keys, so the keys are more mac-like.
    What I want to do is pretty simple: Create an applescript to do that for me, so I don't have to, everytime, go Apple -> System Preference -> Keyboard & Mouse -> Keyboard -> Modifier Keys etc.
    As a total AS newbie, here are my questions:
    1. Can AS do this?
    2. If not, why not? This is a serious question: What good is AppleScript if it won't actually do the things -- especially an extremely simple thing like change a system preference -- that I want it to?
    3. Is there a better way to do this?
    Thanks for whatever guidance you can offer!
    Alaska Jack
    iBook G4   Mac OS X (10.4.6)  

    Hi Jack and welcome to Apple Discussions!
    To answer your questions:
    1) Apparently so. See this thread in the Automator forum.
    2) AppleScript is very good at automating repetitive tasks and inter-application communication - provided developers incorporate scriptability into their applications. In the case of System Preferences, Apple themselves haven't put in the "hooks" that allow preferences to be changed without resorting to UI scripting, as in the solution linked above.
    3) It might be possible to parse the preference files themselves.
    Hope this helps,
    H

  • Modifer keys do not work with mouse in Illustrator

    Below is a copy of a bug report I just submitted to Adobe. I don't suppose any users have run across this and found a solution or workaround?
    I found someone else with this problem in an archived topic thread, but the only response that poor fellow got was an accusation of not following instructions (His problem wasn't user error, BTW).
    Thanks
    ******BUG******
    Concise problem statement:
    Modifer keys do not work with mouse: For example, free transform or rotate behaviors that require "Click-Ctrl" .
    Steps to reproduce bug:
    1. select object
    2. select free transform tool
    3. left click (without releasing) a corner of the bounding box.
    4. start dragging
    5. press ctrl
    Results:
    object behaves as though the ctrl key was not pressed. i.e. the cursor does not change shape and the object scales rather than distorts.
    Expected results: The cursor should change shape as the ctrl key is pressed and the object should distort rather than scale.
    Additional information: This behavior is intermittent. Occasionally Illustrator recognizes the "Click-Ctrl" combination and behaves exactly as the help file predicts it will. The cursor changes shape and the object distorts rather than scales. I can offer no rhyme or reason for when Illustrator will behave as advertised and when it will ignore the modifier keys.
    The example above involves the free transform tool, but the problem occurs just as often with other tool behaviors that require a modifier key + mouse combination.
    Primarily using Wacom Intuos3 tablet. (with latest drivers), but have also tried combinations with microsoft mouse or both mice installed.
    Also, immediately after an occurrence Illustrator bug, left AI open, went to a different app that uses mouse+modifier (Ctrl+Click). That different app recognizes Ctrl+Click with no problems whatsoever.

    Thanks Guys,
    Good to know it's working for you. I guess that's the nature of intermittent bugs. Of course, Adobe's bug report form has a field for version, which I, of course, filled in. Sorry I didn't add it to this post. I'm using the latest version CS3 v13.0.2.
    Stephen,
    Sorry I was not more clear when I said, "For example, ...". I was talking about the modifier keys not working with several different tools. The Free Transform tool advertises functionality that is supposed to work with a "Click (down, but don't release)then hold down Ctrl" combination. The Rotate tool advertises a behavior that is supposed to work with an "Alt-Click" combination. These are just 2 examples of the modifier keys not working. I focused primarily on one example in the bug report(ctrl after and in addition to click in the free transform tool, not alt-click in the rotate tool).
    Here is what I expect(quoted from Adobe's CS3 help file)
    (From the "Distort Objects with the Free transform tool" help topic)
    "Select one or more objects.
    Select the Free Transform tool .
    Start dragging a corner handle on the bounding box (not a side handle), and then do one of the following:
    Hold down Ctrl (Windows) or Command (Mac OS) until the selection is at the desired level of distortion.
    Hold down Shift+Alt+Ctrl (Windows) or Shift+Option+Command (Mac OS) to distort in perspective."
    (from the "Rotate an object by a specific angle" help topic:)
    You can control the exact angle of rotation with the Rotate command.
    Select one or more objects.
    "Do one of the following:
    To rotate around the center point, choose Object > Transform > Rotate, or double-click the Rotate tool.
    To rotate around a different reference point, select the Rotate tool. Then Alt‑click (Windows) or Option‑click (Mac OS) where you want the reference point to be in the document window.
    Enter the rotation angle in the Angle text box...."
    These Tool based mouse-key combinations do occasionally work as they are supposed to, so I know what the expected results are supposed to look like, but whether they work or not appears to depend on the phase of the moon, the day of the week, and the color of the president's underwear.
    Other non-tool based mouse-key combinations in Illustrator work consistently all the time - Ctrl-A for Select All as just one example that always works.
    Thanks Again

  • Account modification key for movement type 643

    Hello Experts,
    I am reaching out to you today as I am in need of some info on Account assignment for Goods issue process. I looked at transaction OMWN or OMJJ for movement type based settings. I am running a business process ' Intercompany stock transfer order'. Goods issue movement on delivery reads 643(Goods issue for cross company), which is picking 'Account modification key' VAX.
    My requirement was how do I force system to pick VAY for 643 without overwriting VAX with VAY in OMWN transaction. Also there are several possibilities listed out for movement 643 alone. Appreciate if you could briefly tell me how system determines other parameters such as 1) Special stock indicator 2)Consumption posting 3) Value string & 4)Counter to determine 'Account modifier' in the customizing table V_156X_KO for Intercompany movement type 643.
    Additional info: Trigger is Stock tarnsfer order type NB. Subsequent process is VL10B for Delivery creation using type NLCC  and Intercompany invoice(IV) for shipping the goods to ordering company code. Then in the receiving company MIGO or goods receipt with reference to outbound delivery and fianlly MIRO or Invoice verification.
    Regards
    SG

    Valuation Structure
    Data on a material is valuated using the following structure:
      Valuation area
      Valuation class
      Valuation category
      Valuation type
      Material type
      Movement type
    Valuation Area
    Organizational level at which material valuation is carried out. You can define a valuation area as
    follows:
      Valuation area = company code
    All stocks of a particular material in this company code are valuated together.
      Valuation area = one plant
    The stocks of a particular material in this individual plant are valuated together. Stocks in
    other plants are not included in this valuation area.
    You define in Customizing the level at which valuation should take place.
    Valuation Class
    You group together different materials with similar properties into valuation classes so that you
    do not have to manage a separate stock account for every material.
    The following table contains examples of possible valuation classes:
    Valuation class Description
    3001 Colors
    3002 Paints
    3030 Operating supplies
    3100 Trading goods
    Which valuation class a material can be assigned to depends on the material type. You can
    define the following assignments in Customizing:
      All materials with the same material type are assigned to just one valuation class.
      Different materials with the same material type are assigned to different valuation classes.
      Materials with different material types are assigned to a single valuation class.
    MM - Material Price Change (MM-IV-MP) SAP AG
    Valuation Structure
    10 April 2001
    A material is assigned to a valuation class in the material master record. The system checks
    whether the material type allows the material to be assigned to the valuation class specified.
    The system refers to the valuation class of a material to determine which stock account to post to
    when a posting is made for this material.
    Valuation Category
    Criterion according to which split valuation is carried out:
      Procurement
    You can valuate a material differently depending on whether it is manufactured in-house
    or procured externally.
      Origin
    You can valuate a material differently depending on where it comes from (such as home
    or abroad).
      Status
    You can valuate a material differently depending on its status (such as new, used,
    repaired).
    You define the valuation categories in Customizing. A material is assigned a valuation category
    in the material master record.
    Valuation Type
    The valuation type specifies the individual characteristic of the valuation category, such as
    internal or external, in the case of Procurement. Within the valuation category Origin, you can
    define the different countries as the valuation types. You define valuation types in Customizing.
    You first determine all the valid valuation types for a valuation category.
    You define in the material master record which valuation types are allowed for a particular
    material. For every material subject to split valuation, you must enter all the valuation types
    allowed in the material master record.
    Material Type
    You assign every material to a material type when you create it. Examples of material types in
    the standard system include raw materials, operating supplies and finished products.
    The material type controls the properties of a material and which data must be maintained for the
    material. The following control features are important for valuation:
      Is the material managed by quantity?
      Is the material managed by value?
      Which price control type may be used for the material?
      Which valuation class can the material be assigned to?
    The system administrator can create or change material types in Customizing.
    Movement Type
    For every material movement, there is a movement type in the SAP System. The movement type
    controls the properties of the movement, for example, which entries you must make when
    SAP AG MM - Material Price Change (MM-IV-MP)
    Valuation Structure
    April 2001 11
    entering a material movement, and which updates are carried out when the movement is posted.
    The following control features are important for valuation:
      Does the material movement cause the quantity to be updated?
      Does the material movement cause the value to be updated?
      Does the material movement lead to postings in Accounting?
      Is the material movement relevant for LIFO/FIFO valuation?
    The system administrator can create or change movement types in Customizing.

  • After changing spaces, most keys stop registering

    I have a 5 year old Mac Pro running OS 10.6.8. I have spaces configured with four spaces, and the keyboard command to switch between spaces set as Ctrl-arrow. Most of the time this works as expected. However I've been having a periodic issue where, about once a week or so, I'll change spaces (Ctrl-arrow) and after it switches the new space, the four-panel HUD window that shows what space I'm on won't go away. Moreover, most characters I type on the keyboard will no longer register with the OS. Specifically, I if I type any letter, numbers, or other character, it won't register with any applications. I can however still type the keys Ctrl, Opt, Cmd, and the arrow keys. For example, when my computer is in this state, I can still type Ctrl-arrow and move to different spaces (with the HUD window staying up the entire time). But if I type any other keys, they never register. I.e. typing letters won't show up in a word document, typing Cmd-A (or anything else) won't do anything, etc. Even stranger, I can open up the Keyboard Viewer and see that all the keys that I'm typing (letters, numbers, etc.) are actually being displayed in the Keyboard Viewer correctly. So the key press is registering with the Keyboard Viewer, but isn't making it to the actual OS. I can even use my mouse to click individual keys in the Keyboard Viewer and, although the keys highlight in the Keyboard Viewer as expected, nothing is registered by the OS (the letters never get registered by any applications).
    Once my computer is in this state, my only option is to quit the Dock (using Activity Monitor), which restores my full functionality. (Note I discovered this "fix" by trial and error- I was restarting various parts of my system and noticed that this restored my functionality.) I can then work as normal in that space, Also, I can change spaces by selecting a different space using the icon in the menu bar, or by dragging a window to the edge of the screen. All of these actions will change the space without breaking anything. However as soon as I Ctrl-arrow to another space, it immediately breaks my ability to type. Quitting the Dock will again restore things. My Mac will stay in this state (where I can't use Ctrl-arrow to change spaces with breaking things ) until I reboot. After a reboot everything goes back to normal. Things will then be fine for a week or so (during that time I can Ctrl-arrow just fine), and then one day I'll be changing spaces using Ctrl-arrorw and the HUD will stay up and I'll be stuck again.
    When the actual breaking occurs (i.e. when I issue the Ctrl-arrow that breaks the functionality), nothing is being written to the Console. However when I quit the Dock, I see these lines, which may be related:
    11/3/11 4:43:09 PM          com.apple.launchd.peruser.501[223]          (com.apple.Dock.agent[58885]) Exited with exit code: 1
    11/3/11 4:43:09 PM          com.apple.Dock.agent[59232]          Error registering cmd-tab key, 1011
    11/3/11 4:43:09 PM          com.apple.Dock.agent[59232]          Error registering cmd-shift-tab key, 1011
    I've ben having this problem off and on for many months, through a few OS updates. I'm completely stumped what might be causing this. I've tried unplugging and replugging my keyboard to no avail. However I'm thinking it must be pretty low-level, since when it's in this state even directly clicking on the Keyboard Viewer keys doesn't get registered by the OS. Other than this problem, the Mac is completely trouble-free, so I don't think there's anything wrong with the hardware. I've tried to think if this problem is related to anything else that I'm doing on the system that might be triggering it, but I don't think there's anything unusual that I'm doing. When it's in this state I can quit every application and disable and re-enable spaces and it doesn't get me out of it- I need to quit the Dock and eventually reboot. Anyone have any ideas where to look for a solution?

    So I never figured out what causes this, although the frequency has dropped to about once a month. Note I'm still on 10.6.8. However I did figure out a bettery way to get back control of the keyboard. If I sleep the displays (Ctrl-Shift-Eject) and then wake the displays back up, the keyboard goes back to working fine. Evern better, changing spaces doesn't reignight the problem. So I'm good until it randomly occurrs again.
    Hope this helps someone else out there.

  • Multicamera keyboard shortcut keys stopped working

    PP 2014.0.1 release.
    My keyboard shortcut keys (standard: 0,1,2) were working, but they stopped working mid-edit. Restarting the application did not fix this. Mouse works - but what a crappy way to select a camera.
    Any suggestions?

    To answer my own question:
    I discovered that the Multicamera track in the timeline must be targeted (enabled in the track header in the timeline) or the keyboard shortcuts to select a camera do not work. (I don't know how my track became untargeted, but it did.)
    Although I understand how a keyboard shortcut will change the current clip in the multicamera sequence to the associated camera, the keyboard shortcut is strongly associated as input to the multicamera window, not the timeline. After all, I click on a camera view in the Multicamera program monitor to select that camera. I don't click in the timeline to do that. So It's not at all obvious that the multicamera track must be targeted for camera selection to work.
    I find it confusing.
    Do other users consider this a bug or good design?

  • Change Keyboard Layout, But Keep Language

    I have a MacBook with USA keyboard layout.
    While installing, by mistake i selected Latin American keyboard.
    Now, i want my language to still be "Spanish/Argentina", but they keyboard layout should be USA.
    How can i do that? Note that I don't want to have many input keyboards and then have to switch between latin and english language.

    I don't see an option to change "keyboard layout" only.
    Do you really not see the Tab called Input Menu under system preferences/international? There are boxes to check for keyboard layouts, and one is called US.
    Another Tab is called Language, and there you can put Spanish (actually Español) at the top to keep your OS in Spanish.
    Another Tab, in the middle, is called Formats.
    PS If you want to type Spanish with the US layout, you can use the Option/Alt key shortcuts. A list can be found here:
    http://homepage.mac.com/thgewecke/diacritics.html

  • Keyboard eject key delay, my feelings

    Here are my feelings about the fairly new feature of "keyboard eject key delay":
    I don't like it [ Edited by Host ]

    Apple changed it because many of us were absolutely sick of the tray opening when we did nothing but graze that key by accident. Now there are no more accidental tray openings...it's great !!!!!!!!!!!!!!! yay! woohooo!!!!!

  • Regarding modifer keys not working: stupid question

    Hi apple community!
    I have recently upgraded to snow leopard.
    My question is regarding this topic
    http://discussions.info.apple.com/message.jspa?messageID=10567379
    Since it is locked, I cannot post it in there. So I will ask here,
    How in the world can I change the modifier keys if I disconnected my mouse? I tried tabbing to the dropdowns and selecting the new keys via the keyboard but it doesn't work.
    I really appreciate if someone can take the 15 seconds to show me the obvious.
    Thanks!

    System Preferences>Universal Access>Mouse: turn 'Mouse keys' on. Use the keyboard to move the mouse as detailed in this tech note:
    http://docs.info.apple.com/article.html?path=Mac/10.5/en/cdb_moskys.html

Maybe you are looking for

  • Table Control in ITS is getting wrongly displayed

    Hi All, I Have developed a program(say abc) and created a screen for that program(abc). My issue is that,i have kept the table control in the box . When i execute the screen in se80 under the program(abc) ,its displaying properly ( i mean table contr

  • ~messageline.dim always 1, even when more than 1 message generated in ABAP

    Can anyone help explain how the ITS ~messageline gets populated. In my transaction I am creating a number of warning messages. However, the ITS is only displaying 1 each time. I am using the following code, but ~messageline.dim is always 1. `repeat w

  • Can't sync photos to my PC running Windows 7

    I have a Windows PC running Windows 7. I used to  be able to sync photos from my iPhone 3GS through iTunes, but now I can't get the photos to sync. When I used to connect my iPhone, I used to get a prompt to download the photos to a new folder in Win

  • Help in the abap code

    hi folks, I am checking for various condition types through this code for various orders. Each order has a different set of condition records. My requirement: when a order has a condition record for the condition type 'ZAGR' (AGREED PRICE) it should

  • No effect of setting Expiry in the RequesterManagerWorkflow

    Hi All, I needed to set the request expiry time for the request that would be raised through a user. I use the RequesterManagerWorkflow and have changed it myself. I simply opened it in JDeveloper after unzipping. Edited the approval.task task and in