Antworten auf Ihre Fragen • Datenbank-Pflege • 4D Coaching • OpenDDDD • Termine • 4D Expert V11/V12-Service • Konzepte • Alternativen • Meine Apps
GebrauchtesMac + iPhone: zu verkaufen
Geo-Themen + ProjekteGoogleMap-Integration • GeoDDDD • Database Publishing • Database Photography
angesammelt seit 22 Jan 2008
Terminal-Befehle und AppleScripts die von Interesse in der 4D-Programmierung sein könnten.
How to use the new to V14 object to enhance search of intermediate parameters stored. Example from Rob Laveaux in 4D_Tech Digest, Vol 94, Issue 40
Finding objects in arrays of objects
You can easily solve this by using an object as the root, instead an array object. The root object holds the id as the key and the settings object as the value.
von Steven Eppler
29 Dezember 2014
Access Safari Bookmarks from 4D
Suppose while using 4D webarea you'd like to have access to Safari-Bookmarks (which are synched between your devices since iOS8 and Yosemite if you opt in). Seems easy, this runs fine in terminal
LAUNCH EXTERNAL PROCESS needs some help.
Here the three lines in their entirety
28 September 2014
OSX man pages
Just wanted to share a cool tip for OSX manpages... just type the command you are about to use and want to see the manpage for, then right-click with the mouse and you get a yellow pop-up window with the manpage that you can scroll up and down and refer to while you are concocting your command without needing a second Terminal window :-) – Mark Setchell
Instantly Eject All Mounted Drives & Disks from the Command Line in Mac OS X
Let VNC viewers connect to currently logged in user
Want to connect with the currently logged in user when using a VNC viewer rather than seeing the Login Window (ARD 3.5/OS X 10.7 and later)?
To convert a single image with sips, use the following command string syntax:
Quick Look is a delightfully simple way to browse the contents of the files on your Mac without launching their parent apps. (Select a file, press the space bar, that's it.) But if you’re looking at, say, a PDF or Word document, Quick Look can frustrate, because it doesn't provide any way to select and copy text; if you find a snippet of text you’d like to copy and paste, you still need to launch the parent app. Unless, that is, you know a secret shared by Keir Thomas.
To make text selectable in Quick Look previews, you just need to enable a hidden Finder setting. Select and copy the code below, open Terminal (/Applications/Utilities), paste that code at the prompt, then press Return:
If you decide you don’t deserve to select text in Quick Look, you can turn this feature off with another Terminal command:
Zeitzone herausfinden/Which Timezone
ganz einfach via
Oder das Dokument localtime auslesen
WIN32API - sys_GetTimeZone
Das übrigens in der Version 5.x immer noch WIN32API heißt obwohl es 64 Bit ist :-)
Anyway, if you want to join PDFs on OS X from the command line, no need to install anything:
There’s a Python script hidden in Automator.app that joins PDF files
Read the actual text content from a PDF document
Also, there are command line programs available to extract the text from PDF's that you can call with LEP. On Mac, you can also use Spotlight's mdimport command:
Ordner öffnen, Open Folder
Zippen per LAUNCH EXTERNAL PROCESS
We've been using "ditto -c -k" to create zip-archives with LEP without any problems (with 4D 2004 and 4D v11). However, we use POSIX paths to both the directory to be archived and the archive to be created
$SourcePOSIXPath:=Convert path system to POSIX ($SourcePath)
Lieber Ortwin, schöne Sammlung. Hier könntest Du noch diese Info hinzufügen: set zipFile_path to (Dest_theFolder & Dest_fileName & ".zip") set cmd to "zip -r -j " & quoted form of (zipFile_path) & " " & quoted form of POSIX path of (Source_itemPath) ZIP – Cross Platform The zip command doesn't include anything beyond basic file metadata in the archive, while the Finder includes them using the AppleDouble format. To include the metadata, use ditto instead --> Was ein oft ein gewolltes Ergebnis ist, wenn man Dateien austauschen will. Details: zip -r archive_name.zip folder_to_compress unzip archive_name.zip # -X = without those invisible Mac resource files such as “_MACOSX” or “._Filename” and .ds store files, use the “-X” option in the command so: zip -r -X archive_name.zip folder_to_compress ---- set zipFile_path to (Dest_theFolder & Dest_fileName & ".zip") set cmd to "zip -r -j " & quoted form of (zipFile_path) & " " & quoted form of POSIX path of (Source_itemPath) -j --junk-paths Store just the name of a saved file (junk the path), and do not store directory names. By default, zip will store the full path (relative to the current directory). -r --recurse-paths Travel the directory structure recursively; for example: zip -r foo.zip foo or more concisely zip -r foo foo In this case, all the files and directories in foo are saved in a zip archive named foo.zip, including files with names starting with ".", since the recursion does not use the shell's file-name substitution mechanism. If you wish to include only a specific subset of the files in directory foo and its subdirectories, use the -i option to specify the pattern of files to be included. You should not use -r with the name ".*", since that matches ".." which will attempt to zip up the parent directory (probably not what was intended). Multiple source directories are allowed as in zip -r foo foo1 foo2 which first zips up foo1 and then foo2, going down each directory. Note that while wildcards to -r are typically resolved while recursing down directories in the file system, any -R, -x, and -i wildcards are applied to internal archive pathnames once the directories are scanned. To have wildcards apply to files in subdirectories when recursing on Unix and similar systems where the shell does wildcard substitution, either escape all wildcards or put all arguments with wildcards in quotes. This lets zip see the wildcards and match files in subdirectories using them as it recurses. Bernd Bippus
V12-Server mit OSX starten
Im Handbuch zur V12 findet sich:
Wat Nu? AppleScript schreiben und dieses zum Startobjekt machen ist zumindest ein Workaround.
Das AppleScript ist einzeilig. Sage der Anwendung im Ordner, sie solle das Dokument öffnen:
On Mac OS X
note: this also shows outgoing connections from web browsers
Get all IPs connected to your web server:
Get all unique IPs connected to your web server:
Gefunden bei CommandLineMac
Admin-Paßwort beim Drucken: 4D 2004 und MacOSX.6
Die beiden "Showstopper" waren ja der Open Documents Bug (Crash nach x geöffneten Dokumenten) und der Print Bug (admin-Kennwort zum Drucken erforderlich). Der Open Document-Bug ist mit 10.6.3 behoben und zum Print Bug hat Bernd F. dieses aus der NUG zitiert (ville merci):
As we are/were experiencing the printing prompt for authentication when using 4D Client 2004.7 on Mac OS 10.6.x -- we've been given a solution by Jon Rhoades and passed on by Chiarelli Fabio that seems to have fixed the issue. Thank you Chiarelli and Jon!!!
Mit einem Admin-Account ist der Spuk weg, mit einem einfachen Account nicht.
Spotlight works great most of the time, but occasionally you may need to do a bit of tinkering to get it to work properly. Most of us have probably had a problem where Spotlight won't find a file you know is there. Here are a few Terminal commands for changing hidden Spotlight settings, performing more complicated searches and updating the index. …
Do you ever want or need to show all of OS X's hidden files?
Better check CUPS from june 2013 first.
If you want to set the printer preset from the terminal in 10.6 (or from an AppleScript via a 'do shell script' command), it's different than how it's done in previous versions of OS X.
Assuming you have a printer called 'Copy Room Printer' and a preset called 'double-sided, stapled,' you would run the following two commands:
Printing PDF on Mac
You can do this with the lp command line utility. For example:
Rob Laveaux in der iNug
Combine two PDF files into one without rasterizing
We use the python script provided in Mac OS X 10.4 and up. Location: /System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py
Leider nicht so zu verwenden. Schade!
Nachtrag 29. Sep. 2010
Fred Zelinsky hat eine Lösung gefunden. Hier zum Download die beiden Methoden Combine_Pdfs_BuildAS und Gen_CompileApplescript in Textfassung.
Dazu auch Koen Van Hooreweghe:
und noch eine Perle von Koen Van Hooreweghe:
2. März 2012: gefunden bei And now it’s all this: Maintaining the BoundingBox in ps2pdf
MacOSX-Hints: A simple way to create PDFs from the command line
I have used many different methods over the years to print documents to PDFs from the command line. Some have been complicated sequences of pipes to and from groff, others required TeX, and occasionally I set up a "virtual" printer, simply to print to file. I recently read documentation for cups-pdf, however, and found that cupsfilter command is sufficient for most of my own tasks in its bare form!
For example, to print 80-column ASCII plaintext (the majority of my code), I can use this:
If you find the output of that command a bit verbose (as I do), you can send the errors silently to the null device using this version:
There are many ways to wrap this simple command even more conveniently, but I'll omit those here for now. The reason this method is ideal is because it uses built-in routines in OS X; any time you can take advantage of these, do, because many of the core technologies are significantly faster and more secure than third-party alternatives.
ich sage: stimmt, geht aber trozdem. Das folgende ins ~/.bash_profile unter OSX eingetragen erweitert mir "man" durch "pman" (=PDF man) und ist klasse!
Fazit: Einen File an
mdfind command, the UNIX API to OS X Spotlight. For example, you can find all .4dbase packages using the following syntax:
Can 4D Detect a USB device?
From the top of my head: use LAUNCH EXTERNAL PROCESS to execute a terminal command: system_profiler SPUSBDataType
For all you Leopard users out there, here's a handy trick to use Quick Look from the command line. Leopard ships with a command called 'qlmanage'. The -p option shows a preview of the file passed to the command. In the terminal, type the following:
You can extend this by creating the following shell script:
The >& /dev/null prevents output from displaying, and the & runs the process in the background so a new prompt displays on the terminal.
Open Web Page Within Specific Browser
Cannon Smith I'm trying to use LAUNCH EXTERNAL PROCESS to open a web page in a specific browser, one that isn't the system default. This is the string I'm passing in:
Koen Van Hooreweghe You're right. On my 10.4 machine a saw the same thing. The url always opens in Safari. But it works this way (at least from terminal):
John DeSoi What you probably want is to use the bundle identifier. That way you don't have to depend on the application path or name. You can find an application's bundle identifier in the info.plist file inside the application.
MIYAKO it works for me when I double quote the URL...
I need to crash 4D
Pierre Leblanc, Jerome Pupier 4D tech support came up with a very efficient trick:
It works every time. That's we are using to debug the Backup
Bernd F. dazu:
PowerPC oder Intel-Mac?
Ich versuche mit 4D festzustellen, wie schnell ein Webserver antwortet.
Kannst Du testen mit dem Unixbefehl
Procedurally Set the "Preset" Menu in Mac OS X's Print Dialog Box
Submitted by Kevin LaTona, Studio Sola
Here's a simple way to procedurally change the Print dialog window's "Presets" setting on Mac OS X.
Doppelte Pfeile an beiden Enden des Rollbalkens
Icons ausgeblendeter Programme transparent im Dock anzeigen
Just issue the following to disable the shadows. Use false instead of true to enable them.
There are other cool screencapture preferences you can use as well. For example, you can set the capture format to JPEG, TIFF, or PNG using the following. Google around to discover more.
After setting the defaults, you must restart the SystemUI server:
Debug-Menu on and off
Noch mehr Tips in TUAW's Mac 101 and Terminal Tips sections