Same AppleScript code works in ScriptEditor and Script Debugger 7, but doesn't work in KM macro

Please see the attachment file. I use AS to grab the position of the UI element.

tell row 3
    set pRow to position
end tell
set xposn to (item 1 of pRow)
set yposn to (item 2 of pRow)

This works in SE and SD7, but doesn't work in KM macro.
If I run

return pRow

the output is something like:
{1024
640}
I don't know why it's not like {1024, 640} or {1024\r640}

I use these code

set oriP to oriP as text
set AppleScript's text item delimiters to "
"
set neworiP to every text item of oriP
set AppleScript's text item delimiters to ""
set oriX to ( item 1 of neworiP)
set oriY to ( item 2 of neworiP)

Doesn't work. Hope someone help me!
nH toggle selections in Favorites and Devices v1 down_Backup_20200312_1755_v0.kmmacros (6.8 KB)

Somehow I’m unable to reproduce the issue.

Assuming that this a valid minimal example…

tell application "System Events"
	tell application process "Finder"
		tell outline 1 of scroll area 1 of splitter group 1 of front window
			tell row 3 to set pRow to position
		end tell
	end tell
end tell
return pRow

…I get the following results:

  • AppleScript (run in SE or SD): the list {1145, 532}
  • AppleScript action in KM: the string 1145, 532

This is as expected. I do not get

{1145
532}

in KM.


MWE for AppleScript position list <9F3F 200312T171718>.kmmacros (2.0 KB)

1 Like

Thanks for reply. Please the attachment file. In my original KMM, I use mousetools and python to move the cursor and click. I think the trouble is related to them. Now I use KMM to move the cursor and click. It works OK. But now I have another question

input:
positionA {500, 500}
positionCorrection {100, -100}
Desired output:
newPosition {600, 400}

How can I achieve this kind of calculation in KM?
I use set Variable to calculation macro:
set newPosition to

%Calculate%positionA + positionCorrection%

But failed.
nH toggle selections in Favorites and Devices v1 down_Backup_20200313_1325_v0.kmmacros (8.5 KB)