automatically running wine while double clicking .exe file on mac - macos

I have already had wine on my mac, now I would like to know whether it's possible to automatically running wine when I double-click an .exe file (on Finder), because I believe wine doesn't go to my Application folder when I installed it...
If possible, how exactly?
PS: I don't know if this is needed, I use MacOS Lion.

We can use Apple Script to run the exe file.
Open Script Editor.
Add code below:
tell application "Terminal"
do script "'/Applications/Wine Stable.app/Contents/Resources/wine/bin/wine64'
~/.wine/drive_c/Program\\Files/$PATH_TO_PROGRAM.exe"
end tell
Save as application (not as a script) on the Desktop
Double click to run the application.

This is a question better asked on SuperUser.com, but anyways... if you click "Get Info" on your .exe app within the Finder, one of the items in the Info window that shows up will be "Open with:".
You can select WINE as the app to open those .exe files.

Related

How to create dock icon for running terminal command in Mac OS

Now I open jmeter using terminal using command: open /usr/local/bin/jmeter
I need it frequently, so I want to create dock icon to run this command.
How can I do it?
I tried to make a right click and choose 'keep in dock' option. However, it disappears when I close the application.
The closest I could get was creating a desktop icon through the following method:
Create a plain text document in TextEdit
Paste the following code in the document
#!/bin/bash
open /usr/local/bin/jmeter
Save the file as fileName.command
Open Terminal and navigate to the directory which you saved the file
Type in chmod +x fileName.command and hit enter
You should now have a shortcut to execute this command! I know this isn't the exact solution you were looking for, but I hope this still solves your problem.
Following E. Zimbelman's answer, you create a .command executable file and then
you can add an icon (drag and drop an icon file on the icon of the properties window of the file (Cmd+I))
change the .command extension to .app
so you can add it the the dock (drag and drop), it's ok if the icon has changed temporarily
and then you change it back to .command
With this you can have any script you like in the .command file and have it on mac's dock.
I suggest you have a look at the answer to this question in the apple stackexchange. It pretty much does exactly what you want (although I have no idea what jmeter does).
The answer is, essentially, use automator to run your script, save the automator job as an app (not a workflow), and drag the resulting object to the dock, once you have it working the way you want.
https://apple.stackexchange.com/questions/73897/how-can-i-launch-a-virtualbox-vm-from-the-dock
or the wayback machine copy:
https://web.archive.org/web/20160921184459/https://apple.stackexchange.com/questions/73897/how-can-i-launch-a-virtualbox-vm-from-the-dock
I needed a simple terminal command to unmount an internal disk which keeps spinning up whilst appearing in Finder to be unmounted. I am running the Mac from an external SSD.
All that was required was to open Script Editor and enter the text:
do shell script "diskutil eject /dev/nameofthedisk"
and then save that as an Application. Drag that to the dock and now I have one click unmounting of the disk when it spins up.

Do executable files always open a terminal window on MacOS?

I'm on MacOS X, and I'm pretty new to app-bundle-type things. I am writing a program that opens a window and registers mouse input -- not a command line tool. When I compile my code (written in C, if that is important) into an executable file (a "unix executable file") and then run that file directly (by double clicking it, for example), a terminal window pops up, and then the program's window pops up. Likewise, if I navigate to the directory of the executable and open it from the command line, it pops open /another/ terminal window and then the program's window.
However, if I wrap the executable in a bundle (thus, I suppose, turning it into a proper "app"), then when I run the app, either by double clicking or from the command line, the program's window opens and no new terminal window is created. Is this merely a property of the "app bundle"'s architecture? Or is there a way that I can run the raw executable without incurring another terminal window? I suspect that I'm misunderstanding something fundamental. Thanks in advance!
I believe what you're seeing is correct. In order for a separate window to not pop-up, you'd need to encapsulate it into a bundle.
Launching by double-clicking a bundle, or using the 'open' command from Terminal uses Apple's Launch Services, which maintains a list of known (registered) applications. When an application (bundle) is introduced to the system, it is registered with Launch Services and associated with its URI (e.g. com.apple.calculator), which is present in the bundle's Info.plist
Other items in the Info.plist tell launch services how to handle the application, such as checking if the minimum or maximum version of the OS has been exceeded, or whether or not to display a dock item.
A lone binary doesn't have an associated Info.plist manifest, so its behaviour can't be varied and a Terminal window is opened.
Bare executable files are essentially treated as documents by Launch Services (the framework that the Finder, Dock, and open command use when you open stuff). The application which handles such documents is Terminal. So, when you open an executable in that fashion, it launches Terminal if it's not already running and tells it to open the document. Terminal does this by opening a new shell window and auto-typing the path to the "document" as a command line.
Launch Services handles bundled apps as, well, apps. If the app is already running, it activates it and possibly has it open a new untitled window. Otherwise, it launches it.
As Rob Napier notes in the comments, if you run an executable directly from the command line (or if some already-running app launches it using NSTask or fork+exec), it will simply run. Launch Services won't be involved, so Terminal will not be asked to open the executable as a document.

Creating Dropbox like DMG package

Does anyone suggest a freeware tool/script/manual_way of creating Dropbox like DMG -
Need to ask couple of questions --
I want double clicking the Folder-Icon should copy the folder(which would contain installer and uninstaller .app files of my application) into the system's /Applications folder.
Solution -- This has been solved using Applescript and changing icon of that applescript file to the folder-icon(i.e double clicking that script will move our folder(which would be present in a hidden folder) to /Applications.Any suggestions for second and third part?
Is it possible to show hyperlink of actual dropbox.com to actually open it's website?
And how we can customize volume's/Drive icon?
You can find a way to do it by reading this: Packaging a Mac OS X Application Using a DMG ยป asmaloney.com
I believe you can also use the trick of naming a shellscript file something.command in order to make it double clickable, (but maybe it will open the terminal, -I haven't tried it).

Run an apple script saved as run only so icon doesnt show in dock

I created an apple script and placed on my desktop. I first saved it as .app and when double clicked it ran code successfully and closed. However in the time it would run it would show an icon in my dock.
So to avoid that i thought lets save it as a run only script. So I did that but now when I double click it, it doesn't run the script, it just says 'it was saved as read only and cannot open'.
You can edit the Contents/Info.plist (easy with Xcode) located in the app bundle and add a Application is agent (UIElement) - Key with value YES to it. Now it shouldn't show in the Dock when running.
The raw text to include is:
<key>LSUIElement</key>
<true/>
Change your run only script's extension from ".scpt" to ".app" and you should be able to run the thing.
More information can be found in this closely related question.

Add mouse right click option in Mac OS X like windows

I have requirement to add mouse right click option in folder or file list like windows explorer. Requirement is like below:
"There are some files with particular extension showed in Finder/folder list in Mac OS X. When user click on file with that particular extension I need to show my .exe or .app name which can open that file".
I want to know how to achieve this functionality in Mac OS X. In windows it is game of registry but I am not sure how to achieve same in Mac OS X.
You get this in the Info.plist file in your app bundle by specifying file extensions your application can open in the CFBundleDocumentTypes array.
http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-101685-TPXREF107
I tried that option. It is working fine and I am getting my application icon with that extension file and also my application is there in Default handler. But now issue is that this application I have created thru Qt and in main function of my application I am getting only application path in argv and argc and not the selected file. So let me know how to achieve this. If more information is required then please let me know. Thank you for valueable answer

Resources