At random times, the top bar is not showing.
Did you see that?
Are you running that from an app?
Just playing with code in SD 6.0 (on Yosemite).
As we are talking about running the script from an app:
I have inserted the code for the dialog in my precedent post in a script that imports a text box from Indesign to Powerpoint.
The script is launched with a shortcut from FastScript while PPT is the frontmost application.
The icon displayed in the dialog is the FastScriptâs one.
Canât we have the PPT icon instead (I mean the one from the current app)?
You can use pretty much any image you like. Just insert code like this:
set anImage to current application's NSImage's alloc()'s initWithContentsOfFile:pathToSomeImage
theAlert's setIcon:anImage
Iâm lost.
How to get the current appâs icon?
Where must go your two lines of code
The script below triggers this error:
NSImage does not understand the message « alloc »
[code]use AppleScript version "2.4"
use scripting additions
use script âDialog Toolkitâ version â2.0â
property NSImage : class âNSImageâ
set pathToSomeImage to POSIX path of "LaCie 1:Icones en cours:âąâąApps Diversesâąâą:PPT3.icns"
set anImage to current applicationâs NSImageâs alloc()'s initWithContentsOfFile:pathToSomeImage
theAlertâs setIcon:anImage
set alertText to "Veuillez régler le comportement du bloc de texte."
set alertMess to âLes marges intĂ©rieures seront supprimĂ©es.â & return
set {check1, theTop, newWidth} to create checkbox âRenvoyer le texte Ă la ligneâ left inset 120 bottom 0 max width 400 without initial state
set {check2, label2, theTop, newWidth} to create labeled checkbox âAjuster le bloc au texteâ left inset 0 bottom (theTop + 8) max width 400 label text âOptionsâ checkbox left 120 without initial state
set {popup3, label3, theTop} to create labeled popup {âHautâ, âMilieuâ, âBasâ} left inset 0 bottom (theTop + 8) popup width 180 max width 400 label text âAlignement verticalâ popup left 120
set allControls to {check1, label2, check2, label3, popup3}
set {buttonName, suppressedState, controlsResults} to display enhanced alert alertText message alertMess as informational alert buttons {âAideâ, âAnnulerâ, âOKâ} giving up after 120 acc view width 400 acc view height theTop acc view controls allControls without suppression
if buttonName = âAnnulerâ then return[/code]
My understanding is that you must add the instruction :
use framework "Foundation"
at the beginning of your script.
I canât guarantee because, if the instruction :
set anImage to current applicationâs NSImageâs alloc()'s initWithContentsOfFile:pathToSomeImage
is correctly executed, the script fails to execute the instruction :
theAlertâs setIcon:anImage
with the message : error âLa variable theAlert nâest pas dĂ©finie.â number -2753 from âtheAlertâ
It seems that the instruction : property NSImage : class âNSImageâ is not required.
Yvan KOENIG running El Capitan 10.11.6 in French (VALLAURIS, France) samedi 23 juillet 2016 11:37:01
Sorry, I wasnât clear â youâd need to make that change to the library itself, within the main handler.
But unless youâre happy doing that, Iâm afraid the answer is that youâre out of luck. One of the things with interfaces is that there are so many options, if you add them all it becomes much more complex to use.
Iâll keep the option in mind for future versions.
The original question about toolbar visibility is not really related to Dialog Toolkit. I donât use that, and I just saw the same issue. Quit and relaunch fixed it.
I spent a few minutes trying to reproduce it based on what I had been doing, but could not. Possibly random.
Edit: I assumed the original question meant to say tab bar, but maybe something else was intended. Either way, I just had a situation where the tab bar didnât appear, even though multiple tabs were open. I could switch tabs via keyboard or Window menu, but there was no tab bar visible, and the menu item âHide Tab Barâ was disabled so I couldnât toggle it.
Matt, Itâs just about the bar you see at top the the alert window. Like this one:
In my previous post, you can see thereâs no such barâŠ