Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to I insert text into a this command in automator wine "Text goes here" this is a perl script

I have spent hours trying to figure this out, automator is the hardest thing to figure out. All I want to do is emulate me doing this

-Open terminal

-type wine

-drag and drop the location of an .exe file

-hit enter


Now this should be easy as all I have to do is do run shell script, insert argument and done, BUT IT DOESNT RECOGNIZE WINE!?!?! Pleas help me.


Let me clarify.

If I make an automator application that that runs the command "wine" and then inserts text into the space after that Then i will be set. But no matter what I do nothing works. If i set the shell to perl and pass input as argument....It doesnt work the $f and $@ stuff doesnt work.


Wine is likely not recognized because is is pearl based so I set it to pearl, but how do i pass and argument over to it?

MacBook Pro, Mac OS X (10.7.4)

Posted on Dec 21, 2012 11:41 PM

Reply
10 replies

Dec 21, 2012 11:58 PM in response to wiinick100

Well, for one I suspect you're doing it wrong 🙂


What's your rationale for driving Terminal.app to do this simple task (launch an application) vs. some of the other Automator actions such as Execute New UNIX Task, or even just Run Shell Script. Both of these can run without needing Terminal.app


If you insist on using Terminal, I suspect your problem has something to do with paths - if wine isn't in the standard system directories (e.g. /bin, /sbin, /usr/bin, etc.) then the OS won't find it unless you use the full path to the wine executable (e.g. /usr/local/wine, /opt/wine, or wherever you've installed it on your machine).

Dec 22, 2012 12:03 AM in response to Camelot

Thank you I will try this.


My rational is that when one drags and drops a file onto an application, that application tries to open it. I can get the drag and drop action to copy the files location and turn it into an argument. Just no clue and how to insert it into "wine (Argument goes here)" just as if I typed wine /Users/Nicks/Desktop/putty.exe

Then that would run putty.exe on my mac using wine.

Dec 22, 2012 1:37 AM in response to wiinick100

I still think you're on a losing track by using Terminal.app.


Recreate your workflow as an application (Automator applications accept files drag/dropped on the app icon). In the workflow add the 'Run Shell Script' action with the script:


/opt/local/bin/wine ${0}


That should do what you need (error handling notwithstanding (e.g. you drop a directory or non .exe file on the app)

Dec 22, 2012 2:26 AM in response to Camelot

Wait...if I run any exe from the desktop it works...anywhere else it fails...


So I have all exe files set to open with that application. Everything from the desktop works. I dun get it.!?!?!


Ok so problem solved. Anything with a space in it will not work because the shell wont except them without \\. I had a folder called Windows Applications.

Any Idea on how to bypass the space issue without doing Windows\\ Applications

Dec 22, 2012 7:04 AM in response to wiinick100

Try


/opt/local/bin/wine "$@"


The "..." will protect the white space, but still allow $variable subsitutions.


The $@ will substitute all the files you drag as a group to your Automator app.


The notation "$@" does the substitution with each file properly quoted to protect the white space in the file path, but provide each file as its own quoted argument to the 'wine' command line.


If you need to invoke 'wine' once for each file of a group of files you drag on to your automator app, then use


for f in "$@"
do
     /opt/local/bin/wine "$f"
done


This will loop through each file of a group of files you drag onto your automator app, and invoke 'wine' once for each file in the group.

Dec 22, 2012 2:02 PM in response to BobHarris

It works, it gives an error at the end of each run saying automator didnt run properly but everything works.


I tried

/opt/local/bin/wine "$@" which did work without errors but when i tried putty.exe (An ssh client) it said could not connect to host ~/Desktop. Which is just a strange error if you ask me. Especially if Its a startup error for the program. Dont know what thats about but Thank you for all the help I can deal with an error at the end of each run.

YOU SIR ARE A GENIOUS

How to I insert text into a this command in automator wine "Text goes here" this is a perl script

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.