sketchucation logo sketchucation
    • Login
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Keyboard translation PC / Mac

    Scheduled Pinned Locked Moved Developers' Forum
    11 Posts 3 Posters 1.6k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      todd burch
      last edited by

      Several keys are already defined as constants. List all the constants belonging to the Object class like this:

      Object.constants

      (They should have been defined in the SketchUp module).

      All the contants relating to the keyboard start with VK_.... (virtual key).

      I have both platforms. I'll make a list.

      Todd

      1 Reply Last reply Reply Quote 0
      • fredo6F Offline
        fredo6
        last edited by

        Thanks very much in advance Todd.

        On my Windows XP laptop, I have this:

        On the platform
        PLATFORM = i386-mswin32
        RELEASE_DATE = 2003-08-04
        RUBY_PLATFORM = i386-mswin32
        RUBY_RELEASE_DATE = 2003-08-04
        RUBY_VERSION = 1.8.0
        VERSION = 1.8.0

        On the Keyboard
        ALT_MODIFIER_KEY = 18
        ALT_MODIFIER_MASK = 32
        CONSTRAIN_MODIFIER_KEY = 16
        CONSTRAIN_MODIFIER_MASK = 4
        COPY_MODIFIER_KEY = 17
        COPY_MODIFIER_MASK = 8

        VK_ALT = 18
        VK_COMMAND = 18
        VK_CONTROL = 17
        VK_DELETE = 46
        VK_DOWN = 40
        VK_END = 35
        VK_HOME = 36
        VK_INSERT = 45
        VK_LEFT = 37
        VK_MENU = 18
        VK_NEXT = 34
        VK_PRIOR = 33
        VK_RIGHT = 39
        VK_SHIFT = 16
        VK_SPACE = 32
        VK_UP = 38

        On the Mouse control
        MK_ALT = 32
        MK_COMMAND = 0
        MK_CONTROL = 8
        MK_LBUTTON = 1
        MK_MBUTTON = 16
        MK_RBUTTON = 2
        MK_SHIFT = 4

        Still no idea about the other keys on Mac, and the difference between the concept of CONSTRAIN_MODIFIER_MASK and CONSTRAIN_MODIFIER_KEY.

        1 Reply Last reply Reply Quote 0
        • T Offline
          todd burch
          last edited by

          Hey Fred. If you want this fast, do this:

          Write a script that prompts for all the keys on the keyboard to be entered, and I'll run it and send you the output. Otherwise, you get to wait for me to write this script to produce the report.

          Note the some keys, like PAGE DOWN, don't produce scan codes in SketchUp, so don't prompt for those. And, a MAc as CONTROL, ALT and COMMAND, whereas PC do't have COMMAND. (the COMMAND key on a mac is generally used like CONTROL on a PC, and the CONTROL key on a Mac isn't used that much.

          Check out the cheat sheet (Reference Card) for keyboard shortcuts to compare how keys are interchanged, so you can conform to that interface methodology.

          Todd

          1 Reply Last reply Reply Quote 0
          • fredo6F Offline
            fredo6
            last edited by

            Todd,

            Thanks for the offer.
            Here is the script KeysForMac.rb. It adds a menu item "Prompt for Mac keys" in the Plugins menu. When you invoke it, you will be notified on which key to type in the Status bar. The test takes less than 3 minutes.

            It normally generates a small text file KeysForMac.txt, which normally should end up in your folder equivalent on MAc to C:\Program Files\Google\Google SketchUp 6. Actually I just open the file with no directory reference, because this is another potentialproblem on Mac.

            	fname = "KeysforMac.txt"
            	f = File.new fname, "w"
            
            

            Talking about Directory and file paths on Mac, I have another problem with my method to find script files in the Plugins Directory. On Windows, I use the following statements:

            BZ___DirSU = Sketchup.find_support_file ".", "."
            BZ___SearchDir = Dir["#{BZ___DirSU}/Plugins/BZ__*.rb"]
            
            

            But it does not seem to work. Maybe you can find out what I should use instead on Mac.

            Again many thanks for your proposal.

            @unknownuser said:

            Example of file generated (here on Windows XP)
            http://www.sketchucation.com/forums/scf/sas/Ruby/KeysforMac.txt

            Small macros for capturing keys.
            To dropin Plugins folder
            http://www.sketchucation.com/forums/scf/sas/Ruby/KeysforMac.rb

            Fredo

            1 Reply Last reply Reply Quote 0
            • tbdT Offline
              tbd
              last edited by

              how about using Sketchup.find_support_file "Plugins" and then File.join(Plugins_dir, filename) ?

              SketchUp Ruby Consultant | Podium 1.x developer
              http://plugins.ro

              1 Reply Last reply Reply Quote 0
              • fredo6F Offline
                fredo6
                last edited by

                @unknownuser said:

                how about using Sketchup.find_support_file "Plugins" and then File.join(Plugins_dir, filename) ?

                This works on Windows as well.
                My problem is know whether this works on Mac, since I have no Mac and I have not even seen Sketchup running on a Mac!!

                Are you Mac User? If so,could you just cnfirm this works fine? Thanks in advance.

                1 Reply Last reply Reply Quote 0
                • tbdT Offline
                  tbd
                  last edited by

                  sometimes (have a Powerbook G4), but this is what I used in my TimeTrack plugin and it worked for Mac users.

                  SketchUp Ruby Consultant | Podium 1.x developer
                  http://plugins.ro

                  1 Reply Last reply Reply Quote 0
                  • fredo6F Offline
                    fredo6
                    last edited by

                    Thanks.
                    For the time being, I will follow your advice (and also use File.join instead of building the string with /

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      todd burch
                      last edited by

                      Here's my report. F12 is intercepted by the operating system, so don't plan on using that one. I simply pressed F6 instead twice (I ran the script twice - as I screwed it up the first time). Matter of fact, on the Mac, I would stay away from all the function keys completely.

                      Todd

                      301 Moved Permanently

                      favicon

                      (www.sketchucation.com)

                      1 Reply Last reply Reply Quote 0
                      • fredo6F Offline
                        fredo6
                        last edited by

                        Thanks very much Todd.

                        There are strange things on the Mac, like the fact that several keys (alphas and numpad) do nt seem to be trapped on the KeyDown, but only on the KeyUp event. This is also the case for Tab, Del and Backspace. This may be due to the VCB interference.

                        I'll see what I can do.

                        Thanks again

                        Fredo

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement