sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Mac32API.so ?

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 4 Posters 973 Views 4 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
      tomasz
      last edited by Gábor

      Hi all,
      Is there a library for MAC that could help us find an instance of an application window, its size, position, bring it to front, etc. on a MAC? All this can be done on a PC through Win32API.so. Is there something similar on MAC?

      Tomasz

      Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        I have this OSX 'code snippet' from somewhere - perhaps there's something you can extract from it...

        
         struct kinfo_proc *result, *ptr;
         int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0 };
         size_t length, i;
         result = NULL;
         length = 0;
         if (sysctl((int *) name,(sizeof(name) / sizeof(*name)) - 1,NULL,&length,NULL,0) == -1)
           { /* error */ };
          if ((result = (kinfo_proc *) malloc(length)) == NULL)
           { /* error */ };
          if (sysctl((int *) name,(sizeof(name) / sizeof(*name)) - 1,result,&length,NULL,0) == -1)
           { /* error */ };
         for (i = 0, ptr = result; (i < (length / sizeof(kinfo_proc)); ++i, ++ptr)
           {
             // ptr->kp_proc.p_pid contains the pid
             // ptr->kp_proc.p_comm contains the name
           }
         free(result);
        

        âť“

        TIG

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          @TIG .. looks like C code to enumerate the processes returning pid and name. Similar to MS tlist.exe utility on Windows.

          @Tomasz .. There are two libraries on Mac: Cocoa and Carbon, there are Ruby 'interfaces' to them.
          I've seen Ruby code that had "require 'Cocoa'" or similar at the top.
          The calls are not the same as Win32 (naturally.) The Apple Developer website has information. The problem is finding what you need in all that information.

          ADD: Apple Developer Cocoa Reference

          I'm not here much anymore.

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

            @ Dan - I will investigate Cocoa.
            @ Tig - Thanks for the C snippet.

            Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

            1 Reply Last reply Reply Quote 0
            • J Offline
              Jim
              last edited by

              Here's some related info:

              http://forums.sketchucation.com/viewtopic.php?p=66969#p66969

              Hi

              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