Code Monkey home page Code Monkey logo

gnh1201 / welsonjs Goto Github PK

View Code? Open in Web Editor NEW
68.0 5.0 10.0 22.57 MB

WelsonJS - Build a Windows app on the Windows built-in JavaScript engine

Home Page: https://catswords.social/@catswords_oss

License: GNU General Public License v3.0

JavaScript 97.35% HTML 0.08% CSS 2.05% Batchfile 0.01% Inno Setup 0.03% C# 0.34% PowerShell 0.01% Python 0.05% CoffeeScript 0.01% LiveScript 0.07% TypeScript 0.01% Reason 0.01%
wsh javascript windows desktop uri jscript js ie mshta mshtml

welsonjs's Introduction

welsonjs

FOSSA Status DOI

WelsonJS - Build a Windows app on the Windows built-in JavaScript engine.

(Cover Image) A man programming against a power plant facility, the screen that the man is watching shows the Windows logo

Now, You can build an Windows desktop app with JavaScript, TypeScript, CoffeeScript, ReScript, and HTML/CSS on Windows built-in ECMAScript engine.

WelsonJS = Windows + Electron-like + Javascript(JS) + Your contribution

Dual license notice: The default license for this project is GPL 3.0. However, if the GPL 3.0 license is not compatible with Microsoft products, it is subject to the MS-RL license.

Structure

Structure Overview

Specifications

Included modules

  • lib/std (Standard library)
  • lib/system (System interface)
  • lib/base64 (BASE64 encode and decode)
  • lib/file (File I/O interface)
  • lib/http (HTTP client with MSXML/cURL)
  • lib/registry (Windows Registry interface)
  • lib/security (Windows Security Policy interface)
  • lib/shell (Windows Shell (Command Prompt) interface)
  • lib/powershell (Windows Powershell interface)
  • lib/service (Windows Service interface)
  • lib/browser (Modern web compatibility layer)
  • lib/uri (URI scheme interface)
  • lib/winlibs (Windows DLL(Dynamic-link library) interface)
  • lib/autohotkey (AutoHotkey interface)
  • lib/autoit (AutoIt3/AutoItX interface)
  • lib/msoffice (Microsoft Office (e.g. Excel, PowerPoint, Word) interface)
  • lib/gtk (GTK-server and GladeXML supported GUI interface)
  • lib/chrome (Chrome DevTools Protocol based Chrome/Chromium web browser testing interface)
  • lib/pipe-ipc (PIPE-based IPC(Inter-Process Communication) implementation)
  • lib/toolkit (WelsonJS.Toolkit native component)
    • Find and attach a handle of the window
    • alert(), prompt() implementation in console mode
    • Virtualized Human Interfaces
    • Cryptography
    • Named Shared Memory based IPC(Inter-Process Communication) implementation
  • lib/chatgpt (ChatGPT integration)
  • Everything you can imagine.

Make your own sayhello example

1. Write a file lib/sayhello.js

// lib/sayhello.js
function say() {
    console.log("hello");
}

exports.say = say;

exports.VERSIONINFO = "SayHello Library (sayhello.js) version 0.1";
exports.AUTHOR = "[email protected]";   // e.g. YOUR EMAIL ADDRESS
exports.global = global;
exports.require = global.require;

2. Write a file sayhello.js

// sayhello.js
var SayHello = require("lib/sayhello");

function main() {
    console.log("calling say()");
    SayHello.say();
    console.log("ended say()");
}

exports.main = main;

3. Execute file on the command prompt

C:\Users\oss\Documents\GitHub\welsonjs> cscript app.js sayhello
calling say()
hello
ended say()

How to make your own setup file

  • Please check setup.iss file it could be compile with Inno Setup

Screenshots

(Screenshot 1) GUI environment

(Screenshot 2) Command-line environment

(Screenshot 3) WelsonJS with Microsoft Excel

Thanks to

  • Open Software Portal, Korea National Industry Promotion Agency - Awarded Prize
  • Heavy-industry specialized CSP(Cloud Service Provider) in Republic of Korea - Use case establishment
  • Live-commerce specialized online advertisement companies in Republic of Korea - Use case establishment
  • Information security companies in Republic of Korea - Use case establishment
  • morioh.com - Mentioned
  • CSDN - Mentioned
  • Qiita - Knowledge-base about WSH environment
  • Redsky Software - PoC(Proof of Concept) of the CommonJS on WSH environment
  • Inspired by a small-sized JavaScript payload demonstrated by a cybersecurity related group.
  • Inspired by the use of Named Shared Memory in an inter-language IPC implementation devised by an unidentified developer.
  • Fediverse - Mentioned

Related projects

Report abuse

License

FOSSA Status

welsonjs's People

Contributors

dependabot[bot] avatar fossabot avatar gnh1201 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

welsonjs's Issues

[lib/system] More efficient file management for stderr, stdout

[lib/system] More efficient file management for stderr, stdout

Due to the characteristics of WScript, the content of the result of command execution (e.g., stderr, stdout) should be saved as a file. At this time, it is necessary to prepare a plan to manage files more efficiently.

[app] Conflict ES5-shim(sham) 4.5.15 and ES6-shim(sham) 0.35.x

The recently released version of es5-shim 4.5.15 confirmed a conflict with es6-shim.

es5-shim(+sham) es6-shim(+sham) Is it works?
4.5.14 0.35.5 it works
4.5.14 0.35.6 it works
4.5.15 0.35.5 does not work
4.5.15 0.35.6 does not work

We will soon take a closer look at this matter.

[lib/std] Enumerator.prototype.toArray() returned null

[lib/std] Enumerator.prototype.toArray() returned null

WMI.execQuery("select * from Win32_NetworkAdapterConfiguration where IPEnabled = 'True'").fetchAll() -> { ... }
WMI.execQuery("Select * From Win32_Process").fetchAll() -> null   /******* bug *******/

[lib/system] Porting Squel.js to WelsonJS (WMI SQL on WSH)

WelsonJS supports WMI Query (working on Microsoft WSH), which has standard SQL syntax. for example:

// lib/system.js:L53
return WMI.execQuery("SELECT * FROM Win32_OperatingSystem").fetch().get("Caption").rtrim();
// lib/system.js:L65
return WMI.execQuery("SELECT * FROM Win32_OperatingSystem").fetch().get("OSArchitecture");
// lib/system.js:L69
return WMI.execQuery("SELECT * FROM Win32_ComputerSystemProduct").fetch().get("UUID").toLowerCase();
// lib/system.js:L112
return WMI.execQuery("SELECT * FROM Win32_NetworkAdapterConfiguration").fetchAll();
// lib/system.js:L171
return WMI.execQuery("Select * From Win32_PingStatus where address='" + address + "'").fetch().get("ResponseTime");

We want to simplify this using the SQL query builder as follows. like this:

log(
    squel.select()
        .field("ResponseTime")
        .from("Win32_PingStatus")
        .where("address = '127.0.0.1'")
        .toString()
);
/*  SELECT ResponseTime FROM Win32_PingStatus WHERE (address = '127.0.0.1')  */

but, Squel.js does not work on the Microsoft WSH JavaScript engine. Squel.js can be found at the website below.

This problem is presumed to be caused by Object.defineProperty.

By default, the WSH JavaScript engine has IE 9 level compatibility. WelsonJS uses shim and babel to raise the compatibility level to ES6. However, Object.defineProperty is not fully supported.

[lib/chrome] Nested iframe and shouter code

There is an issue that the code is lengthened when the iframe objects are overlapped.

wbInstance.evaluate("__getDocument().querySelector('#frameA').contentDocument.querySelector('#groupId').value = '8649'");

[app] Stop running this script?

The following error message is output while executing a command from the HTA (including AsyncFunction):

Example of the message

English

Stop running this script? A script on this page is causing your web browser to run slowly. if it continues to run, your computer might become unresponsive.

Korean

이 스크립트의 실행을 멈추시겠습니까? 이 페이지의 스크립트로 인해 웹 브라우저 실행 속도가 느려질 수 있습니다. 스크립트를 계속 실행할 경우 컴퓨터가 응답하지 않을 수 있습니다.

References

[lib/toolkit] Implementation of User prompts (alert, confirm. prompt)

https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html

window.alert(message)
Displays a modal alert with the given message, and waits for the user to dismiss it.

result = window.confirm(message)
Displays a modal OK/Cancel prompt with the given message, waits for the user to dismiss it, and returns true if the user clicks OK and false if the user clicks Cancel.

result = window.prompt(message [, default])
Displays a modal text control prompt with the given message, waits for the user to dismiss it, and returns the value that the user entered. If the user cancels the prompt, then returns null instead. If the second argument is present, then the given value is used as a default.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.