• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Where can I place the Subroutines?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Where can I place the Subroutines?


  • Subject: Where can I place the Subroutines?
  • From: Fabiano Dias Ferreira <email@hidden>
  • Date: Mon, 09 Nov 2009 11:18:33 -0200
  • Thread-topic: Where can I place the Subroutines?

Title: Where can I place the Subroutines?
   Good day. I was trying to follow the instructions inside the old Automator tutorial Applescript.pdf and couldn't decipher were to place the subroutines inside the AppleScript Code. It is another prove that old documents and old versions can be usefull, you just need to solve the old to new interface jigsaw puzzles and the changes inside the library.

    All stuff is working good. But the code is not performing the "Get the number or percentage of items appropriately"

    Here is the code:

on run {input, parameters}
    set the output_items to {}
    if input is not {} then
       if the class of the input is list then
           set the number_method to (|numberMethod| of parameters) as integer
           set the number_to_choose to (|numberToChoose| of parameters) as integer
           if number_method is 1 then
               set the number_to_choose to my convert_percentage_to_number(number_to_choose, count of the input)
            end if
           repeat with i from 1 to the number_to_choose
                set the end of the output_items to some item of the input
            end repeat
       else
           set the output_items to the input
        end if
   end if
   return output_items
end run

SUBROUTINE

on convert_percentage_to_number(this_percentage, this_total)
    return (this_percentage * this_total) div 100
end convert_percentage_to_number

on localized_string(key_string)
    return localized string key_string in bundle with identifier "com.apple.AutomatorExamples.Pass_Random_Items"
end localized_string

    
Please, I just did command C and V from Xcode. Don't bother me because the code is Magenta and not Blue. I tried to move the subroutine inside the ON RUN code. Did not work. Maybe I didn't place it inside the correct line...

Thank you for the patience and time spent on this list

Digger
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Workflow fails to run as application but run from Automator
  • Next by Date: [ANN] Script Timer 2.6.2 released by Apps & More Software Design
  • Previous by thread: Workflow fails to run as application but run from Automator
  • Next by thread: [ANN] Script Timer 2.6.2 released by Apps & More Software Design
  • Index(es):
    • Date
    • Thread