I'm trying to create an hybrid CD able to autorun on Windows machines and auto-open the main folder with a custom background on Mac OSX.
The CD has to start an application in flash showing also some PDF files.
Here the scheme of the CD files and folders:
application.exe <-- the app for windows
autorun.inf <-- the autorun file for windows
application.app <-- the app for mac osx
/documents <-- the folder which contains the PDF files for both the applications
/background <-- the folder which contains the background image for Mac OSX
Following this answer I was able to set a background folder image for mac and create the first hybrid ISO with this command:
hdiutil makehybrid -o [image.iso] [my_project_folder] -iso -hfs -hide-iso [file to hide on windows] -hide-hfs [file to hide on mac]
Unfortunately with this command I wasn't able to hide more than one file; I need at least 2 (.exe and .inf) for mac.
And even if the background results correctly set to my original folder when I open the ISO it seems to lost it and other settings like the window and icons dimensions.
Update:
The correct syntax for hdiutil command to hide multiple files is the following:
hdiutil makehybrid -o image.iso source_folder -iso -hfs -hide-iso cd_folder/application.app -hide-hfs "{cd_folder/application.exe,cd_folder/autorun.inf}"
Unfortunately the folder background image, window dimensions and icon positioning still desappear in the iso file.
It is possible to re-set them again but every time the iso is ejected and re-mounted OSX seems to forget my preferences...
Solution:
After several attempts I have finally found the cause: the read and write mount command hdiutil attach -readwrite myCD.iso does't work on Mountain Lion
Therefore the OS doesn't save / remember my preferences.
I have noticed this behaviour also trying to create the hybrid image with Toast; when I have tried to mount myCD.toast and change the icon position it wasn't allowed (and I realized the problem).
Hence I replicate the process with my old Snow Leopard and everything worked perfectly! Also creating the hybrid CD with Toast is really easier and fully customizable.
What I do is make a read-write disk image, set up background image, icon size, and so on, unmount the image, and make sure it restores properly on remount. To get a designated folder to open when the image mounts, I use the bless command. Once the read-write image works as I want, I make the hybrid image using the read-write image as the source. I've made a set of AppleScript programs to simplify the process.
Related
Opening a gnome-terminal in the specified directory is straightforward:
gnome-terminal --working-directory ~/dotfiles
Creating hyperlinks is not a problem:
echo -e '\e]8;;file:///home/pmn/dotfiles\aThis is a link\e]8;;\a'
this produces a link that opens the file explorer in the correct folder when Ctrl+Clicked.
What I want to do is combine the two things, so that when I Ctrl+Click the link, a terminal pops up, already in the requested folder. It would not be a problem if the current terminal I'm in changed directory, but in that case I'd like to still see the previous terminal output and just do the equivalent of a regular cd (Edit: Note that the ~/dotfiles folder is just an example, I have several links that are generated by a script, and I'd like to be able to click on them to quickly open a terminal where needed).
I tried fiddling with registering custom applications:
In ~/.local/share/applications/mimeapps.list add:
(Note that the use of this file is deprecated, ~/.config/mimeapps.list should be used, if you have tips on doing that properly I'm open to them)
[Default Applications]
x-scheme-handler/mygnometerm=mygnometerm.desktop
In ~/.local/share/applications/mygnometerm.desktop add:
[Desktop Entry]
Type=Application
Terminal=false
Name=My Gnome Terminal
Exec=/bin/gnome-terminal --working-directory=%f
MimeType=x-scheme-handler/mygnometerm
Create the folder for the mime database:
mkdir -p ~/.local/share/mime/packages
Update the mime database:
update-mime-database ~/.local/share/mime
This does work: if I right-click on a folder in the file explorer and select My Gnome Terminal as the app to use, a terminal is opened already in the right folder.
If I print
echo -e '\e]8;;mygnometerm:///home/pmn/dotfiles\aThis is a link\e]8;;\a'
and click on the link, a terminal does pop up, but in the root folder, and the same happens when running
gio open mygnometerm:///home/pmn/dotfiles
I just need to combine everything, but I tried a lot of combination of what to echo in the link and could not find the right one.
I'm also open to other ways to achieve this behaviour, but at this point I'm quite curious in how to to it this way.
The use case, for the curious, is that I made a simple script to check the status of my repos, and I want to click on the ones with things to do without having to copy and paste the path. I reckon I'll save at least 5 seconds!
Cheers!
I have a desktop application that I successfully package and install on macOS using dmgcanvas. The user simply drags the icon into Applications to install and then run by clicking on the Application Icon in Applications.
My problem is whereas the software was previously a Desktop only application it now has a new mode whereby it runs as a server, and can then be controlled via a web browser. On Windows, I would simply create another .exe file with the option set to run as server and put this in the installation folder, so the user would just run MyApp.exe or MyAppServer.exe
But in macOS I can not see how to do the equivalent thing since there is just one folder Myapp.app containing the installation and clicking on Myapp.app runs the application, so where do I put MyAppServer?
Of course, the user could right-click on MyApp.app and run Show Package Contents and then navigate to a subfolder such as bin containing a cmdline version that runs in server mode. But how is the user supposed to know how to do that, I want an easy way for the user to run MyAppServer?
Its hard for find documentation of how things exactly work on MacOS. But below is a good article
https://mathiasbynens.be/notes/shell-script-mac-apps
The internal folder structure may vary between apps, but you can be sure that every Mac app will have a Contents folder with a MacOS subfolder in it. Inside the MacOS directory, there’s an extension-less file with the exact same name as the app itself. This file can be anything really, but in its simplest form it’s a shell script. As it turns out, this folder/file structure is all it takes to create a functional app!
They have a simple script to automate the whole process
#!/usr/bin/env bash
APPNAME=${2:-$(basename "${1}" '.sh')};
DIR="${APPNAME}.app/Contents/MacOS";
if [ -a "${APPNAME}.app" ]; then
echo "${PWD}/${APPNAME}.app already exists :(";
exit 1;
fi;
mkdir -p "${DIR}";
cp "${1}" "${DIR}/${APPNAME}";
chmod +x "${DIR}/${APPNAME}";
echo "${PWD}/$APPNAME.app";
So what I would do is that, instead of having my apps binary directly, I will have a Shell Script and the Binary in the same folder. This shell script will check if the AppName Server.app already exists or not, if not, it will create the folder and put a script which then calls your original app with -r flag.
And then I would just run the actual app with the pass arguments that were passed to the script
Is this the best approach? Not sure about that, I could not find a way where a app has multiple Icons in but just one folder. In this case the Server option will not exists on first installation of the app, but after the first run of the app. You could even ask the user if they really want an additional icon for the app or not.
I'm having the same difficulty as the one expressed here: Cannot connect to X server using docker on OSX
I'm very confused about the recommended instructions in the above link (I'm a novice on docker), and I'm hoping to get clarification about the following:
1) Do we "touch foo.foam" in a regular OS X terminal or do we touch it in the docker terminal; in my case, following "docker run -ti openfoamplus/of_v30plus_rhel66 /bin/bash"
2) You suggest running paraview (mine is the most recent) just like any other Mac app. So, basically, to double-click on paraview in the Applications folder? But when opening foo.foam via the Open Menu do we just open foo.foam and press the Apply button (it gives errors), or do we actually enter "paraview foo.foam" as per your instruction above? If the latter, then nothing really happens; I can't open anything!
3) If we're supposed to just open foo.foam, what do we do after that? How is docker even aware about any of this? Anyway, when I type paraview from within docker (after foo.foam is opened) I get the same X server error. I wouldn't expect otherwise!
Hopefully, you can provide a more step-by-step set of instructions?
Thanks in advance
#First steps with OpenFoam
You've successfully followed the instructions to run the cavity problem, but you run the final command paraview and the spits back an error about x server being unavailable.
here's what you do:
Download paraview natively to your mac. Then open up a terminal window and cd into the directory that you ran the cavity problem in. (note sure what directory? jump back to your docker shell and run echo $FOAM_RUN)
Once you're inside the cavity directory, make a new .foam file and open it with paraview.
$ touch foam.foam
$ open -a paraview foam.foam
Click on that Apply button - middle of the screen on the left. At the top screen you can then select things like pressure p and plot type surface, and step through the time dumps in the upper right (initially my mesh didn't render correctly, so I had to deselect internalMesh, apply, and then select it and apply again).
Not really sure what you're looking at? Here's the tutorial for the problem:
http://www.openfoam.com/documentation/user-guide/cavity.php#x5-40002.1
In many task I've to open a file with a script so I've to type the full path of the file. Usually I go to properties of the file and then I copy the path and then the name of the file. I wonder if there is a faster way to do that.
I would like to copy it in one click or drag the file in the IDE or something like that....
(I'm using Windows XP, Mac Mountain Lion and Ubuntu 12.04 sometimes).
In windows pressing shift and right-click allows you to select copy path.
In Mac right click and pressing alt allows copying file as path.
I've found Copy path for Windows that:
that will allow you to right click on a drive or file system object
and copy the path of the file to the clipbpoard. If the drive is a
mapped drive or the file system object exits on a mapped drive it will
resolve the full UNC path.
On Windows Shift+Right Click allows you to copy the path directly.
Alternatively many shell (like the shells of Spyder and Canopy,Ipython) support a drag and drop option that allow you to drag the file inside the shell and get the path of the file.
Added: The problem: the script runs and photoshop opens, but the droplet doesn't execute on the jpg file to watermark it.
Original:
I'm automating a work flow using ruby on mac osx. The aim being to pass my ruby script a directory (containing images), it opens each one, checks the orientation & size, and passes the image to the relevant photoshop droplet based on this, then uploads them to flickr.
Initially I was using 'system' to try and run the droplet because I thought it was an executable binary.
Of course the droplet requires photoshop to run it so instead I've tried this:
system('open /Users/fullpath/watermark_landscape_W600 --args /Users/fullpath/y020_Pork_Terrine_Orange_Paste_Bread.JPG')
LaunchServices is clearly returning the correct application because photoshop opens.
I enabled history logging in photoshop in the vain hope that it would tell me what droplets and parameters were passed to photoshop when it was opened but the output is very poor:
2013-07-14 12:45:53 Photoshop launched
2013-07-14 12:47:06 Photoshop quit
How can I check to see that open is passing the correct parameters to osx and photoshop? is there a stand error log output I can hook into?
I've been able to use Photoshop 2022 droplets by calling them within the package.
./YourDroplet.app/Contents/MacOS/Droplet /full/path/to/file.jpg
Answer: Opens photoshop and executes the droplet on the image:
NOTE: '--args' omitted:
open -a /full_path/watermark_foodlab_landscape_W600 /full_path/y020_Pork_Terrine_Orange_Paste_Bread.JPG
Thanks Frederick that worked a treat!!
Combinations tried:
Opens photoshop:
open /full_path/watermark_foodlab_landscape_W600
Opens photoshop and opens image in preview:
open /full_path/watermark_foodlab_landscape_W600 /full_path/y020_Pork_Terrine_Orange_Paste_Bread.JPG
Opens photoshop:
open -a /full_path/watermark_foodlab_landscape_W600 --args /full_path/y020_Pork_Terrine_Orange_Paste_Bread.JPG
Opens photoshop and opens image in preview:
open ./watermark_foodlab_landscape_W600 ./y020_Pork_Terrine_Orange_Paste_Bread.JPG
Opens photoshop:
open ./watermark_foodlab_landscape_W600 --args ./y020_Pork_Terrine_Orange_Paste_Bread.JPG
Unable to find application named './watermark_foodlab_landscape_W600'
open -a ./watermark_foodlab_landscape_W600 ./y020_Pork_Terrine_Orange_Paste_Bread.JPG
Quick rain dance . . .
NOTE: '--args' omitted:
Opens photoshop and executes the droplet on the image:
open -a /full_path/watermark_foodlab_landscape_W600 /full_path/y020_Pork_Terrine_Orange_Paste_Bread.JPG
Re-reading the man page this makes sense, but I certainly didn't interpret it that way!!!
Right of to sit in the sun and bask in glory with a pint! (it is sunday after all)