Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Provided Automation and Preventing app auto-exit #34

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,23 @@
# Adobe Discord Rich Presence

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/719bbef946084e78b20a1c7c63420e86)](https://www.codacy.com/app/imsmokie/adobe-rpc?utm_source=github.com&utm_medium=referral&utm_content=smokes/adobe-rpc&utm_campaign=Badge_Grade)
[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg?logo=python)](https://www.python.org/)
<a href="https://www.autohotkey.com">
<img src="https://img.shields.io/badge/Made%20With-AutoHotKey-006fff?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAHp0lEQVRYhYVXzY8cRxX/VXX3zH7M7qx3bdnexNEesBNLTuJgCQvJiUkkFCQi5cwBmfwLwAElNx8CEgaJC4cg5YYEUTgbEcUIIkeAAIGMDLI3Jsbser074+x4vrq7qt5Dr6q6Z2YNomdK9dE1816993u/90oBgE41yNJXAHxrZaP9ebDKnHMMMFh2MMsXfo74aAAU52oyrncohDlTGCRKKQUq75V/B/AjpdXPmBhKJQrs+NsLawvff+PKJZx88SR65T52R3vYN/sY2REsWzhycKDwYYJjF9bYhTnC2DHBsovzsJ9F+0SUYoxvjNH54R7MtvkuNN5MwHh56Ujrp9+79jZee/U1pDoVbVGmBfIkh8kMKCOgCaiG8j03GJxx6Osm6wSKc0rZj1Umv0NQIAEWzi9g4cIChteGL1Kffp9A4ReXrnz9+OtffR3d7YegkjDI++gOu/hs9BlG4xHKsoQ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AD+A0qCM47z9W1nAAAAAElFTkSuQmCC"/>
</a>
[![GitHub issues](https://img.shields.io/github/issues/smokes/adobe-rpc.svg)](https://GitHub.com/smokes/adobe-rpc/issues/)
[![Visitor count](https://shields-io-visitor-counter.herokuapp.com/badge?page=smokes.adobe-rpc&color=C3447A&logo=GitHub&logoColor=FFFFFF&label=Visits)](https://github.com/bBSempai/adobe-rpc/)

Rich Presence for Discord to display what you're currently doing in most of adobe's applications

**UPDATE:** The script is now AUTOMATED! (Automation provided by [bBSempai](https://github.com/bBSempai))

## Requirements

- Python 3.4+ with Pip
- If you're running a 64bit version of python, download the pywin32 binaries from [here!](https://github.com/mhammond/pywin32/releases)
- Adobe apps (obviously)
- [AutoHotKey (AHK)](https://www.autohotkey.com) **For AUTOMATION of your RPC**

## How to use

Expand All @@ -22,9 +29,26 @@ Rich Presence for Discord to display what you're currently doing in most of adob
- Run the script `$ python rpc.py`
- Enjoy!

OR just download the **.exe** from the [releases!](https://github.com/smokes/adobe-rpc/releases) page and run it!

## For Automation of the RPC

- Upon running an AHK script you can automate your tasks. Here we have two scripts:<br>**1)**[**RPC.ahk**](https://github.com/smokes/adobe-rpc/blob/master/RPC.ahk) which would ensure running of the [**RPC.exe**](https://github.com/smokes/adobe-rpc/releases) in the background upon startup and also "re-run" it as soon as it gets terminated due to closing of any Adobe app or Discord.<br>**2)**[**Failsafe.ahk**](https://github.com/smokes/adobe-rpc/blob/master/failsafe.ahk) which would be helpful if any inconvenience occurs such as if Discord stops displaying your RP even though the **.exe** file is running along with your Adobe application and Discord (Trust me, it happens and I don't know why or what bug causes it. Subject to improvement). The script would, upon certain specific keypress(CTRL+ALT+SHIFT+\` by default; can be edited), kill the **.exe** file which is already running and re-run it.<br>Look at the script codes yourselves to understand properly if you want.
- Now in order to automate your RPC all you have to do is keep these scripts running in background. Don't worry, they will literally consume almost negligible memory leaving no trace in your taskbar and tray. If needed, you can manually control them from the Task Manager window. All you gotta do to make them autorun is follow the steps below:
- Install [AHK](https://www.autohotkey.com) (Takes up <15 Mb worth of space)
- Set your AHK file to run automatically on startup everytime you boot. If you already don't know how to then just follow these instructions:
- RUN shell:startup<br><br>
<img src = "https://i.imgur.com/Umr4unL.jpeg" /><br><br>
- It will open this directory -> (C:\Users\<NAME>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup)<br><br>
<img src = "https://i.imgur.com/J1FjIFH.png"/><br><br>
- If the directory (Startup Folder) doesn't already exist...THEN MAKE ONE 🙂
- Place your .AHK file **shortcuts** in this directory. Now your AHK files will run on startup every time you boot up your PC. **Meaning** the RPC.exe will run automatically now upon startup in hidden mode and would also not stop running even if you close your Adobe app or Discord. For further knowledge of the scripts' working you can check out the instructional comments provided in the scripts themselves. Restart your setup and Voila! It should be working perfectly!

**Note: You can always manually control the rpc.exe and the .ahk files from the Task Manager window if any issues occur.**

## Binaries

The easiest way to use **adobe-rpc** is to download the **.exe** from the [releases!](https://github.com/smokes/adobe-rpc/releases) page.
The easiest way to use **adobe-rpc** is to download the **.exe** and **.ahk** files from the [releases!](https://github.com/smokes/adobe-rpc/releases) page.

## Preview

Expand All @@ -38,10 +62,15 @@ The easiest way to use **adobe-rpc** is to download the **.exe** from the [relea

- Macos support
- Better error handling
- Prevent app from exiting when Discord or any app isn't running.

## Contributing

**adobe-rpc** currently doesn't support: Media Encoder, Xd and Audition. Please submit a PR where you add an app that we haven't included yet to the file **meta.json**, where you specify the app's process name.

<p align="center">Feel free to contact us regarding anything you need help with!</p>

<p align="center">
<a href="https://GitHub.com/smokes/adobe-rpc/issues/new"><b><i>Feel free to open an issue and communicate!</i></b><br></a>
</p>

[header]: https://i.imgur.com/zGFYunZ.png "Repo header"
27 changes: 27 additions & 0 deletions RPC.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
;----------------------------------------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------------------------------------

#NoTrayIcon ;Used for removing icon in the Taskbar System tray.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

;----------------------MAIN CODE STARTS HERE--------------------------------

DetectHiddenWindows, On ;For detecting hidden windows

Run, C:\Discord-Rich Presence\RP-Adobe\rpc.exe, ,Hide ;Run .exe file in hidden mode.

Loop ;Loops till the file itself is not externally terminated.
{
WinWait, ahk_exe rpc.exe ;Waits for the .exe file to exist.
WinWaitClose, ahk_exe rpc.exe ;Waits for the .exe file to close.
Sleep, 2500 ;Sleep for 2.5 seconds.
Run, C:\Discord-Rich Presence\RP-Adobe\rpc.exe, ,Hide ;Runs the .exe file again in hidden mode.
}

;----------------------------------------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------------------------------------

;THE CODE WONT WORK WITHOUT INSTALLING AUTOHOTKEY (AHK)
25 changes: 25 additions & 0 deletions failsafe.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
;----------------------------------------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------------------------------------

#NoTrayIcon ;Used for removing icon in the Taskbar System tray.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

;----------------------MAIN CODE STARTS HERE--------------------------------

^!+`:: ;Shows the Keypress CTRL(^) + ALT(!) + SHIFT(+) + BACKTICK(`) which executes the command. Can be changed according to the user by applying appropriate custom keypress.
WinShow, ahk_exe rpc.exe ;Unhides the hidden .exe file.
WinKill, ahk_exe rpc.exe ;Kills the .exe service.
WinWaitClose, ahk_exe rpc.exe ;Waits for the .exe file to close.
Run, C:\Discord-Rich Presence\RP-Adobe\rpc.exe, ,Hide ;Runs the .exe file again in hidden mode.
MsgBox, failsafe activated ;Optional msg to confirm the execution of the commands. CAN BE DEACTIVATED BY ADDING A SEMICOLON(;) AT THE START OF THE COMMAND ON THIS LINE (LINE 17)
return

ExitApp

;----------------------------------------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------------------------------------

;THE CODE WONT WORK WITHOUT INSTALLING AUTOHOTKEY (AHK)