Skip to content

Commit

Permalink
re-init
Browse files Browse the repository at this point in the history
  • Loading branch information
yangyuan committed Dec 29, 2017
0 parents commit f6d257f
Show file tree
Hide file tree
Showing 30 changed files with 2,113 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.idea
.vs
dist
packages
x64
[Dd]ebug
[Rr]elease
StyleCop.Cache
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2014 YANG YUAN

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Rabbit
======
![Build Status](https://6941987.visualstudio.com/_apis/public/build/definitions/11759935-74e5-4a06-843f-9794d369a62d/2/badge)

## News

- Rabbit re-init. (Dec 29, 2017)
- Rabbit packages first release. (Dec 20, 2017)
- Initial commit. (Dec 3, 2014).

## Purposes and Features

Rabbit is designed to use programs to simulate human inputs. Which might be useful in some boring repeating tasks or game bots.

This project contains two sub-projects:

- Rabbit App: An application with embedded scripting support, an alternative of QuickMacro.
- Rabbit-Bot Packages: Packages for Python (PyPI), JavaScript (NPM).

## Usage

### Rabbit App
F7/F8 will start/end the script.
The application will search script.py/script.js/script.lua in order, but only one script will run.

### Rabbit-Bot Packages

#### PyPI

https://pypi.python.org/pypi/rabbit-bot/

`pip install rabbit-bot`

#### NPM

https://www.npmjs.com/package/rabbit-bot

`npm install rabbit-bot`
32 changes: 32 additions & 0 deletions samples/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import rabbit

# Press left Window key
rabbit.keyboard_press_vkey(0x5B)
rabbit.sleep(1000)

# Input 'Notepad'
rabbit.press('N')
rabbit.input('tepad')
rabbit.sleep(1000)

# Press Enter key
rabbit.keyboard_press_vkey(0x0D)
rabbit.sleep(1000)

# Do input
rabbit.input('Hello Rabbit!\n')
rabbit.sleep(1000)
rabbit.input('你好兔子!\n')
rabbit.sleep(1000)

# Find current Window
notepad = rabbit.window_find_focus()
l, t, r, b = rabbit.window_get_rect(notepad)

# Move mouse do doubleclick and then input more
rabbit.moveto(int(l + (r - l)/2), int(t + (b - t)/2))
rabbit.doubleclick()
rabbit.sleep(500)
rabbit.input('Window location: %d %d %d %d\n' % (l, t, r, b))
rabbit.keyboard_press_vkey(0x0D)
rabbit.keyboard_press_vkey(0x0D)
32 changes: 32 additions & 0 deletions src/app/Rabbit.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.15
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Rabbit", "Rabbit.vcxproj", "{7442468C-C7CC-4122-833F-73D613685502}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7442468C-C7CC-4122-833F-73D613685502}.Debug|Win32.ActiveCfg = Debug|Win32
{7442468C-C7CC-4122-833F-73D613685502}.Debug|Win32.Build.0 = Debug|Win32
{7442468C-C7CC-4122-833F-73D613685502}.Debug|x64.ActiveCfg = Debug|x64
{7442468C-C7CC-4122-833F-73D613685502}.Debug|x64.Build.0 = Debug|x64
{7442468C-C7CC-4122-833F-73D613685502}.Debug|x86.ActiveCfg = Debug|Win32
{7442468C-C7CC-4122-833F-73D613685502}.Debug|x86.Build.0 = Debug|Win32
{7442468C-C7CC-4122-833F-73D613685502}.Release|Win32.ActiveCfg = Release|Win32
{7442468C-C7CC-4122-833F-73D613685502}.Release|Win32.Build.0 = Release|Win32
{7442468C-C7CC-4122-833F-73D613685502}.Release|x64.ActiveCfg = Release|x64
{7442468C-C7CC-4122-833F-73D613685502}.Release|x64.Build.0 = Release|x64
{7442468C-C7CC-4122-833F-73D613685502}.Release|x86.ActiveCfg = Release|Win32
{7442468C-C7CC-4122-833F-73D613685502}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
161 changes: 161 additions & 0 deletions src/app/Rabbit.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="packages\v8-v141-x86.5.8.283.38\build\native\v8-v141-x86.props" Condition="Exists('packages\v8-v141-x86.5.8.283.38\build\native\v8-v141-x86.props')" />
<Import Project="packages\v8.redist-v141-x86.5.8.283.38\build\native\v8.redist-v141-x86.props" Condition="Exists('packages\v8.redist-v141-x86.5.8.283.38\build\native\v8.redist-v141-x86.props')" />
<Import Project="packages\v8-v141-x64.5.8.283.38\build\native\v8-v141-x64.props" Condition="Exists('packages\v8-v141-x64.5.8.283.38\build\native\v8-v141-x64.props')" />
<Import Project="packages\v8.redist-v141-x64.5.8.283.38\build\native\v8.redist-v141-x64.props" Condition="Exists('packages\v8.redist-v141-x64.5.8.283.38\build\native\v8.redist-v141-x64.props')" />
<Import Project="packages\python.3.6.3\build\native\python.props" Condition="Exists('packages\python.3.6.3\build\native\python.props')" />
<Import Project="packages\pythonx86.3.6.3\build\native\python.props" Condition="Exists('packages\pythonx86.3.6.3\build\native\python.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\core\rabbit_core.cpp" />
<ClCompile Include="..\core\rabbit_core_utils.cpp" />
<ClCompile Include="..\javascript\rabbit_javascript.cpp" />
<ClCompile Include="..\javascript\rabbit_javascript_utils.cpp" />
<ClCompile Include="..\lua\rabbit_lua.cpp" />
<ClCompile Include="..\python\rabbit_python.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="app.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\core\rabbit_core_common.h" />
<ClInclude Include="..\core\rabbit_core.h" />
<ClInclude Include="..\core\rabbit_core_utils.h" />
<ClInclude Include="..\javascript\rabbit_javascript_utils.h" />
<ClInclude Include="app.h" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{7442468C-C7CC-4122-833F-73D613685502}</ProjectGuid>
<RootNamespace>Rabbit</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\core;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\core;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\core;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\core;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="packages\lua.redist.5.3.4\build\native\lua.redist.targets" Condition="Exists('packages\lua.redist.5.3.4\build\native\lua.redist.targets')" />
<Import Project="packages\lua.5.3.4\build\native\lua.targets" Condition="Exists('packages\lua.5.3.4\build\native\lua.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\python.3.6.3\build\native\python.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\python.3.6.3\build\native\python.props'))" />
<Error Condition="!Exists('packages\pythonx86.3.6.3\build\native\python.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\pythonx86.3.6.3\build\native\python.props'))" />
<Error Condition="!Exists('packages\lua.redist.5.3.4\build\native\lua.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\lua.redist.5.3.4\build\native\lua.redist.targets'))" />
<Error Condition="!Exists('packages\lua.5.3.4\build\native\lua.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\lua.5.3.4\build\native\lua.targets'))" />
<Error Condition="!Exists('packages\v8.redist-v141-x64.5.8.283.38\build\native\v8.redist-v141-x64.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\v8.redist-v141-x64.5.8.283.38\build\native\v8.redist-v141-x64.props'))" />
<Error Condition="!Exists('packages\v8-v141-x64.5.8.283.38\build\native\v8-v141-x64.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\v8-v141-x64.5.8.283.38\build\native\v8-v141-x64.props'))" />
<Error Condition="!Exists('packages\v8.redist-v141-x86.5.8.283.38\build\native\v8.redist-v141-x86.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\v8.redist-v141-x86.5.8.283.38\build\native\v8.redist-v141-x86.props'))" />
<Error Condition="!Exists('packages\v8-v141-x86.5.8.283.38\build\native\v8-v141-x86.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\v8-v141-x86.5.8.283.38\build\native\v8-v141-x86.props'))" />
</Target>
</Project>
Loading

0 comments on commit f6d257f

Please sign in to comment.