Start XAMPP by AppleScript

I use XAMMP on my G5 for Servoy database development.
What I would like to have is have AppleScript startup XAMPP automaticly with a startup script.

This is what I manually do:

  1. Go to a Terminal shell and login as the system administrator root (XAMPP doesn’t run without the root password):

sudo su

  1. enter root password

  2. Call this command to start XAMPP:

/Applications/xampp/xamppfiles/mampp start

How do I get this in an AppleScript? I tried:

tell application "Terminal"
	activate
	do script "cd /Applications/xampp/xamppfiles; ./mampp"
end tell

But this doen’t work, Terminal says then: You need to start XAMPP as root! :frowning:

Operating System: Mac OS X (10.4)

is this for remote use? like ssh if not then…

-- 
-- XAMPP AppleScript Controller 


set isAppleApacheRunning to 1 
set isXamppApacheRunning to 1 

-- Apple Apache check 
try 
   set s to do shell script "ps -ax | grep /usr/sbin/httpd|grep -v grep" 
on error errMsg number errNum 
   set isAppleApacheRunning to 0 
end try 

-- XAMPP Apache check 
try 
   set s to do shell script "ps -ax | grep /Applications/xampp/xamppfiles/bin/httpd|grep -v grep" 
on error errMsg number errNum 
   set isXamppApacheRunning to 0 
end try 

if isAppleApacheRunning is 1 then 
   set dialogReply to display dialog ¬ 
      "Apple's Apache is running.  Stop this process first." buttons {"Exit"} default button 1 
   return 
end if 

-- If XAMPP is not running 
if isXamppApacheRunning is 0 then 
   set dialogReply to display dialog ¬ 
      "XAMPP is not running." buttons {"Start", "Exit"} default button 1 
   if button returned of dialogReply is "Start" then 
      do shell script ¬ 
         "/Applications/xampp/xamppfiles/mampp start" with administrator privileges 
      return 
       
   else if button returned of dialogReply is "Exit" then 
      return 
       
   end if 
end if 

-- If XAMPP is running 
if isXamppApacheRunning is 1 then 
   set dialogReply to display dialog ¬ 
      "XAMPP is currently running." buttons {"Stop", "Restart", "Exit"} default button 1 
    
   if button returned of dialogReply is "Stop" then 
      do shell script ¬ 
         "/Applications/xampp/xamppfiles/mampp stop" with administrator privileges 
      return 
       
   else if button returned of dialogReply is "Restart" then 
      do shell script ¬ 
         "/Applications/xampp/xamppfiles/mampp restart" with administrator privileges 
       
   else if button returned of dialogReply is "Exit" then 
      return 
       
   end if 
end if