on subinsert_(sender)
tell application "AppleScript Editor"
activate
set valscptsel to (contents of selection)
if valscptsel is not "" then
tell application "Dialog Maker" to activate
winwarning's makeKeyAndOrderFront_(sender)
else
subgo("no")
end if
end tell
followed by
on subgo(valcopy)
try
winwarning's performClose_(sender)
end try
set valtext to (valwintext's |string|() as string)
if (valwinent's intValue()) is 0 then
set valent to " default answer \""
set valentdef to (valwinentdef's stringValue() as string)
if (valwinentsec's intValue()) is 0 then
set valentsec to "\" with hidden answer"
else
set valentsec to "\""
end if
else
set valent to ""
set valentdef to ""
set valentsec to ""
end if
if (valwinbut's intValue()) is 0 then
set valbut to " buttons {\"" & (valwinbut1's stringValue()) & "\"}"
if (valwinbut2chk's intValue()) is 1 then
set valbut to " buttons {\"" & (valwinbut1's stringValue()) & "\",\"" & (valwinbut2's stringValue()) & "\"}"
if (valwinbut3chk's intValue()) is 1 then
set valbut to " buttons {\"" & (valwinbut1's stringValue()) & "\",\"" & (valwinbut2's stringValue()) & "\",\"" & (valwinbut3's stringValue()) & "\"}"
end if
end if
else
set valbut to ""
end if
if (valwinbutdef's indexOfSelectedItem()) is 0 then
set valbutdef to ""
else
set valbutdef to " default button " & (valwinbutdef's indexOfSelectedItem())
end if
if (valwinbutcal's indexOfSelectedItem()) is 0 then
set valbutcal to ""
else
if (valwinbutcal's titleOfSelectedItem() as string) is "OK" then
set valbutcal to " cancel button 2"
else
set valbutcal to " cancel button " & (valwinbutcal's indexOfSelectedItem())
end if
end if
if (valwintit's intValue()) is 0 then
if (valwintitchs's intValue()) is 0 then
set valtit to " with title \"" & (valwintitnam's stringValue()) & "\""
else
set valscptnam to (get the name of the front window of application "AppleScript Editor")
set valtit to " with title \"" & valscptnam & "\""
end if
else
set valtit to ""
end if
tell application "AppleScript Editor"
activate
set valdialog to "display dialog \"" & valtext & "\"" & valent & valentdef & valentsec & valbut & valbutdef & valbutcal & valtit --& valicon & valtmout
(*if valcopy is "yes" then
set the clipboard to valdialog
else*)
tell application "System Events"
keystroke valdialog
end tell
--end if
end tell
tell application "Dialog Maker" to activate
end subgo
doesn’t work even with the valcopy if statement commented out but if you put the exact same contents of subgo inside the subinsert rather than calling subgo it works
the error is