Jarvis icon indicating copy to clipboard operation
Jarvis copied to clipboard

New_Plugin_ScreenShot

Open ShreyPatel4 opened this issue 4 years ago • 2 comments

I am New to Open source and I am stuck and need help with defining token/trigger words that activate my plugin increment the progress from here

ShreyPatel4 avatar Aug 29 '21 05:08 ShreyPatel4

import pyautogui
import requests
from colorama import Fore
from plugin import plugin, require, alias
import os

@require(network=True)
@alias("ss", "capture")
@plugin("screenshot")
def ss(jarvis,s):
    jarvis.say("Please give me a moment", Fore.BLUE)
    incr += 1
    incr = str(incr) 
    myScreenshot = pyautogui.screenshot()
    myScreenshot.save(r'./../ss'+incr+'.png')
    if(os.path.isfile('./../ss'+incr+'.png')==False):
        jarvis.say("Success!", Fore.BLUE)
    else:
        jarvis.say("Sorry, an error occured retry using /ss , /screenshot, /capture", Fore.RED)

So, you don't have to call something like CmdInterpreter.input() - the plugin will be called if the user types screenshot and then the parameter s contains everything the user typed apart from screenshot.

Also no need to modify python path ;).

You would just need to initialize incr. Probably use jarvis.get_data(key) and jarvis.update_data(key, data)

https://github.com/sukeesh/Jarvis/blob/master/doc/API.md#get_data

pnhofmann avatar Aug 29 '21 09:08 pnhofmann

yes, I will work on the error.

ShreyPatel4 avatar Aug 30 '21 08:08 ShreyPatel4