How to run termonal command from withon omnis

Doug Easterbrook doug at artsman.com
Tue Jun 14 22:37:36 UTC 2022


hi Terrence.

funny you should ask…. I just beat my head a little on trying to run get finder to unzip a file on the M1 mac.   its been runing fine all the way to Mojave (on intel). but Mojave on M1 mac understood how to do it.   it just have an error on the zip aarchive.

so, last night I rewrote the applescript call to use ditto instead.

thats not really germaine to what you are doing..     but here’s my code



here’s the actual method

Switch sys(6)
Case 'W',’N'
  breakpoint - no shell scripts on windows
Case 'X','M' ## OS X or OS9.   (don't thing we'll be running in OS 9, but never know)
# using full shell command .. like
# do shell script "unzip /Users/administrator/Library/Preferences/TheatreManager/TMSetup10.07.254.zip TheatreManager.pkg -d /Users/administrator/Library/Preferences/TheatreManager"
Calculate applescript as con('do shell script "',pShellCommand,'"') ## pass full shell command and preappend with 'do shell script'
Do method $doApplescript (applescript,results) Returns #F
Quit method not(#F) ## 0=success, 1=falilure

Default ## unix or solaris.  Don't know what to do
Quit method kFalse
End Switch



here’s the calling method:

Calculate downloadPathname as '/Users/Bob/Desktop/MyZip.Zip’
Calculate downloadDirectory as '/Users/Bob/Desktop/’
Calculate shellScript as con('ditto -xk --noqtn ',downloadPathname,' ', downloadDirectory)
Do $cinst.$runShellScriptInAppleScript (shellScript) Returns #F



the ditto command is something that will run in terminal.    the command sort of looks like this when built

ditto -xk -- noqtn  /Users/Bob/Desktop/MyZip.zip   /Users/Bob/Desktop/



you could make a bash script and have that run if you give it the full path name to the .sh file.  that way you could run multiple commands in one shell script

eg, if the shell script is called.  bob.sh and is in /Users/Bob/Desktop

you could then calculate shellscript as    '/Users/Bob/Desktop/bob.sh'



hope that helps




Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 650-1978

> On Jun 14, 2022, at 12:10 PM, Terence Young <terry.young at journeymhc.org> wrote:
> 
> Hi,
> 
> I did some testing; I was able to get the following to work in 10.2..
> 
> 
> Do $runapplescript('say "Finished"')
> 
> 
> I will try to get the do shell script to work.
> 
> 
> Thanks for your help.
> 
> 
> terry
> 
> 
> 
> Terence J. Young, DC
> 
> System Administrator
> 
> IT
> 
> (608) 280-2679
> 
> ________________________________
> From: Terence Young <terry.young at journeymhc.org>
> Sent: Tuesday, June 14, 2022 1:51 PM
> To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
> Subject: Re: How to run termonal command from withon omnis
> 
> Hi,
> 
> thanks for the reply; but I am using Mojave and catalina.
> 
> Isn't applscript depreciated in the higher MACOSX versions?
> 
> I do not think I can use the $applescriot command in Omnis 10.2.
> 
> terry
> 
> 
> Terence J. Young, DC
> 
> System Administrator
> 
> IT
> 
> (608) 280-2679
> 
> ________________________________
> From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> on behalf of Andrew Stolarz <stolarz at gmail.com>
> Sent: Tuesday, June 14, 2022 12:48 PM
> To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
> Subject: Re: How to run termonal command from withon omnis
> 
> CAUTION: This email originated from outside Journey. Please verify the sender before opening attachments or clicking links.
> 
> 
> Terry,
> 
> You will need to run your commands via. Apple Script.
> 
> ie. Do $runapplescript()
> 
> here is a useful guide:
> https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/CallCommandLineUtilities.html
> 
> 
> We use it for all kinds of things and has been rock solid.
> 
> 
> Andrew
> 
> 
> On Tue, Jun 14, 2022 at 1:29 PM Terence Young <terry.young at journeymhc.org>
> wrote:
> 
>> Hi,
>> 
>> Is there a way to execue a terminal command from within Omnis on MacOsX.
>> 
>> Does anyone have an external to this?
>> 
>> terry
>> 
>> 
>> Terence J. Young, DC
>> 
>> System Administrator
>> 
>> IT
>> 
>> (608) 280-2679
>> 
>> If you received this e-mail in error, please notify the sender, delete the
>> e-mail, and do not use, disclose or store the information it contains. This
>> e-mail and any attachments may contain confidential information, including
>> records protected by WI Mental Health 51.30 and/or AODA federal
>> confidentiality rules (42 CFR Part 2) - both prohibit you from making any
>> further disclosure of this information unless further disclosure is
>> expressly permitted by the written consent of the person to whom it
>> pertains or as otherwise permitted by 51.30 or 42 CFR Part 2. A general
>> authorization for the release of medical or other information is NOT
>> sufficient for this purpose. Federal rules restrict any use of this
>> information to criminally investigate or prosecute any alcohol or drug
>> abuse client.
>> _____________________________________________________________
>> Manage your list subscriptions at https://lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
>> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
> If you received this e-mail in error, please notify the sender, delete the e-mail, and do not use, disclose or store the information it contains. This e-mail and any attachments may contain confidential information, including records protected by WI Mental Health 51.30 and/or AODA federal confidentiality rules (42 CFR Part 2) - both prohibit you from making any further disclosure of this information unless further disclosure is expressly permitted by the written consent of the person to whom it pertains or as otherwise permitted by 51.30 or 42 CFR Part 2. A general authorization for the release of medical or other information is NOT sufficient for this purpose. Federal rules restrict any use of this information to criminally investigate or prosecute any alcohol or drug abuse client.
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list