On May 5, 2018, at 2:00 PM, Jody Bevan wrote:

> In a Multi Developer environment none of the developers sign in as the 
> ‘Designer’ user. We have a group that has access to the Design environment. 
> We then put developers into this group.
> 
> Therefore, when working on the system none of us have access to the Runtime 
> Explorer. Sometimes that could be very helpful.
> 
> How do others with multiple designers get around this issue?

I also have a project where I work using 4D Team Developer and I also miss the 
ability to access the Runtime Explorer. I wish 4D would change this and allow 
any user that has access to the Design Environment to use the Runtime Explorer. 
Maybe someday that will happen.

John DeSoi had an interesting workarounds to make this possible. So I took 
John’s idea and adapted it to make it work with macOS 10.13 and with 4D v16. 

With security settings in macOS you need to add the “System Events” application 
to System Preferences -> Security & Privacy -> Privacy. This will let 
AppleScript control applications on your computer. “System Events” is located 
in "/System/Library/CoreServices/“.

Now when you need to open the Runtime Explorer, just run this method:

  // ===========================================
  // PROJECT METHOD: 1 Show Runtime Explorer

  // PARAMETERS: none

  // DESCRIPTION: This is a developer tool that will display the
  // Runtime Explorer when running 4D Team Developer and users
 // are not connected as “Designer” but as another 4D user.

  // The method uses tricks and ideas from the iNUG discussion 
  // started by Jody Bevin. John DeSoi developed this method of
  // allowing the Runtime Explorer to be display by any user.
  // The trick it to temporarily sign in as Designer, get the Runtime
  // Explorer window open and then switch back to the original
  // 4D user account. I had to adapt it to make it work with macOS 10.13.

  // This will only work on macOS because it uses AppleScript
  // to post system events.

  // In order for this to work, you need to add "System Events" application
  // to System Preferences -> Security & Privacy -> Privacy
  // This will allow AppleScript to control programs on your computer.

  // "System Events" is located in /System/Library/CoreServices/

  // CREATED BY: Tim Nevels, Innovative Solutions ©2018
  // DATE: 5/5/18
  // LAST MODIFIED: 
  // ============================================

  // declare local variables
C_TEXT($currentUser_t;$applicationName_t;$command_t;$inputStream_t;$outputStream_t;$errorStream_t)

  // check if running on macOS
If (<>MacOS_b)
        
          // get current user
        $currentUser_t:=Current user
        
          // Switch to Designer user
        CHANGE CURRENT USER("Designer”;”*******")
        
          // let 4D breath a little
        DELAY PROCESS(Current process;10)
        
          // get current 4D application name
        $applicationName_t:=utl_Path_GetFileName (Application file)
        $applicationName_t:=Replace string($applicationName_t;".app";"")
        
          // build AppleScript to post system event Command-Shift-F9 to 4D
        $command_t:="osascript"+\
        " -e 'tell application \"System Events\"'"+\
        " -e 'tell application \""+$applicationName_t+"\" to activate'"+\
        " -e 'key code 101 using {shift down, command down}'"+\
        " -e 'end tell'"
        
          // run AppleScript
        LAUNCH EXTERNAL 
PROCESS($command_t;$inputStream_t;$outputStream_t;$errorStream_t)
        If ($errorStream_t#"")  // problems
                TRACE
        End if 
        
          // let 4D breath a little
        DELAY PROCESS(Current process;10)
        
          // set current user back to original value
        CHANGE CURRENT USER($currentUser_t;”********")
        
Else 
        ALERT("Sorry, this developer tool currently only works on macOS.")
End if 

Tim

*****************************************
Tim Nevels
Innovative Solutions
785-749-3444
timnev...@mac.com
*****************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to