Microsoft Agent and Module:Redirect: Difference between pages

From Frontierpedia, the Microsoft Agent encyclopedia
(Difference between pages)
frontierpediav5>WikiSysop
(ok everyone can stop being upset about it now removed the links)
 
en>Johnuniq
(restore p.getTargetFromText which is used by Module:RfD which is causing "Lua error in Module:RfD at line 87: attempt to call upvalue 'getTargetFromText' (a nil value)")
 
Line 1: Line 1:
{{Featured article}}{{Infobox software|title=Microsoft Agent|software_name=Microsoft Agent|logo=AgentSvrIconEnlarged64px.png|developer=Microsoft|latest release date=September 21st, 2009 ({{time_ago|September 21st, 2009}})|latest version=6.1.7600.16426|released=September 8th, 1997 ({{time_ago|September 8th, 1997}})|programming language=C++|operating system=Microsoft Windows|discontinued=Yes|screenshot=Microsoft_Agent_mash_screenshot_gif.png|caption=Microsoft Agent software being used in the [[Microsoft Agent Scripting Helper]].}}
-- This module provides functions for getting the target of a redirect page.


Microsoft Agent was a technology developed by [[wikipedia:Microsoft|Microsoft]] that allows for users to interact with animated characters inside applications and web pages. It used text to speech engines to allow the animated characters to speak to the end user. These animated characters were called "Microsoft Agents". It came preinstalled with [[wikipedia:Microsoft_Windows|Windows]] beginning with [[wikipedia:Windows_98|Windows 98]]. Microsoft Agent continued to release alongside all Windows versions until [[wikipedia:Windows_7|Windows 7]] in 2009, following Microsoft's discontinuation of Microsoft Agent. The latest release of Microsoft Agent was version 2.0 on October 12th, 1998.
local p = {}


== Characters ==
-- Gets a mw.title object, using pcall to avoid generating script errors if we
Microsoft Agent allowed for users of the software to make characters through the [[Microsoft Agent Character Editor]]. Four default characters were made by Microsoft on the original page, including Genie, Merlin, Peedy, and Robby. Some other notable characters are those featured in the [[wikipedia:Microsoft_Office|Microsoft Office suite]] throughout 1997 to 2003, including Clippy, Dot, or Office Logo. The Windows XP search assistants are also Microsoft Agents, including Rover. Another mentionable Microsoft Agent is Bonzi, a purple gorilla that came bundled [[BonziBuddy|BonziBUDDY]] until its discontinuation. The Bonzi character later received a lot of attention after being a meme following multiple meme videos on it before [https://vinesauce.fandom.com/wiki/Joel Vinesauce Joel] eventually streamed an XP destruction causing the popularity of the Bonzi character to rise.
-- are over the expensive function count limit (among other possible causes).
local function getTitle(...)
local success, titleObj = pcall(mw.title.new, ...)
if success then
return titleObj
else
return nil
end
end


== File format ==
-- Gets the name of a page that a redirect leads to, or nil if it isn't a
Microsoft Agent characters could be exported in the .ACS file extension and served as the character file. There is also a .ACD format used by MACE that is the project file for the character. The .ACF is another format of a Microsoft Agent character meant for web usage.
-- redirect.
function p.getTargetFromText(text)
local target = string.match(
text,
"^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]|]-)%]%]"
) or string.match(
text,
"^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]|]-)|[^%[%]]-%]%]"
)
return target and mw.uri.decode(target, 'PATH')
end


== Post-Vista support ==
-- Gets the target of a redirect. If the page specified is not a redirect,
Although Microsoft Agent was discontinued following the release of Windows 7 in 2009, it was still able to be used via installing Microsoft Agent's components from the Microsoft Agent installer. This allowed for operating systems that came after [[wikipedia:Windows_Vista|Windows Vista]] to run the software. Microsoft also made a hotfix for Windows 7 that allowed for Microsoft Agent to be installed. This version of Microsoft Agent is the same as version 2.0 but with support for Aero and SAPI 5 as the speech engine. The hotfix link was taken down following the end of support for Windows 7 in 2020.
-- returns nil.
function p.getTarget(page, fulltext)
-- Get the title object. Both page names and title objects are allowed
-- as input.
local titleObj
if type(page) == 'string' or type(page) == 'number' then
titleObj = getTitle(page)
elseif type(page) == 'table' and type(page.getContent) == 'function' then
titleObj = page
else
error(string.format(
"bad argument #1 to 'getTarget'"
.. " (string, number, or title object expected, got %s)",
type(page)
), 2)
end
if not titleObj then
return nil
end
local targetTitle = titleObj.redirectTarget
if targetTitle then
if fulltext then
return targetTitle.fullText
else
return targetTitle.prefixedText
end
else
return nil
end
end


== Online resurgence ==
--[[
Following multiple memes of the Bonzi Microsoft Agent character and Vinesauce Joel eventually covering it inside one of his Windows destruction livestreams, a large resurgence of popularity in Microsoft Agent. However, this lead to collapse of the [[2nd Microsoft Agent Community]], an entity that had existed since 2001. Afterwards, many small meme-lord communities existed making meme content out of the Bonzi MS Agent, before eventually dying out. Afterwards, [[Spidermanboy13]] and [[Norbika9Entertainment]] had founded [[The Microsoft Agent Community]] sometime in 2015, with Norbika9Entertainment fully taking over by 2016. This community was influenced by [[wikipedia:Vyond|Vyond]] and survived until April 2018, when [[Operation Butler]] had overthrown Norbika9Entertainment causing the influence to shift to object show community influence. This lasted until May 25th, 2018, when [[The Microsoft Agent Frontier Empire]] was founded with mapping influence. TMAFE successfully united many Microsoft Agent communities they could find in 2018 and eventually getting recognition from the 2nd Microsoft Agent Community as the official successor to them.  
-- Given a single page name determines what page it redirects to and returns the
-- target page name, or the passed page name when not a redirect. The passed
-- page name can be given as plain text or as a page link.
--
-- Returns page name as plain text, or when the bracket parameter is given, as a
-- page link. Returns an error message when page does not exist or the redirect
-- target cannot be determined for some reason.
--]]
function p.luaMain(rname, bracket, fulltext)
if type(rname) ~= "string" or not rname:find("%S") then
return nil
end
bracket = bracket and "[[%s]]" or "%s"
rname = rname:match("%[%[(.+)%]%]") or rname
local target = p.getTarget(rname, fulltext)
local ret = target or rname
ret = getTitle(ret)
if ret then
if fulltext then
ret = ret.fullText
else
ret = ret.prefixedText
end
return bracket:format(ret)
else
return nil
end
end


== Versions ==
-- Provides access to the luaMain function from wikitext.
{| class="wikitable"
function p.main(frame)
|+
local args = require('Module:Arguments').getArgs(frame, {frameOnly = true})
!Version number
return p.luaMain(args[1], args.bracket, args.fulltext) or ''
!Date
end
!Confirmed?
!Link
|-
|[[Microsoft Agent Beta]]
|October 28th, 1996
|Yes
|N/A
|-
|Microsoft Agent Beta 2.0
|June 18th, 1997<ref>https://news.microsoft.com/1997/06/18/new-microsoft-agent-beta-2-0-allows-creation-of-interactive-characters-for-internet-and-activex-based-applications/</ref>
|Yes
|N/A
|-
|Microsoft Agent 1.0
|1997
|No
|N/A
|-
|[[Microsoft Agent 1.3]]
|1997
|Yes
|N/A
|-
|[[Microsoft Agent 1.5]]
|September 8th, 1997<ref>https://news.microsoft.com/1997/09/08/microsoft-agent-released-to-the-web-for-free-download/</ref>
|Yes
|http://tmafe.com/downloads/MSagent_1.5_setup.zip
|-
|[[Microsoft Agent 1.6]]
|1997
|Yes
|N/A
|-
|[[Microsoft Agent 1.7]]
|1997
|Yes
|http://tmafe.com/downloads/MSagent_1.7_files.zip
|-
|[[Microsoft Agent 2.0]]
|October 12th, 1998<ref>https://news.microsoft.com/1998/10/12/microsoft-agent-2-0-adds-a-more-human-touch-to-computing/</ref>
|Yes
|http://tmafe.com/downloads/MSagent_2.0_setup.zip
|}


== Version History ==
-- Returns true if the specified page is a redirect, and false otherwise.
function p.luaIsRedirect(page)
local titleObj = getTitle(page)
if not titleObj then
return false
end
if titleObj.isRedirect then
return true
else
return false
end
end


* October 28th, 1996 - Microsoft Agent Beta announced on MSDN.
-- Provides access to the luaIsRedirect function from wikitext, returning 'yes'
* 1997 - Microsoft Agent 1.0 released.
-- if the specified page is a redirect, and the blank string otherwise.
* September 8th, 1997 - Microsoft Agent 1.5, the first public version, was released.
function p.isRedirect(frame)
* October 12th, 1998 - Microsoft Agent 2.0 released.
local args = require('Module:Arguments').getArgs(frame, {frameOnly = true})
if p.luaIsRedirect(args[1]) then
return 'yes'
else
return ''
end
end


== Trivia ==
return p
 
* Microsoft Agent utilizes animated desktop assistants alongside text to speech engines.
* Microsoft Agent first came bundled with Windows 98 and continued to be bundled with Windows until Windows 7.
* Microsoft released a hotfix for Microsoft Agent compatibility on Windows 7 following announcing the discontinuation of Microsoft Agent.
** The version in the hotfix is Microsoft Agent 6.1.7600.16426, but a bug causes it to appear as 6.01.7600.16426 in the Properties menu. It is very likely that it is the same bug that makes 2.0's version appear as 2.00 instead of 2.0.
** The hotfix link was taken down following the end of support for Windows 7.
* Genie, Merlin, Peedy, and Robby were the original four assistants developed by Microsoft.
* The release date of Microsoft Agent 2.0 is disputed. The 2nd Microsoft Agent Community had documented Microsoft Agent 2.0 releasing on October 12th, 1998, while the build date of "AgentSvr.exe" stating October 2nd, 1998. However, a Microsoft news article confirmed that the 2nd Microsoft Agent Community is right, and that there tends to be small gaps between build dates and release dates in Microsoft products.
* The "AgentSvr.exe" program is strangely compiled in Visual C++ debug mode rather than in Visual C++ release mode.
* Despite Microsoft Agent 6.1's and Microsoft Agent 5.2's version numbers, they are still Microsoft Agent 2.0 but with bug fixes and SAPI 5.0 support.
* Microsoft Agent was removed early on in Windows 7's development, as the earliest available build (Windows 7 build 6469) does not contain the files for Microsoft Agent.
 
== References ==
{{reflist}}
[[Category:Software]]
{{MSAgent namespace navbox}}

Revision as of 07:46, 10 September 2021

Documentation for this module may be created at Module:Redirect/doc

-- This module provides functions for getting the target of a redirect page.

local p = {}

-- Gets a mw.title object, using pcall to avoid generating script errors if we
-- are over the expensive function count limit (among other possible causes).
local function getTitle(...)
	local success, titleObj = pcall(mw.title.new, ...)
	if success then
		return titleObj
	else
		return nil
	end
end

-- Gets the name of a page that a redirect leads to, or nil if it isn't a
-- redirect.
function p.getTargetFromText(text)
	local target = string.match(
		text,
		"^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]|]-)%]%]"
	) or string.match(
		text,
		"^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]|]-)|[^%[%]]-%]%]"
	)
	return target and mw.uri.decode(target, 'PATH')
end

-- Gets the target of a redirect. If the page specified is not a redirect,
-- returns nil.
function p.getTarget(page, fulltext)
	-- Get the title object. Both page names and title objects are allowed
	-- as input.
	local titleObj
	if type(page) == 'string' or type(page) == 'number' then
		titleObj = getTitle(page)
	elseif type(page) == 'table' and type(page.getContent) == 'function' then
		titleObj = page
	else
		error(string.format(
			"bad argument #1 to 'getTarget'"
				.. " (string, number, or title object expected, got %s)",
			type(page)
		), 2)
	end
	if not titleObj then
		return nil
	end
	local targetTitle = titleObj.redirectTarget
	if targetTitle then
		if fulltext then
			return targetTitle.fullText
		else
			return targetTitle.prefixedText
		end
	else
		return nil
	end
end

--[[
-- Given a single page name determines what page it redirects to and returns the
-- target page name, or the passed page name when not a redirect. The passed
-- page name can be given as plain text or as a page link.
--
-- Returns page name as plain text, or when the bracket parameter is given, as a
-- page link. Returns an error message when page does not exist or the redirect
-- target cannot be determined for some reason.
--]]
function p.luaMain(rname, bracket, fulltext)
	if type(rname) ~= "string" or not rname:find("%S") then
		return nil
	end
	bracket = bracket and "[[%s]]" or "%s"
	rname = rname:match("%[%[(.+)%]%]") or rname
	local target = p.getTarget(rname, fulltext)
	local ret = target or rname
	ret = getTitle(ret)
	if ret then
		if fulltext then
			ret = ret.fullText
		else
			ret = ret.prefixedText
		end
		return bracket:format(ret)
	else
		return nil
	end
end

-- Provides access to the luaMain function from wikitext.
function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame, {frameOnly = true})
	return p.luaMain(args[1], args.bracket, args.fulltext) or ''
end

-- Returns true if the specified page is a redirect, and false otherwise.
function p.luaIsRedirect(page)
	local titleObj = getTitle(page)
	if not titleObj then
		return false
	end
	if titleObj.isRedirect then
		return true
	else
		return false
	end
end

-- Provides access to the luaIsRedirect function from wikitext, returning 'yes'
-- if the specified page is a redirect, and the blank string otherwise.
function p.isRedirect(frame)
	local args = require('Module:Arguments').getArgs(frame, {frameOnly = true})
	if p.luaIsRedirect(args[1]) then
		return 'yes'
	else
		return ''
	end
end

return p