jamfHelper message cutting off text

luke_j_nelson
New Contributor II

I'm setting up a Self Service script to pop up a window displaying the hostname and IP addresses. Here's what I have:

#!/bin/bash

compname=`scutil --get ComputerName`

wifi_IP=`networksetup -getinfo Wi-Fi | grep "IP address" | head -n 1`
ethernet_IP=`networksetup -getinfo Ethernet | grep "IP address" | head -n 1`
thunderbolt_IP=`networksetup -getinfo Thunderbolt Ethernet | grep "IP address" | head -n 1`
display_IP=`networksetup -getinfo Display Ethernet | grep "IP address" | head -n 1`

if [[ `networksetup -listallnetworkservices | grep Wi-Fi` == "Wi-Fi" ]]; then
    wifimsg="Wireless $wifi_IP"
else
    wifimsg="--------"
fi

if [[ `networksetup -listallnetworkservices | grep -o Ethernet | head -n 1` == "Ethernet" ]]; then
    ethernetmsg="Ethernet $ethernet_IP"
else
    ethernetmsg="--------"
fi

if [[ `networksetup -listallnetworkservices | grep Thunderbolt Ethernet` == "Thunderbolt Ethernet" ]]; then
    thunderboltmsg="Thunderbolt Ethernet $thunderbolt_IP"
else
    thunderboltmsg="--------"
fi

if [[ `networksetup -listallnetworkservices | grep Display Ethernet` == "Display Ethernet" ]]; then
    displaymsg="Display Ethernet $display_IP"
else
    displaymsg="--------"
fi

Desc="Mac Hostname: $compname

$wifimsg $ethernetmsg $thunderboltmsg $displaymsg" MSG=$( echo "$Desc" ) /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -heading "Computer Information" -description "$MSG" -button1 "OK" exit 0

For some reason, I only see the first 2 -------- lines. displayMessage shows the full text, but I like the look of jamfHelper better.

Is there a limit to how big the jamfHelper dialog can be? I may resort to doing a displayMessage, or even an osascript display dialog.

4 REPLIES 4

mm2270
Legendary Contributor III

There is a limit to how much text jamfHelper can display and I've run into it before. I can't recall what the cutoff is though. How many lines or characters are you seeing in the message and how many are you expecting to see?

It could also be something in how your message variable is being set up. Sometimes some characters can cause it to think its hit the end of the text to display, but I haven't looked at your script closely enough to see if that's what's actually happening.

You may also want to look at cocoaDialog, as it has no such limits on how much text it can display and you can have even more precise control over the size and position of the dialog.

luke_j_nelson
New Contributor II

Thanks mm2270. I'm trying to get 6 lines to display. They aren't really that long. Once it gets to the 3rd line it seems to stop there. Here's what should display:

Mac Hostname: MyHostname
--------
--------
Ethernet IP address: ###.###.###.###
--------
--------

and the other lines would fill in with Wireless, Thunderbolt Ethernet, or Display Ethernet if they were connected.

Is cocoaDialog builtin to OS X? I'll take stab at that.

mm2270
Legendary Contributor III

No, cocoaDialog isn't built in, You'd have to grab it from the Github page and package and deploy it to your clients. We put ours in the same place as jamfHelper.app (/Library/Application Support/JAMF/bin) and can call it whenever we need with policy scripts or other functions.

Just FYI, I did a very quick test and looks to me like adding a heading in is what causes most of the other lines to get cut off. Without it I was just about able to get 6 lines to display, but there is definitely a fix height to any jamfHelper window, so you will run into it, no matter if a heading is there or not.

acdesigntech
Contributor II

+1 to cocoa dialog. I added it to our build sequence along with dockutil. I like jamfHelper but it is limited in how much text it can display, and button function, etc.