I am using CocoaDialog and a script to ask for asset tag information. Script works fine as long as it isn't launched from Self Service. Launching from self service launches however the text box doesn't allow me to type anything in it. Any ideas?
# Set CocoaDialog Location
# Dialog to enter the Asset Tag Information rv=($($CD standard-inputbox --title "L-Tag Importer" --no-newline --informative-text "Enter the L-Tag of the Company Owned System"))
# Set L-Tag using variable created above
/usr/sbin/jamf recon -assetTag $ASSETTAG
That might not be the issue after thinking about it further. You're saying the dialog appears but won't let you type into it? Doesn't sound like its not running as the user if so. If that was the issue it probably wouldn't even appear at all.
You might try throwing the --float flag into the CD command, as that makes it appear above all other windows. Maybe its not fully coming to the front, not sure. Based on the cocoaDialog executable name in your script, it looks like you're using the last stable release, and not the beta version? If so, the --float wasn't implied by default in that release. In one of the betas they made all CD windows float by default and you could flip that behavior by adding --no-float to the command.
For a simple prompt like this, I'd use AppleScript.. this may work:
#!/bin/sh ASSETTAG=$(osascript -e ' tell application "Finder" display dialog "Enter the L-Tag of the Company Owned System" default answer "" set ASSETTAG to the (text returned of the result) end tell') # Set L-Tag using variable created above /usr/sbin/jamf recon -assetTag $ASSETTAG # Exit exit 0