• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
TRIGGERcmd
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

How to pass parameters on Mac?

Mac
2
5
582
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    Mike
    last edited by Aug 9, 2021, 5:18 AM

    Hi Russ, I saw your youtube video how you pass parameters with a batch file on Windows.
    You used the following script.

          start https://google.com/search?q=%1
    

    I want to do the same for Mac but I am stuck with the parameter part in Applescript

         on run {location, parameters}
    tell application "Google Chrome" to activate
    open location "https://www.google.com/search?q={param1}"
         end run
    

    Can you help me out?

    R 1 Reply Last reply Aug 10, 2021, 2:12 AM Reply Quote 0
    • R
      Russ @Mike
      last edited by Russ Aug 10, 2021, 2:14 AM Aug 10, 2021, 2:12 AM

      @Mike, this is how I did it:

      russ@russmac ~ % cat google.sh 
      open "https://google.com/search?q=$1"
      

      That's a bash script. If you want me to figure out how to do it with apple script let me know.

      In a bash script, $1 is the first parameter.

      Russell VanderMey

      M 1 Reply Last reply Aug 10, 2021, 5:11 AM Reply Quote 0
      • M
        Mike @Russ
        last edited by Aug 10, 2021, 5:11 AM

        @Russ Thank you. Just to clarify. cat google.sh is to call script?
        This goes to the .sh file? > open "https://google.com/search?q=$1"
        What do I enter in the TriggerCMD GUI Command Editor?
        Sorry, I am a total noob when it comes to bash, I only know applescript. 😞

        1 Reply Last reply Reply Quote 0
        • M
          Mike
          last edited by Aug 10, 2021, 5:30 AM

          @Russ all good, I had to do a chmod 700 of the .sh file to convert it to an Unix executable. and added #!/bin/bash to the script. Now it works beautifully!

          R 1 Reply Last reply Aug 10, 2021, 12:23 PM Reply Quote 1
          • R
            Russ @Mike
            last edited by Aug 10, 2021, 12:23 PM

            @Mike, good, I'm glad you knew to do that. I forget to tell people to change the permissions on bash scripts to make them executable.

            Russell VanderMey

            1 Reply Last reply Reply Quote 0
            • T tuicemen moved this topic from Instructions on Jan 31, 2022, 12:14 PM
            5 out of 5
            • First post
              5/5
              Last post