Applescript issue

I'm very confused, I have no issue with most of my AppleScript, but some are not running or giving a different result when started from Keyboard Maestro while I have no issue at all when I start them from Apple Script Editor

e.g this won't work from KM but have no issue from AppleScript Editor:

set internalID to "demo"

  tell application "System Events"
    tell process "My Internal app"
      -- gathering AppleID 
      set internalID to get value of static text 5 of scroll area 1 of group 1 of group 1 of group 1 of group 2 of splitter group 1 of window 1
    end tell
  end tell
on error
end try 

and this will give me a value but totally different (reading the value of a Plist, I double checked the value from the plist its self, and it's wrong)

  set the plistfile_path to "~/Desktop/_DATA.plist"
  tell application "System Events"
    set p_list to property list file (plistfile_path)
    -- read the plist data
    set theCaseIDFromPlist to value of property list item "internalID" of p_list
  end tell
end try

set the clipboard to theCaseIDFromPlist

Can you please tell me what I'm doing wrong here?

thank you

I just tested your second example (with a real-existing plist file on my disk) and I got the same correct result from both Script Editor and from KM.

So I think it would probably be a good idea to post the complete non-working macros.

Please post also the macros themselves, not only screenshots. (KM Editor > File > Export Macros).

I have revised your post to put all of your scripts in a Code Block. Please use Code Blocks in the future.

In order for us to help you, we need more information.

Please be much more specific about what "won't work".

  1. Exact error message
  2. Line where error occurred
  3. Expected result
  4. Actual result
  5. When UI scripting, show a screenshot of the area you are scripting.

Also, please use actual app name, rather than "My Internal app".