Identify Network Card Type by shell script.
Hi Everyone,
I am currently rolling out ML to about 300 Macs and as a side issue I need to identify the make and model of the network card in each machine, due to incompatibilty with some network switches.
Does anyone know how I can get the make and model of the network card by a shell script rather than having to visit each and every machine.
Regards
Chris
Thanks Linc,
That solved my issue. Far better than having to visit hundreds of machines spread over hundreds of kilometres.
Regards
Chris
Similar Messages
-
Determining if network is up from shell script?
Is there a way using a shell script to tell if unix thinks the network is up? I have a 3rd party PCMCIA wifi card that takes a few seconds to reconnect to the network on wake or boot (utility needs to launch and synch get established) and I'd like to trigger a script once it has reconnected. (I have no way of asking the card itself -- the driver/utility isn't scriptable.) It's clear someplace in unix knows it's not up right away because the logs show a few "network not up" (or something like that) messages for awhile (DNSResponder I believe may have been associated with some of them) right after the wakeup is logged. The GUI network status for the port (whether that'd be knowable from the shell or applescript or not) doesn't reflect that the connection isn't up -- it shows green for the port right away, presumably because the card itself is responding.
Ted Lee
Minnetonka, MNHere's a similar approach but waits for the specified interface to become active:
<pre style="padding-left: .75ex; padding-top: .25em; padding-bottom: .25em; margin-top: .5em; margin-bottom: .5em; margin-left: 1ex; max-width: 80ex; overflow: auto; font-size: 10px; font-family: Monaco, 'Courier New', Courier, monospace; color: #222; background: #eee; line-height: normal">#!/bin/sh
while [ "`ifconfig | sed -n '/^'$1'/,/^[a-z]/ s/.*status: \(.*\)$/\1/p'`" != "active" ]
do
echo interface $1 is not up
sleep .5
done
echo interface $1 is now UP
</pre>
Save it as ifup, make it executable, and call it with the name of your interface:
ifup en1
Cole -
How to run a shell script from the GUI?
This is probably a dumb question...
How do I run a shell script from the GUI? I've been told to double click it but when I do, it opens as a text file.The behavior you describe is that used by the KDE and GNOME desktops of Linux.
Under OS X, if you make a script then mark it as executable, double-clicking on it in the Finder will not execute it. Actually, it uses a rather complex algorithm ([summarized here|http://arstechnica.com/reviews/2q00/macos-qna/macos-x-qa-2.html]) to determine what to do with it. This is implemented in Mac OS X' LaunchServices framework (incidentally, the associations are cached in /Library/Caches/com.apple.LaunchServices*.csstore and ~/Library/Caches/com.apple/LaunchServices*.csstore). You can read the details in the developer docs about LaunchServices.
Anyway, in short, the suffix '.command' is a built-in type in the LaunchServices network that identifies a shell script. If you run
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/LaunchServic es.framework/Support/lsregister -dump
... it will tell you as much. -
hi all ,
can anyone explain me this script particularly why expect is used here.
set timeout -1
spawn sftp [email protected]
match_max 100000
expect -exact "Connecting to 11.11.1.34...\r
sftp> "
send -- "cd /opt/app/policies/data\r"
expect -exact "cd /opt/app/policies/data\r
sftp> "
send -- "get potcontrol.dat\r""expect" is a particularly useful scripting tool when you need to make a script that performs an interactive, multi-command dialog with another utility, like FTP or SFTP (or in the olden days, I used it a lot with Kermit).
In your example, "expect" is being used to launch the sftp client to connect to some sftp server, switch to a certain directory and then fetch a copy of a certain datafile, all while expecting precise return strings coming back from the sftp client.
Certain tools and apps, like ftp, sftp and others, cannot be simply scripted via ordinary shell script methods to feed strings of commands to those tools and apps, because of unusual ways in which they open up their own separate /dev/tty to interact with the command line user, hence "expect" was created and is very useful for scripting dialogs with such tools and apps.
For instance, if you tried to make a typical "here document" type of shell script like this:
#!/usr/bin/sh
ftp <<END_CMDS
open some.ftp.host
myuser
mypassword
cd /some/dir/path
get somefile.dat
bye
END_CMDS
exit 0
You'd find that a typical ftp client will not read the commands from the shell script's /dev/tty and will still try to interactively prompt for user, password, etc. or it might just hang indefinitely waiting for input that will never come to it.
There are other shell scripting tricks to get a "here document" script to function with utilities like ftp/sftp/others, but if you have "expect" installed on your system, it's very simple to run "autoexpect" to record an interactive session of what you want to do, which will then automatically create the "expect script" for you.
"Expect" was created by our (USA) tax dollars, and is free for anyone to use: See the home page here for the whole story: http://expect.nist.gov/ -
Can't enter shell scripts in Automator?
When adding the "Run Shell Script" action to a workflow in Automator, I can't actually type anything in the text box -- when I try to type something, I just get a bunch of seemingly random characters. Does anyone else see the same behaviour or is there just something funky going on with my two Macs?
I'm certain I'd be able to create a couple of services for encrypting/decrypting messages in Mail with GPG, if only I could actually type the shell script into AutomatorRedemption Code http://helpx.adobe.com/x-productkb/global/redemption-code-help.html
-
Wireless network (and a shell script for you guys, also)
I don't know the right way to bring up my wireless iface at bootup, so I wrote a small shell script to do it for me.
Feel free to use it if you find it useful..
I'd also appreciate someone telling me what *IS* the arch way of doing what my shell script's doing
#!/usr/bin/env bash
# Val Polyakov <[email protected]>
# 7/8/07
# Change these to reflect your network
PATH=/usr/sbin:/sbin:/bin
IFACE=ifaceNameOfYourWirelessCard
DRIVER=moduleNameForYourWirelessCard
SID=yourSID
ENCKEY=yourEncryptionKey
# Don't change anything beyond this point.
case "$1" in
start)
echo "Loading the wireless card driver"
modprobe $DRIVER
echo "Setting up the SID and encryption key"
iwconfig $IFACE essid $SID enc $ENCKEY
echo "Bringing up the wireless interface"
ifconfig $IFACE up
if [ -f /var/run/dhcpcd-$IFACE.pid ]
then
rm /var/run/dhcpcd-$IFACE.pid
fi
echo "Running the dhcp client"
dhcpcd $IFACE
stop)
echo "Bringing down the wireless interface"
ifconfig $IFACE down
echo "Unloading the driver"
rmmod $DRIVER
restart)
$0 stop
sleep 2
$0 start
echo "usage: $0 {start|stop|restart}"
esac
exit 0brain0 wrote:If your wireless drivers support wpa_supplicant, you could try autowifi from http://www.archlinux.org/~thomas/autowifi-svn/ It handles multiple wireless networks very well. There is no documentation right now, just read here: http://archlinux.org/pipermail/arch-dev … 00867.html
what would the benefit of that be, as compared to my script ?
the shell script i made (and pasted) works just fine, sits in /etc/rc.d and is called by /etc/rc.conf
i was just curious whats the official, i guess, way to do it with arch
since network profiles dont work for some reason, i figured i must be missing something.. -
Trying to run program off network location using GPO with Power shell script.
Hello All,
Not much of a script writer. I am giving it a shot. My issue is that I need to run a application update across our network and I am trying to do it with as little hands on as possible. So I was planning to push a GPO with a power shell script in it
to run the program with elevated privileges.
Little background:
We are running on a domain and end users do not have admin rights.
The application is stored on a share on our network that is open to all domain users.
The installer user name and password is a temp one and will only be valid for the 30 min window when everyone logs in at the beginning of the day.
So this is what I have so far.
$username = "USER"
$password = "PASSWORD"
$credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
Start-Process PSQLv11Patch_Client_x86.msp -Credential ($credentials) -WorkingDirectory \\Server\Folder\Folder1\Folder2\filder3\PSQLv11sp3_x32\
But for some reason I keep getting :
Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At line:10 char:1
+ Start-Process PSQLv11Patch_Client_x86.msp -Credential ($credentials) -WorkingDir ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
Any help you could give would be great.
Thanks,
jdfmonkeyHi jdfmonkey,
Has anyone provided an answer to your original question? I am trying to use Start-Process to launch a process using another logged in user's credentials, and am not able to get it working:
$cred=Get-Credential
start-process Process.exe-WorkingDirectoryC:\Scripts-Credential$cred
I get the same error that you mentioned:
start-process : This command cannot be run due to the error: The system cannot find the file specified.
At C:\Scripts\Process.ps1:2 char:1
+ start-process Process.exe -WorkingDirectory C:\Scripts -Credential ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
When I leave off the credentials:
start-processProcess.exe-WorkingDirectoryC:\Scripts
It works correctly. Does anyone have a solution to make this work correctly?
Please ask your own question. You issue is nothing like the current thread. You clearly are using a user account that has no access to the folder. It is a permissions issue. It is not a scripting issue.
If you need further help please start your own question.
¯\_(ツ)_/¯ -
How to build systemd script for usb network card?
My network card is usb0, is there any method to let systemd workable?
> Alternatively, you could use [email protected], but as with the above, you need to read about how it works first.
I've done by this method, but sometimes my usb card is not ready, then the boot sequence failed on the network connection.
> If you only want it when you plug the device in, write a udev rule.
I think I should change to use this method.
Is the add udev rule method still in
https://wiki.archlinux.org/index.php/Ud … ork_device
I'm afraid it should replaced by systemd method because I want when network connecting will trigger other systemd scripts enable. -
GPO/Script to change Network card priority In windows 7
I would like to have script or GPO change network card priority .
I would like to have LAN should over come WIFIHi,
Since there is no response from you, we considered that you have gotten what you want in previous post.
For further question, please don't hesitate to come back here and let's discuss again.
If you have any feedback on our support, please click here
Kate Li
TechNet Community Support -
Shell Scripting to replace file type
Hey all,
I'm having some trouble with a shell script. I'm trying to run a script that will look through all the folders in a given directory for a certain type of file (.data) and then will run a getfileinfo -t on the .data file and, if the type is "" (empty), replace it with a given string.
So far I can get the command to look through directories and I can get it to echo the getfileinfo -t, but I can't put the result of the command into a variable so I can check to see if it meets the "" condition. Any help would be greatly appreciated.
Also, I am doing this in CSH, but I am no opposed to doing it another way, just so long as it works.Hi JohnSka7,
I really like Niel's solution but it can be done in a script without AppleScript if you have Apple's Developer Tools installed. I don't do csh so I'll give it to you in bash and leave it as an exercise to translate:
#!/bin/bash
oldIFS=$IFS
IFS=$'\n'
for FILE in $( find "$1" -type f -name "*.data" ); do
IFS=$oldIFS
if [ \"\" = $( /Developer/Tools/GetFileInfo -t "$FILE" ) ]; then
/Developer/Tools/SetFile -t "XXXX" "$FILE"
fi
done
This temporarily sets the Input Field Separator, IFS, to a newline so that the snippet can handle filenames containing spaces. It assumes that the first argument to the script is the directory to be searched. Of course you should change "XXXX" to the type code you want and you can arrange for that to be specified in another argument. If you copy-and-paste this into a script, be sure to replace the non-breaking spaces I've used for indention with real spaces.
Gary
~~~~
Maslow's Maxim:
If the only tool you have is a hammer, you treat
everything like a nail. -
Thank you in advance for reading my post and for any help and advise..
I am on a friends computer because my Network Card went caput!.. now my computer can not detect my modem..
What happened?.. my surge protector did not protect my iMac during a thunder storm, and I have not been able to get online since.
I am almost sure now that my Network Card is the problem.. I have heard I will have to replace the entire board now! This could not have come at a worse time for me, so I am hoping and praying someone here will have a less expensive work around for me.
I am currently running a 700MHz G4 Flat Pannel with a DSL modem from Bell South. I was using my Ethernet input to get online, but, again, the modem can no longer be detected. This particular modem will not allow me to connect via USB either. If it did allow me to connect via USB, would that even work seeing how my network card is a wash?
Is there a way I can get another modem and use a USB or wireless something or the other to get my iMac back online without having to sell my arm and leg?
Sorry about the length of this post; I just want to make sure I cover as many bases as I can think of. Thank you again for any help; I really appreciate it! *april
iMac 15" Flat Pannel 700 MHz PowerPC G4 1GB SDRAM Mac OS X (10.3.9) i love my little bubble computerBRAD!.. we are two ships sailing in the same mirky water; please somebody light a flair or something! =P
I always thought these things happened to 'other' people.. REALLY stinks to be us right now.
I have been doing some more reading.. my friend was nice enough to let me borrow his computer for a little bit. However, I still have not come across a definitive answer for a proven Internet access alternative.
So far, I have read about one other option that MAY work.. What I really need to know is.. with a corrupt Network Card, is it even POSSIBLE to get online by ANY other means? Or does having a corrupt Network Card mean that it destroys ANY other way to get online without having to replace the entire board? Is the Network Card what enables us to get online, or does the Network Card just allow us to connect to the Internet via Ethernet cable alone? I still have not found an answer to these questions.
That said, I mentioned reading about another Internet connection solution. This other option involves buying what is called a wireless router and a wireless AirPort card. I think they have to be installed inside the hard shell?? So with these parts and service, I believe we are still looking at a ballpark of US$200. I wish somebody could tell us, are there any other options?
On a side note, I have also learned that my particular 700 MHz iMac Flat Pannel will NOT take the wirelss AirPort EXTREME card; it will ONLY take the Original AirPort card, which, by the way, are more expensive and hard to find. Not too sure exactly what iMac Flat Pannel you have, Brad, but you should try to find out which one will work for your iMac. I don't know if I should trust eBay for used electronics, but it seems you can pick them up for a little less money than on any online websites. I saw some on a website called macofalltrades.com for about US$100.00; this website looks legit. I also tried Craigslist.ORG, and somebody was only selling an AirPort Extreme card, not the original... It may be worth looking on a near by big city local Craigslist though; make sure you click on the city nearest you.. The default craigslist.org is for San Francisco. I have heard a wireless router costs about US$40.00. However, I don't know exactly what a wireless router is or even what type I need to be looking for, what brand etc??
I need to know if I buy an AirPort card, will I also have to buy that AirPort Base thing as well?? All this information is becoming overwhelming. Could somebody please try to clairify? We would be eternally greatful! =)
Sorry about your computer, Brad; I know what you're going through. =(
iMac 15" Flat Pannel 700 MHz PowerPC G4 1GB SDRAM Mac OS X (10.3.9) i love my little bubble computer -
Problem while calling concsub from shell script
Hi All,
I am facing problem when I am trying to run CONCSUB utility from shell script.The same works well when I try it from command line.The only prob I am facing from shell script is assigning values to temporary variables.
This is how my script looks
#!/bin/bash
export PARM5="$5"
export PARM6="$6"
export PARM7="$7"
echo "INTPARM5=\"$PARM5\""
echo "INTPARM6=\"$PARM6\""
echo "INTPARM7=\"$PARM7\""
echo $FND_TOP/bin/CONCSUB $1 ONT 'Order Management Super User, Vision Operations (USA)' $3 WAIT=Y CONCURRENT ONT $PROGRAM "$INTPARM5" "$INTPARM6" "$INTPARM7"When I try to run the above shell based concurrent program it doesn't pass the parameters as expected and it errors out saying "Wrong number of arguments to call the procedure"
I tried my luck from some of the previous posts ({thread:id=2360776} ),but to vain
If anyone has any ideas,please suggest!!
Thanks in advance!!
Edited by: sandy on May 4, 2013 12:54 PMHere are your proofs
Proocedure
PROCEDURE abc(--p_errbuf OUT VARCHAR2,
--p_errcode OUT VARCHAR2,
p_order_no IN NUMBER DEFAULT NULL,
p_customer_id IN NUMBER DEFAULT NULL,
p_name IN VARCHAR2 DEFAULT NULL
IS
v_cname VARCHAR2(200);
v_ordered_date DATE;
v_order_number NUMBER;
v_order_type VARCHAR2(200);
BEGIN
fnd_file.put_line(fnd_file.output, 'Begin Execution');
SELECT DISTINCT ac.customer_name,
d.ordered_date ordered_date,
d.order_number order_number,
x.NAME order_type
INTO v_cname
,v_ordered_date
,v_order_number
,v_order_type
FROM oe_order_headers_all d,
oe_transaction_types_tl x,
wsh_delivery_details b,
wsh_delivery_assignments c
,ar_customers ac
WHERE 1 = 1
AND ac.customer_id = b.customer_id
AND d.order_type_id = x.transaction_type_id
AND x.LANGUAGE = 'US'
AND b.released_status = 'B'
AND b.source_header_id = d.header_id
AND c.delivery_detail_id = b.delivery_detail_id
AND d.order_number=NVL(p_order_no,d.order_number)
AND ac.customer_id = NVL(p_customer_id,ac.customer_id)
AND x.name=NVL(p_name,x.name)
AND NOT EXISTS (SELECT 1
FROM wsh_delivery_details b
WHERE 1 = 1
AND b.released_status != 'B'
AND b.source_header_id = d.header_id)
--BETWEEN ('1213794') and ('1213797'))
AND rownum<2;
INSERT INTO xxc_temp(customer_name,ordered_date,order_number,order_type) VALUES(v_cname,v_ordered_date,v_order_number,v_order_type);
COMMIT;
fnd_file.put_line(fnd_file.output, 'Order Number is' || v_order_number);
fnd_file.put_line(fnd_file.output, 'Order Type is' || v_order_type);
END;Script
#!/bin/bash
set -x
export PARM5="$5"
export PARM6="$6"
export PARM7="$7"
sqlplus -s $1 <<EOF
set head off feed off serverout on size 1000000
exec abc('$PARM5','$PARM6','$PARM7');
exit
EOFNow when I run the 'XX Order Detail CSV Report' I get the below log and no Output
+---------------------------------------------------------------------------+
Application Object Library: Version : 12.0.0
Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
XXKES_PDF_TRANSFER module: XX Order Detail CSV Report
+---------------------------------------------------------------------------+
Current system time is 06-MAY-2013 05:05:56
+---------------------------------------------------------------------------+
+ export PARM5=66432
+ PARM5=66432
+ export PARM6=
+ PARM6=
+ export PARM7=Mixed
+ PARM7=Mixed
+ sqlplus -s APPS/APPS
+---------------------------------------------------------------------------+
Executing request completion options...
Output file size:
0
+------------- 1) PRINT -------------+
Disabling requested Output Post Processing. Nothing to process. The output of the request is zero byte.
+--------------------------------------+
Finished executing request completion options.
+---------------------------------------------------------------------------+
Concurrent request completed successfully
Current system time is 06-MAY-2013 05:05:56
+---------------------------------------------------------------------------+After the concurrent program executed I queried the table xxc_temp and here you see the data
SQL> select * from xxc_temp;
CUSTOMER_NAME
ORDERED_D ORDER_NUMBER ORDER_TYPE
A. C. Networks
18-FEB-13 66432 MixedMy procedure fetches the data fro given set of i/p parameters but it doesn't give o/p coz it's a host based conc program.Please advise if there's a way to get the o/p in a host based conc program
Thanks!! -
I want to inventory the network card information on my managed computers, details like model, driver version etc. My clients are Win7 x64 managed by SCCM 2012 R2 CU3.
I've found a nice article that describes doing this using the Regkey to MOF tool
http://blogs.technet.com/b/configmgr_geek_speak/archive/2013/11/10/inventorying-and-reporting-network-adapter-driver-details-and-how-to-report-only-the-wireless-type-in-configuration-manager-2012.aspx
I've used Regkey to MOF in the past successfully, but when I navigate to the regkey in this article, and copy/paste the code from the "to import in admin/agent settings... tab", then try to import it into my CAS under default client settings, I
get "The MOF file you tried to import could not be compiled".
I also try to check the MOF file i'm trying to import using the MOFcomp utility, which kicks out the error "Unexpected character in class name (must be an identifier).
Is there something more that needs to be done to the Class Name to get this to successfully pass the mofcomp check? The class name is {4D36E972-E325-11CE-BFC1-08002BE10318}
TonyHi Sherry, below is configuration.mof snippet
// RegKeyToMOF by Mark Cochrane (thanks to Skissinger, Steverac, Jonas Hettich & Kent Agerlund)
// this section tells the inventory agent what to collect
// 3/24/2015 8:46:11 AM
#pragma namespace ("\\\\.\\root\\cimv2")
#pragma deleteclass("{4D36E972-E325-11CE-BFC1-08002BE10318}", NOFAIL)
[DYNPROPS]
Class {4D36E972-E325-11CE-BFC1-08002BE10318}
[key] string KeyName;
String Class;
String ClassDesc;
String TheDefault;
String IconPath[];
String Installer32;
String EnumPropPages32;
String LowerLogoVersion;
[DYNPROPS]
Instance of {4D36E972-E325-11CE-BFC1-08002BE10318}
KeyName="RegKeyToMOF_32";
[PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}|Class"),Dynamic,Provider("RegPropProv")] Class;
[PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}|ClassDesc"),Dynamic,Provider("RegPropProv")] ClassDesc;
[PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}|"),Dynamic,Provider("RegPropProv")] TheDefault;
[PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}|IconPath"),Dynamic,Provider("RegPropProv")] IconPath;
[PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}|Installer32"),Dynamic,Provider("RegPropProv")] Installer32;
[PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}|EnumPropPages32"),Dynamic,Provider("RegPropProv")] EnumPropPages32;
[PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}|LowerLogoVersion"),Dynamic,Provider("RegPropProv")] LowerLogoVersion; -
Applescript/shells script for capture one
Hey,
Wanting a script that will take the last item copied to the clipboard (which will be a folder name), search for it in finder, in "this mac", and then open the folder in Capture One. It would be great if it were ready to run, so I could launch it each time with a keystroke. Any one willing to help me on this. Thanks so much!!
I know a little applescript, but this one is kind of out of my league, I think, at least.Hi,
You can use this script in an Automator Service (you can assign a keystroke combination to this service).
If the script find one folder whose name equal the contents of the clipboard, "Capture One" will open this folder.
if the script finds multiple folders whose name equal the contents of the clipboard, it will do nothing, because I don't know what you want in this case.
To create a service, you start by selecting New from Automator's File menu.
You should select the Service option, which is accompanied by a gear icon, clic "Choose" button.
In your new service, you will see a bar at the top of the Automator flow pane. It has combo boxes that allow you to set filters that establish the conditions in which your service should be made accessible. You want to make a service that receives selected "No Input" and will operate in any application or select an application.
Add the "Run Shell Script" action
Copy/paste this script in the action:
folder=$(mdfind "kMDItemFSName = \"$(pbpaste -Prefer txt)\" && kMDItemContentType = \"public.folder\"")
if [ -z $folder ];then exit 0;fi ## no match
tot=$(wc -l <<< "$folder")
if [ $tot -eq 1 ]; then open -b 'com.phaseone.captureone7' "$folder"; fi
Replace the bundle identifier in this script --> 'com.phaseone.captureone7'
To know the bundle identifier of your "Capture One" application, run this AppleScript, copy the result to change the bundle identifier in the shell script
tell application "Finder" to get id of (application "Capture One")
Save the service, quit Automator
The final step is to assign a keystroke combination to the newly created service.
Open the System Preferences application and navigate to the Keyboard preference pane, and select the Shortcuts tab.
From the list on the left of the preference pane, select the Services category.
A list of the installed services will be displayed to the right.
Scroll to the last category titled General, and locate the service you just created.
Double-click to the far right of the service name to activate the keystroke input field and then type the key combination you wish to assign to the service.
Close the System Preferences application. -
Can I run a shell script from the services menu?, part II
Remember this?
It is now possible.Doesn't look like there is a direct way to do it.
The services are all Bundles, which is easy
enough to fake -- just copy one from /Library/Services
to ~/Services and modify the plist. Put your shell
script in Contents/MacOS/ and identify it in the
plist under CFBundleExecutable and hope for the
best
Where it gets sticky is CFBundlePackageType (APPL
for Application, FMWK for FrameWork, BNDL for
'loadable bundle', whatever that is] and NSServices.
CFBundlePackageType should pose no problem if Services
use the OS loader and handles file magic [and '#!' of
course].
NSServices specifies a named port that the app
listens on, the data type it receives, and so forth.
This looks a bit harder to fake. I'd bet Applescript
has the functionality, and there may be some
command-line hooks to backend that, or it may be
possible to netcat your way through it.
But it doesn't look trivial
Property List Key Reference
Anyways, tried it with a quick script that echoes to a
file, and haven't figured out how to refresh the
Services menu to get it to appear. Probably have
to NetInfo it or something ridiculous; doesn't appear
to watch the FS.
[ Edited by Apple Discussions Moderator; href URL ]
Maybe you are looking for
-
Error while creating an index for NVARCHAR2 datatype
Dear All, I'm trying to create and index on a NVARCHAR2 field type but I get the following error: ERROR at line 1: ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine ORA-20000: Oracle Text error: DRG-10509: invalid text column: SUB
-
How to get the CSV,DATA output from RTF template
Hi Jorge Thanks for your help. as in the link you have given RTF template can have the output type CSV,DATA but in the preview i can see only html,powerpoint,pdf,html excel . How to see the output in SCV,DATA format using my RTF template do i need to
-
Loading External JAR librarys in an applet
HI all, I have an application that I would like to add an excell extention to. The extension is in the form of a JAR file, and I only want my applet to load this jar file when a menu item has ben clicked. I do not want the jar file to be loaded toget
-
Tab format/size in JTextArea not working
Howdy, I am writing a program that uses Runtime.exec() method, I get the error stream from the new process, etc... all that works fine, but as I use append(String s) where s = StreamOutput+"\n";, the output is not formatted in the JTextArea. However,
-
IMAQ Copy function does not always copy Calibratio​n Informatio​n
This only seems to happen on one PC in compiled form- works fine elsewhere. I wrote a trap to check for the existance of calibration information before the copy, and again after the copy to a newly created image. If the two disagree, the program brea