Custom App





CodePad

Codepad is an online compiler/interpreter, and a simple collaboration tool. Paste your code below, and codepad will run it and give you a short URL you can use to share it in chat or email.

Install

Download and run the codepad.ameapp file. Copying the codepad.amescript file in c:\

Get the GUID and update the script with that value. The API GUID is specified in the configuration file. The GUID is unique by Application.

[Scripting]
AppPid=3456
GUID={D07F2CEA-696F-47CD-99A9-D31E3641169A}

In the script:

;Amethyst API object.
Local $objAPI = _AutoItObject_ObjCreate("cbi:{D07F2CEA-696F-47CD-99A9-D31E3641169A}")

Features

Custom menu
Script integration

Configuration ameapp

[Install]
AppName=CodePad
Icon=codepad.ico
URL=http://codepad.org/
SkinFolder=default
hotkey=

[Window]
Title=Amethyst -CodePad
Width=
Height=
Border=Y
Transparency=255
ToolBarEnable=N
ToolBarColor=0xFFFFFF
ToolBarSkin=default
ToolBarBackground=N
ToolBarTextinButton=N
ToolBarIconSize=16
BrowserWidth=0
BrowserHeight=0
BrowserLeft=0
ActiveCustomMenu=Y
AlertsUpdate=600000

[Scripting]
AppPid=2592
GUID={18975ADA-8ED5-4F5C-A2EF-0E3A41B3E44E}

[Main Menu]
Submenu, File=
Submenu, Plugin=

[File]
Item, Recent Pastes=Open,http://codepad.org/recent
Item, Get a Project Page=Open,http://codepad.org/mkproj
Item, Copy File content=Script,c:\codepad.amescript
Item, Exit=Exit

[Plugin]
Item, Vim Plugin=Open,http://www.vim.org/scripts/script.php?script_id=2298
Item, Emacs Integration=Open,https://github.com/ruediger/emacs-codepad

Script

#include "C:\Program Files\Amethyst Web2App\lib\IE.au3"
#include "C:\Program Files\Amethyst Web2App\lib\AutoItObject.au3"


;Initialize AutoItObject
_AutoItObject_StartUp()

;Register IE error handler
_IEErrorHandlerRegister ("ErrFunc")

; APP API object. This object is accessible on whole local machine, not only from this script. Local server.
Local $objCodePad = _AutoItObject_ObjCreate("cbi:{18975ADA-8ED5-4F5C-A2EF-0E3A41B3E44E}")

;Get the Internet Explorer APP Browser object.
Local $objIE = $objCodePad.APP

;Call function
_CopyFile($objCodePad,$objIE)



;Function:_CopyFile
;Copy file content in textarea
;
;Parameter:
; $objAPP - APP API object
; $objIE - IE APP object
;
;Return:
; Void

Func _CopyFile($objAPP,$objIE)
Local $sFile
Local $sFileContent
Local $oForms
Local $oText

$sFile = FileOpenDialog("CodePad", @WindowsDir & "\", "Files (*.*)", 1 + 4 )
If @error Then
MsgBox (4096,"","No File(s) chosen")
Else
$sFileContent = FileRead($sFile)
If @error Then
MsgBox(4096,"Error","Function: _CopyFile. Description: File not opened in read mode or other error")
Else
$objAPP.Notification ("CodePad","Copy file content",3)
;Navigate to the home URL.
_IENavigate($objIE,"http://www.codepad.org")
_IELoadWait($objIE)

;Set file content in textarea
$oForms = _IEFormGetCollection ($objIE)
For $oForm In $oForms
$oText = _IEFormElementGetObjByName($oForm, "code")
_IEFormElementSetValue ($oText,$sFileContent)
Next
EndIf
EndIf
EndFunc





;Function
;Custom and the default IE.au3 error handler
;Return:
; Void

Func ErrFunc()
; Important: the error object variable MUST be named $oIEErrorHandler
MsgBox(0,"IE COM Error", "Number: " & $oIEErrorHandler.number & " Description:" & $oIEErrorHandler.windescription)
Exit
EndFunc

Screenshots



Custom menu

Custom notification