HOWTO: Launch non-scriptable Pseudo application

I don’t know if anyone is familiar with “Pseudo” (http://personalpages.tds.net/~brian_hill/pseudo.html) but I need to launch an application from a script via “Pseudo.” I don’t know if this is even possible but I have a ‘Pseudolaunchdocument’ which does what I need with the application. However, Applesciript does not let me “launch” that file (although I can launch it from the dock or desktop). I can launch “Pseudo” but since it is not scriptable, I don’t know how to tell it to use that launch document. Any suggestions would be appreciated.

You can back into Pseudo using the shell to launch it:

Jon


[This script was automatically tagged for color coded syntax by Script to Markup Code]

Thanks for the reply. As a beginner, I am not following this very well. If I use your script with no changes, other then the password, it will not let me choose the Pseudo launch document. I’m a little confused about the file type “APPL”, shouldn’t it be “pseudo,” which is the file type of the laucn document? Am I misunderstanding what to do? Does this launch Pseudo with the launch document or is it by-passing Pseudo and launching the app itself via a Unix shell (we have not set a root password so I am guessing you mean admin password)?

P.S. This is going to be part of a backup script so it needs to run unattended.

No, type “APPL” should just let you choose items that have a file type code of “APPL” which works for many applications. You can modify this script so that it allows you to choose any file–regardless of file type (see below). This was just to show you how it works. If you already know the file/app you want to open using Pseudo, you should hard code that instead of using the “choose file” command.

Jon


[This script was automatically tagged for color coded syntax by Script to Markup Code]

I’m not familiar with Pseudo but can’t the Finder be used to do this?

tell application "Finder" to open file "path:to:Pseudolaunchdocument" using "path:to:Pseudo"

– Rob

I guess I was making it too complicated. I don’t know why I didn’t see it but someone else suggested:


tell app "Finder"
   open "mypath:mylaunchdocument.pseudo"
end tell

Thanks again for the reply. I’ll keep your suggestion handy as I think it may solve another problem I’m having.

Rob:

Hello again. Yep. You posted your solution just before I posted a suggestion from another source. I think they are the essentially same. Thanks.

Yours will work as long as Psuedo is the application that’s set to open the document. You can check by selecting the document in the Finder and then doing a “Get Info” on it. Check the “Open With” panel. The script that I offered should work no matter which application is set to open the file. :slight_smile:

– Rob

I didn’t understand the problem fully. I didn’t understand that you were using a Pseudo Launch Document. The script I posted allows you to launch any application using Pseudo without having to first create the Launch Document.

And Rob, I can’t get the method you mentioned to work. I did try it even before I posted anything, this is what I got:

Jon


[This script was automatically tagged for color coded syntax by Script to Markup Code]

It appears to fail when the path to the app is generated using:

set app_pseudo to ((path to “apps” from local domain) as string) & “Pseudo.app”

If the variable is set to the full path, it works for me.

set app_pseudo to “Disk:Applications:Pseudo.app:”

I can’t figure out why your ‘path to’ construct doesn’t work. I wasn’t using Pseudo to test with but it shouldn’t matter.

– Rob

This un-finished script attempts to emulate Pseudo’s features. It works fine to launch carbon apps, but I was having problems with some cocoa ones the last time I revisited it. But perhaps it works for you… :?:

tell application (path to frontmost application as text)
	
	set appToLaunch to POSIX path of (choose file with prompt "Please, choose an app to launch with administrator privileges..." of type {"APPL"})
	
	
	try
		if (appToLaunch as POSIX file as alias as text) ends with ":" then --> cocoa package
			set appToLaunch to (appToLaunch & "/Contents/MacOS/" & (do shell script "defaults read " & quoted form of (appToLaunch & "/Contents/Info") & " CFBundleExecutable"))
			tell me to do shell script "sudo " & quoted form of appToLaunch & "" with administrator privileges
		else --> carbon app
			tell me to do shell script "sudo /System/Library/Frameworks/Carbon.framework/Versions/Current/Support/LaunchCFMApp " & quoted form of appToLaunch with administrator privileges
		end if
	on error msg number n --> wrong password
		if n ? -128 then
			display dialog "Wrong password!..." with icon stop
		else
			display dialog msg with icon stop
		end if
		error number -128
	end try
end tell
do shell script "sudo -k" --> reset sudo
beep 2