When creating services in automator, the topmost options is "Service receives selected..." Is there a way to create a service that just works on the currently open finder window, without having a file selected? The reason why this would be nice to have is the following:
I have my unit tests in a directory tree that duplicates that of my source code. I wrote a service using automator, applescript and php that makes it possible to toggle back and forth between the source directories and my test directories. Currently I have to select a file in the directory to activate the service. I would like to be able to just navigate to a folder and activate the service that toggles to the according directory, without having to select a file first (Sometimes there are no files yet!)
Edit: Following robmathers's suggestion in his comment to his answer I now use
tell application "Finder" to set windowTarget to the target of the front Finder window as alias set posixPath to POSIX path of windowTarget`
which gives me the correct path to the finder window's path when I run the service in Automator.
The problem now is that the service does not show up in the "Services" panel, nor in System preferences under keyboard shortcuts when I create a new service with these settings. If I modify the existing service, It is not available when I don't have anything selected.