Skip to main content
Rollback to Revision 4
Source Link
user3439894
  • 59.8k
  • 10
  • 112
  • 135

Thus, my question is whether there’s a way for me to get "at most 5 results" in a single query?

No, it cannot be done in a single query.

If you want to loop through a given count downwards then the following example AppleScript code is how I'd do it:

set maxNumber to 5
set searchString to "a"

set matches to missing value
repeat with i from maxNumber to 1 by -1
    if matches is equal to missing value then
        try
            tell application "Notes"
                set matches to id of ¬
                    (notes 1 thru i in default account ¬
                        whose name contains searchString)
            end tell
        end try
        if matches is not equal to missing value then exit repeat
    end if
end repeat

return matches

Thus, my question is whether there’s a way for me to get "at most 5 results" in a single query?

No, it cannot be done in a single query.

If you want to loop through a given count downwards then the following example AppleScript code is how I'd do it:

set maxNumber to 5
set searchString to "a"

set matches to missing value
repeat with i from maxNumber to 1 by -1
    if matches is equal to missing value then
        try
            tell application "Notes"
                set matches to id of ¬
                    (notes 1 thru i in default account ¬
                        whose name contains searchString)
            end tell
        end try
    end if
end repeat

return matches

Thus, my question is whether there’s a way for me to get "at most 5 results" in a single query?

No, it cannot be done in a single query.

If you want to loop through a given count downwards then the following example AppleScript code is how I'd do it:

set maxNumber to 5
set searchString to "a"

set matches to missing value
repeat with i from maxNumber to 1 by -1
    if matches is equal to missing value then
        try
            tell application "Notes"
                set matches to id of ¬
                    (notes 1 thru i in default account ¬
                        whose name contains searchString)
            end tell
        end try
        if matches is not equal to missing value then exit repeat
    end if
end repeat

return matches
deleted 65 characters in body
Source Link
user3439894
  • 59.8k
  • 10
  • 112
  • 135

Thus, my question is whether there’s a way for me to get "at most 5 results" in a single query?

No, it cannot be done in a single query.

If you want to loop through a given count downwards then the following example AppleScript code is how I'd do it:

set maxNumber to 5
set searchString to "a"

set matches to missing value
repeat with i from maxNumber to 1 by -1
    if matches is equal to missing value then
        try
            tell application "Notes"
                set matches to id of ¬
                    (notes 1 thru i in default account ¬
                        whose name contains searchString)
            end tell
        end try
        if matches is not equal to missing value then exit repeat
    end if
end repeat

return matches

Thus, my question is whether there’s a way for me to get "at most 5 results" in a single query?

No, it cannot be done in a single query.

If you want to loop through a given count downwards then the following example AppleScript code is how I'd do it:

set maxNumber to 5
set searchString to "a"

set matches to missing value
repeat with i from maxNumber to 1 by -1
    if matches is equal to missing value then
        try
            tell application "Notes"
                set matches to id of ¬
                    (notes 1 thru i in default account ¬
                        whose name contains searchString)
            end tell
        end try
        if matches is not equal to missing value then exit repeat
    end if
end repeat

return matches

Thus, my question is whether there’s a way for me to get "at most 5 results" in a single query?

No, it cannot be done in a single query.

If you want to loop through a given count downwards then the following example AppleScript code is how I'd do it:

set maxNumber to 5
set searchString to "a"

set matches to missing value
repeat with i from maxNumber to 1 by -1
    if matches is equal to missing value then
        try
            tell application "Notes"
                set matches to id of ¬
                    (notes 1 thru i in default account ¬
                        whose name contains searchString)
            end tell
        end try
    end if
end repeat

return matches
added 61 characters in body
Source Link
user3439894
  • 59.8k
  • 10
  • 112
  • 135

Thus, my question is whether there’s a way for me to get "at most 5 results" in a single query?

No, it cannot be done in a single query.

If you want to loop through a given count downwards then the following example AppleScript code is how I'd do it:

set maxNumber to 5
set searchString to "a"

set matches to missing value
repeat with i from maxNumber to 1 by -1
    if matches is equal to missing value then
        try
            tell application "Notes"
                set matches to id of ¬
                    (notes 1 thru i in default account ¬
                        whose name contains searchString)
            end tell
        end try
        if matches is not equal to missing value then exit repeat
    end if
end repeat

return matches

Thus, my question is whether there’s a way for me to get "at most 5 results" in a single query?

No, it cannot be done in a single query.

If you want to loop through a given count downwards then the following example AppleScript code is how I'd do it:

set maxNumber to 5
set searchString to "a"

set matches to missing value
repeat with i from maxNumber to 1 by -1
    if matches is equal to missing value then
        try
            tell application "Notes"
                set matches to id of ¬
                    (notes 1 thru i in default account ¬
                        whose name contains searchString)
            end tell
        end try
    end if
end repeat

return matches

Thus, my question is whether there’s a way for me to get "at most 5 results" in a single query?

No, it cannot be done in a single query.

If you want to loop through a given count downwards then the following example AppleScript code is how I'd do it:

set maxNumber to 5
set searchString to "a"

set matches to missing value
repeat with i from maxNumber to 1 by -1
    if matches is equal to missing value then
        try
            tell application "Notes"
                set matches to id of ¬
                    (notes 1 thru i in default account ¬
                        whose name contains searchString)
            end tell
        end try
        if matches is not equal to missing value then exit repeat
    end if
end repeat

return matches
added 50 characters in body
Source Link
user3439894
  • 59.8k
  • 10
  • 112
  • 135
Loading
Post Undeleted by user3439894
added 78 characters in body
Source Link
user3439894
  • 59.8k
  • 10
  • 112
  • 135
Loading
Post Deleted by user3439894
Source Link
user3439894
  • 59.8k
  • 10
  • 112
  • 135
Loading