I need help!!!! (this applescript can get to quit after run)

Discussion in 'Mac Programming' started by qb-animation, Sep 1, 2009.

  1. qb-animation macrumors newbie

    Joined:
    Sep 1, 2009
    #1
    I need help!!!!

    with this applescript can get to quit after run and applescript with close on OSX shutdown.

    thank you for your help


    Code:
    (*Steve Jørgensen, Copyright ® 2009 qb-animation.org *)
    
    -- Du skal først indtaste brugernavn og adgangskode som står nederst i applescriptet
    
    
    
    
    global UserName
    global ServerName
    global passwd
    
    on ActivateTerminal()
    	set ScriptCommand to "ssh -T " & UserName & "@" & ServerName
    	
    	tell application "Terminal"
    		do script ScriptCommand
    		tell application "System Events"
    			keystroke "m" using {command down, option down}
    		end tell
    		delay 2
    		do script passwd in window 1
    	end tell
    	
    end ActivateTerminal
    
    on ActivateTerminal2()
    	
    	set ScriptCommand to "ping -i 15 google.com"
    	display dialog "K-Net Utility" & return & return & ¬
    		"Du er nu logget på K-Net 
    Vil du starte keep alive, som hjælper dig med at holde internetsforbindelsen oppe?" buttons {"Cancel", "OK"} default button 1
    	
    	set hostname to "www.google.com"
    	do shell script "ping -i 15 " & hostname
    	
    	
    end ActivateTerminal2
    
    on ActivateTerminal3()
    	display dialog "K-Net Utility" & return & return & ¬
    		"Du er nu logget på K-Net 
    Vil Lukke af" buttons {"Cancel", "OK"} default button 1
    	
    	tell application "Terminal"
    		activate
    		
    		contents quit
    		
    		
    	end tell
    end ActivateTerminal3
    
    
    on run
    	set ServerName to "fw2.k-net.dk"
    	
    	set UserName to "xxxx" -- Erstat dit brugernan med XXXXX
    	set passwd to "yyyy" -- Erstat din adgangskode med YYYYY 
    	ActivateTerminal()
    	ActivateTerminal2()
    	ActivateTerminal3()
    end run
    
     

    Attached Files:

  2. `lowell` macrumors newbie

    Joined:
    Aug 20, 2009
    Location:
    San Diego
    #2
    i don't know **** about applescript, but I may be of help just the same.

    this page: http://www.bombich.com/mactips/loginhooks.html lists the keys available for com.apple.loginwindow . using NSUserDefaults is probably over kill for setting a quick logout script once, so if applescript supports wrapping terminal commands, do that. like in the link.

    google must be broken for some people.

    :)
     
  3. qb-animation thread starter macrumors newbie

    Joined:
    Sep 1, 2009
    #3
    Thanks (Problem solve)

    Thanks (Problem solve)
     

Share This Page