AAIR (Aaon's AIO iChat Remote)

easier:

on AAIR()
	return "The internal IP of this computer is: " & IPv4 address of (system info)
end AAIR

:slight_smile: Thanks a lot Stefan!

He is the Man! This project wouldn’t be here if it wasn’t for him.

:slight_smile:

Still having troubles with the script that I added the internal IP command to… every time I type a command I get an error saying “missing value doesn’t understand the AAIR message”

Working on a new way of calling commands from the main script:

set theCommand to {{"time", "time.scpt"}, {"process", "process.scpt"}, {"uptime", "uptime.scpt"}}

It’s a list of lsits!

Here’s a little nugget of what I’m working on.

set staticCommand to "process"
set theCommands to {{"time", "time.scpt"}, {"process", "process.scpt"}, {"uptime", "uptime.scpt"}}
set loadCommand to ""
set scriptLoc to ((path to home folder as text) & "Documents:AAIR:")
--set test to item 2 of item 1 of theCommand

repeat with t in theCommands
	set CCommand to item 1 of t
	if staticCommand = CCommand then
		set loadCommand to load script file (scriptLoc & item 2 of t)
	end if
end repeat

set theResponse to loadCommand's AAIR()

This clears up a lot of space. Only need to declare one command property. There will be only one

set theResponse to loadCommand's AAIR()

instead of one for each command. Unfortunately, using this route eliminates any script libraries I had planned.

Using this method I shaved 100kb off the length of the script! Bringing it down to only 16kb for the main script.

Woah! Awesome! When do you think you’ll get to release this? :slight_smile:

Soon, very soon!

Yay! Can’t wait! :slight_smile:

Release soon? :open_mouth:

Release 1.2 beta now. With basic tutorial on how to create plugin. :lol:

I just ran the installer, set it up in iChat too. The code looks good, but the first thing I did, typing the “help” command gave me this message: “Error filtering commands. File file HD:Users:aaonocuments:AAIR:help.scpt wasn’t found. -43”

EDIT: It’s now “Error filtering commands. Can’t make file {missing value, “time.scpt”} into type file. -1700” and it works when I test it with the display dialog.

You forgot to comment out

display dialog "Command to test: " default answer ""
    set theMessage to the text returned of the result
    set theResponse to load(theMessage)
    display dialog theResponse

again!

Also, in your first post, under internal IP you put that it will return the external IP

The installer ran fine then? I thought I cleared up all of the issues in the main AAIR script… I will be taking a look at it. Clearly there is an issue with dynamic vars in terms of setting locations.

That’s a lookup table!
From Rosenthals book (2nd ed.):

----------------------------------------------------------------------
-- From code by Hanaan Rosenthal (book p.463)
-- a lookup table:{{Key 1,Value 1},{Key 2,Value 2},...}
-- parameters:	theTable, a lookup table
--				theKey, some value
-- returns:		thisValue, the value that matches theKey
--				'onbepaald' when not found			
----------------------------------------------------------------------
on getValueForKey(theTable, keyToFind)
	try
		repeat with aPair in theTable
			set {thisKey, thisValue} to aPair
			if thisKey = keyToFind then return thisValue
		end repeat
	on error
		-- set to "onbepaald", or anything suitable
	end try
end getValueForKey

There’s a related method for a list of records here.
I’ve used it to lookup Finder labels by index/color/name.

Using StefanK’s solution : http://macscripter.net/viewtopic.php?id=34436 it now works! :slight_smile:

Updated main AAIR script to reflect StefanK’s fix. Added download on main page. If you are still using the plugins from 1.2 you will get an error on volume, help, and one or two others. This is because previously the splitting of the commands used offest. The new method uses Text item delimiters. With TID, if there is no space staticCommand gets set to theMessage.

I have a tiny little idea for the next update.:smiley:
BUT Since this update is working, and well, there will probably be a slight delay before I push v2.0.

My idea, though, has something to do with the script on this page: http://macscripter.net/viewtopic.php?id=11362

Hmmm what could it be?:D:D:D:D

I can’t wait, must share little bit of script :smiley:

set theCommands to {}
set AAIRDir to ((path to home folder as text) & "Documents:AAIR") as alias
tell application "Finder"
	set filelist to every file of the AAIRDir
	repeat with currentFile in filelist
		set currentFileName to (the name of currentFile)
		copy currentFileName to the end of theCommands
	end repeat
end tell
choose from list theCommands

Just give it a little run… =) ☃

Ohh right! I see what you’re getting at… I think I did have the same idea! :slight_smile: