There is no TextEdit.app???

Andre Garzia andre at andregarzia.com
Tue Mar 22 06:36:10 EDT 2022


Bob,

Another way to check if an application is installed on a mac is by using AppleScript. Here are some functions that work together to check if TextEdit is installed.

function q txt
  return quote & txt & quote
end q

function isApplicationInstalledByBundleID pID
  put "try" & cr into tScript
  put "tell application " & q("Finder") & " to get application file id " & q(pID) & cr after tScript
  put "return true" & cr after tScript
  put "on error" & cr after tScript
  put "return false" & cr after tScript
  put "end try" & cr after tScript

  do tScript as “applescript"

  if the result is "{true}” then
    return true
  else
    return false
  end if
end isApplicationInstalledByBundleID

function isTextEditInstalled
  return isApplicationInstalledByBundleID("com.apple.TextEdit")
end isTextEditInstalled



> On 21 Mar 2022, at 22:58, Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> I have the following in a script, and it does not seem to be able to find the TextEdit.app application on a Mac! 
> 
>   put "/Applications/TextEdit.app" into tTextEditorPath
>   if there is a folder tTextEditorPath  then 
>         put true into tValidPath
>   end if
> 
>   if tValidPath is false then 
>      put empty into tTextEditorPath
>   end if
> 
> That cannot be right. 
> 
> MacOS Catalina 10.15.7 LC 9.6.7 lc2. 
> 
> Bob S
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list