------------------------------------------------------------------------------

  Sleipnir API Reference

  Copyright (C) 2002-2004 by Yasuyuki Kashiwagi.
  Copyright (C) 2005-2009 by Fenrir Inc.
  All Rights Reserved.

                Anglicized by S.K.  08/03/07
------------------------------------------------------------------------------

Sleipnir Script works with using Windows Scripting Host (WSH).
Sleipnir read script at <SleipnirFolder>\scripts\

Sleipnir does NOT read folder which name starts with $.
Utilize for saving event script for output or working script.

To use Script, Turn on "Allow script to control Sleipnir" at "Sleipnir Option --> Client". This option is turned off by Default

A part of this API Script does NOT work with Sleipnir right now. This will be mounted via Update.

------------------------------------------------------------------------------
[*] Property
------------------------------------------------------------------------------

(R) - Read Only. You can't configure a value.

[string] AddressBarString Get/Set string of Address Bar.
[string] SearchBarString  Get/Set string of Search Bar.
[string] URL              Get/Set URL of active document.
[long]   ActiveIndex      Get/Set Tab position of active document.
[string] FavoriteFile     Get/Set Favorite File.
[string] AppPath(R)       Return the directory which Sleipnir.exe exists.
[string] ScriptPath(R)    Return the directory which read Scripts exist.
[string] ResourcePath(R)  Return Directory which read resources exist.
[string] UserPath(R)      Return Directory which various setting is saved.
[string] UserAgent        Get/Set UserAgent.
[long]   Handle(R)        Return Window Handle of Sleipnir
[long]   Result           Return Result of Sleipnir API
[long]   Version(R)       Return version of Sleipnir

// 1.30 or higher

[bool]   ShiftDown(R)     Return condition of Shift Key
[bool]   CtrlDown(R)      Return condition of Ctrl Key
[bool]   AltDown(R)       Return condition of Alt Key
[bool]   OutputVisible    Get/Set Output bar visible condition.
[long]   OutputCurSel     Get/Set Selected line at Output bar
[string] OutputScript     Get/Set called Script files when you double-click at output.
                          This script get over /output: selected line as Argument.


------------------------------------------------------------------------------
[*] Method
------------------------------------------------------------------------------

----------------
[long] GetCount
----------------

[Description]
 Return Opened Document numbers

[Argument]
 None

[Return Value]
 Numbers of opened document.


--------------------------------
[long] GetDocumentID(long index)
--------------------------------

[Description]
 Get unique ID of Document.

[Argument]
 index: Tab position( 0 ` GetCount-1 )

[Return Value]
Unique document ID


------------------------------------
[IDispatch] GetWindowObject(long id)
------------------------------------

[Description]
 Get Window Object

[Argument]
 id: Unique Document ID

[Return Value]
 Windows Object's IDispatch


--------------------------------------
[IDispatch] GetDocumentObject(long id)
--------------------------------------

[Description]
 Get HTML Document Object

[Argument]
 id: Unique Document ID

[Return Value]
 Document Object's IDispatch


----------------------------------------
[IDispatch] GetWebBrowserObject(long id)
----------------------------------------

[Description]
 Get WebBrowser Object

[Argument]
 id: Unique document ID

[Return Value]
 WebBrowser Object's IDispatch


----------------------------------------------
[long] NewWindow(string strUrl, bool bActive)
----------------------------------------------

[Description]
 Open new Document

[Argument]
 strUrl: URL of the new document
 bActive: Whether activate new window or not.

[Return Value]
 Opened Unique document ID


----------------------
[void] Close(long id)
----------------------

[Description]
 Close specified Document

[Argument]
 id: Unique document ID

[Return Value]
 None


----------------------------------------
[void] Navigate(long id, string strUrl)
----------------------------------------

[Description]
 Access to optional URL from current document

[Argument]
 id:     Unique document ID
 strUrl: Navigating URLl

[Return Value]
 None


------------------------
[long] GetIndex(long id)
------------------------

[Description]
 Get tab position from Unique document ID

[Argument]
 id: Unique document ID

[Return Value]
Tab position


------------------------------------
[void] MessageBox(string strMessage)
------------------------------------

[Description]
 Display Sleipnir message box

[Argument]
 strMessgae: Displaying Message

[Return Value]
 None


------------------
[void] Beep(void)
------------------

[Description]
 Beep

[Return Value]
 None


----------------------
[BOOL] IsBusy(long id)
----------------------

[Description]
 Figure out if Document is now loading.

[Argument]
 id: Unique document ID

[Return Value]
 True if document is now loading.

----------------------------------------------------------------------------
[void] SetSecurity(long id, BOOL bJavaScript, BOOL bJava, BOOL bRunActiveX,
                   BOOL bDownloadActiveX, BOOL bPicture, BOOL bSound,
                   BOOL bVideo)
----------------------------------------------------------------------------

[Description]
 Set Document's Security

[Argument]
 id:   Unique document ID
 Each value: Each Security


----------------------------------------
[BOOL] IsJavaScriptEnabled(long id)
[BOOL] IsJavaEnabled(long id)
[BOOL] IsRunActiveXEnabled(long id)
[BOOL] IsDownloadActiveXEnabled(long id)
[BOOL] IsPictureEnabled(long id)
[BOOL] IsSoundEnabled(long id)
[BOOL] IsVideoEnabled(long id)
----------------------------------------

[Description]
 Get Document's Security

[Argument]
 id: Unique document ID

[Return Value]
 True when enabled


------------------------------
[BOOL] IsNavigateLock(long id)
------------------------------

[Description]
 Get Navigate-lock states

[Argument]
 id: Unique document ID

[Return Value]
 True when Enabled


----------------------------------------------
[void] SetNavigateLock(long id, BOOL bEnable)
----------------------------------------------

[Description]
 Enable/Disable Navigate-lock

[Argument]
 id:     Unique document ID
 bEnable: True to enable

[Return Value]
 None


----------------------------------------
[BOOL] SaveFavorite(string strFileName)
----------------------------------------

[Description]
 Save Favorites

[Argument]
 strFileName: saving file name(Set full path)

[Return Value]
 True if succeed.


----------------------
[void] SaveClosedURL()
----------------------

***Sleipnir 2.xx doesn't have this API script right now. We are sorry.

[Description]
 Overwrite save last closed page to file.

[Argument]
 None

[Return Value]
 None


------------------------------------------
[BOOL] Search(long id, string strKeyword)
------------------------------------------

***Sleipnir 2.xx doesn't have this API script right now. We are sorry.

[Description]
 Run Find in this page.

[Argument]
 strKeyword: Keyword

[Return Value]
 False when Keyword not found or back to forehand keyword.

------------------------------------------
[void] Hilight(long id, string strKeyword)
------------------------------------------

***Sleipnir 2.xx doesn't have this API script right now. We are sorry.

[Description]
 Run Highlight

[Argument]
 strKeyword: Keyword

[Return Value]
 None


--------------------------------------------------------------------
[void] WriteProfileInt(string strSection, string strKey, long nData)
--------------------------------------------------------------------

[Description]
 Write long type data to <ini_dir>\script.ini

[Argument]
 strSection: Section
 strKey:     Key
 nData:      data

[Return Value]
 None


----------------------------------------------------------------------------
[void] WriteProfileString(string strSection, string strKey, string strData)
----------------------------------------------------------------------------

[Description]
 Write string type data to <ini_dir>\script.ini

[Argument]
 strSection: Section
 strKey:     Key
 strData:    data

[Return Value]
 None


----------------------------------------------------------------------
[long] GetProfileInt(string strSection, string strKey, long nDefault)
----------------------------------------------------------------------

[Description]
 Read long type data from <ini_dir>\script.ini

[Argument]
 strSection: Section
 strKey:     Key
 nDefault:   The Value which returned if key doesn't exist.

[Return Value]
 data


------------------------------------------------------------------------------
[string] GetProfileString(string strSection, string strKey, string strDefault)
------------------------------------------------------------------------------

[Description]
 Read string type data from <ini_dir>\script.ini

[Argument]
 strSection: Section
 strKey:     Key
 strDefault: The value which returned if key doesn't exist

[Return Value]
 data


--------------------------------------------------------------------------
[void] WriteProfileIntCipher(string strSection, string strKey, long nData)
--------------------------------------------------------------------------

[Description]
 Write long type encrypted data to <ini_dir>\script.ini

[Argument]
 strSection: Section
 strKey:     Key
 nData:      data

[Return Value]
 None


------------------------------------------------------------------
[void] WriteProfileStringCipher(string strSection, string strKey,
                                string strData)
------------------------------------------------------------------

[Description]
 Write string type encrypted data to <ini_dir>\script.ini

[Argument]
 strSection: Section
 strKey:     Key
 strData:    data

[Return Value]
 None


----------------------------------------------------------------------------
[long] GetProfileIntCipher(string strSection, string strKey, long nDefault)
----------------------------------------------------------------------------

[Description]
 Read long type encrypted data from <ini_dir>\script.ini

[Argument]
 strSection: Section
 strKey:     Key
 nDefault:   The value which returned if key doesn't exist.

[Return Value]
 data


------------------------------------------------------------------
[string] GetProfileStringCipher(string strSection, string strKey,
                                string strDefault)
------------------------------------------------------------------

[Description]
 Read string type encrypted data from <ini_dir>\script.ini

[Argument]
 strSection: Section
 strKey:     Key
 strDefault: The value which returned key doesn't exist

[Return Value]
 data


----------------------
[BOOL] IsRead(long id)
----------------------

[Description]
 Figure out if Document is read or not.

[Argument]
 id: Unique document ID

[Return Value]
 True if read


------------------------------------------------------
[string] InputBox(string strPrompt, string strDefault)
------------------------------------------------------

[Description]
 Display dialog which input string.

[Argument]
 strPrompt:  Prompt
 strDefault: Default string

[Return Value]
 OK: edited string, Cancel: strDefault.
 *Result: 1(OK), 0(Cancel) is set at property


------------------------------------------
[void] SetAutoRefresh(long id, long nTime)
------------------------------------------

[Description]
 Set time of auto refresh.

[Argument]
 id:    Unique document ID
 nTime: Refresh time(0 ` 1000 b)

[Return Value]
 None


------------------------------
[long] GetAutoRefresh(long id)
------------------------------

[Description]
 Get auto refresh time.

[Argument]
 id: Unique document ID

[Return Value]
 Time of auto refresh(unit of credit = sec)


------------------------
[long] OutputGetCount()
------------------------

[Description]
 Get line number of string at output

[Argument]
 None

[Return Value]
 Line number


----------------------------------
[void] OutputAddString(string str)
----------------------------------

[Description]
 Add string to output

[Argument]
 str: Output string

[Return Value]
 None


----------------------------------------------
[void] OutputInsertString(long n, string str)
----------------------------------------------

[Description]
 Interpolate string to output

[Argument]
 n:   interpolated position
 str: Output string

[Return Value]
 None


--------------------
[void] OutputClear()
--------------------

[Description]
 Clear output

[Argument]
 None

[Return Value]
 None


--------------------------------
[string] OutputGetString(long n)
--------------------------------

[Description]
 Get string from output

[Argument]
 n: got line

[Return Value]
 string


----------------------------------
[void] OutputDeleteString(long n)
----------------------------------

[Description]
 Delete string at output

[Argument]
 n: Deleted line

[Return Value]
 None


----------------------------------------------------------
string MaskedInputBox(string strPrompt, string strDefault)
----------------------------------------------------------

[Description]
 Display dialog which input string protected by mask

[Argument]
 strPrompt:  Prompt
 strDefault: Default string

[Return Value]
 OK: edited string, Cancel: strDefault
 *Result: 1(OK),0(Cancel) at Property

------------------------------------------------------------------------
[long] GetProfileIntEx(string strSection, string strKey, long nDefault,
                       string strFileName)
------------------------------------------------------------------------

[Description]
 Read long type data from INI file specified by strFileName

[Argument]
 strSection:  Section
 strKey:      Key
 nDefault:    The value which returned if Key doesn't exist.
 strFileName: File which read setting

[Return Value]
 data


------------------------------------------------------------------
[string] GetProfileStringEx(string strSection, string strKey,
                            string strDefault, string strFileName)
------------------------------------------------------------------

[Description]
 Read string type data from INI File specified by strFileName. A portion of file return string which nipped by ""

[Argument]
 strSection:  Section
 strKey:      Key
 strDefault:  The value which returned if Key doesn't exist.
 strFileName: File which read setting.

[Return Value]
 data

----------------------------------------------------------
[void] DeleteProfileKey(string strSection, string strKey)
----------------------------------------------------------

[Description]
 Delete optional Key from <ini_dir>\script.ini

[Argument]
 strSection: Section
 strKey:     Key

[Return Value]
 None


------------------------------------------------------------
[long] MsgBox(string strPrompt, string strTitle, long lFlag)
------------------------------------------------------------

[Description]
 Call WinAPI::MessageBox

[Argument]
String which displayed in strPrompt: Messagebox
 strTitle:  Messagebox's Title
 lFlag:     Same value as WinAPI::MessageBox

[Return Value]
 Same as WinAPI::MessageBox' s Return Value


------------------------
[void] ReloadClosedURL()
------------------------

***Sleipnir 2.xx doesn't have this API script right now. We are sorry.

[Description]
 Reread ClosedURL.ini

[Argument]
 None

[Return Value]
 None


--------------------------------------
[void] AddSearchBarHistory(string ss)
--------------------------------------

***Sleipnir 2.xx doesn't have this API script right now. We are sorry.

[Description]
 Add terms to Search bar history. If string already exist, move it to the top.
[Argument]
 ss: Added string

[Return Value]
 None


------------------------------
[void] ExecCommand(long cmdID)
------------------------------

***Sleipnir 2.xx doesn't have this API script right now. We are sorry.

[Description]
 Run optional Sleipnir menu by appointment by cmdID. Refer cmdID from Mouse gesture (Gesture.ini), etc.

[Argument]
 cmdID: Command ID

[Return Value]
 None


--------------------------------------------------
[string] GetUrlHash(string strUrl, long nHashByte)
--------------------------------------------------

[Description]
 Get URL's hash value

[Argument]
 strUrl:    URL to convert
 nHashByte: bytes after convert URL to hash

[Return Value]
 URL hash value


--------------------------------------
[BOOL] ExecuteAction(string strAction)
--------------------------------------

[Description]
 Execute any actions for Sleipnir

[Argument]
 strAction: Action name

[Return Value]
 True if succeeded execute the action


------------------------------------------------------------------------------
