سؤال

وأنا أحاول على وصول الإشارة كاملة لخلية في ابليسكريبت. حتى الآن لقد تمكنت من الحصول على مرجع خلية والإشارة الجدول باستخدام برنامج نصي مثل:

tell application "Numbers"
tell document 1
repeat with i from 1 to count of sheets
tell sheet i
repeat with j from 1 to count of tables
tell table j
try
set currentCell to the first cell of the selection range
return name of currentCell
end try
end tell
end repeat
end tell
end repeat
end tell
end tell

وأنا لا يمكن أن يبدو للحصول على نفس هيكل للعمل من أجل الحصول على ورقة أو وثيقة مرجعية. لقد حاولت الوصول إلى خصائص الخلية وأحصل على شيء من هذا القبيل:

{column:column "A" of table "Table 1" of sheet "Sheet 1" of document "Untitled" of
 application "Numbers", alignment:center, value:0.0, background color:{59111, 59111, 
59111}, text color:{0, 0, 0}, font size:10.0, vertical alignment:top, name:"A1",
 class:cell, font name:"HelveticaNeue", format:automatic, row:row "1" of table "Table
 1" of sheet "Sheet 1" of document "Untitled" of application "Numbers", text 
wrap:true}

والخاصية عمود من خلية وبالتالي يبدو أن تشمل الإشارة كاملة ولكن إذا كنت الوصول إلى إشارة مباشرة من خلال الخاصية العمود. يمكن لأي شخص أن تعطيني بعض الإرشادات لكيفية أحصل على ابليسكريبت ورقة ومستند باستخدام.

وهتاف

وإيان

هل كانت مفيدة؟

المحلول

وجدت الحل، بسيطة إلى حد ما طالما هو رمز بالترتيب الصحيح:

tell application "Numbers"
tell document 1
    repeat with i from 1 to count of sheets
        tell sheet i
            repeat with j from 1 to count of tables
                try
                    tell table j
                        set currentCell to the first cell of the selection range
                        set therow to row of currentCell
                        set sheetNumber to i
                    end tell
                end try
            end repeat
        end tell
    end repeat
    return name of sheet sheetNumber
end tell
end tell

ويمكن استخدام رمز مشابهة للتحقق من رقم المستند

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top