Example #1
0
        /// <summary>
        /// Attempts to fill the search field of the stash tab with the current items name if any
        /// </summary>
        private async Task <bool> TriggerFindItem()
        {
            var item = await TriggerCopyAction();

            if (item != null)
            {
                var clipboardContents = await clipboard.GetText();

                // #TODO: trademacro has a lot of fine graining and modifiers when searching specific items like map tier or type of item
                logger.Information("Searching for {itemName}", item.Name);
                await clipboard.SetText(item.Name);

                keyboard.SendInput("Ctrl+F");
                keyboard.SendInput("Ctrl+A");
                keyboard.Paste();
                keyboard.SendInput("Enter");
                await Task.Delay(250);

                await clipboard.SetText(clipboardContents);

                return(true);
            }

            return(false);
        }
Example #2
0
        public async Task Write(string text)
        {
            string clipboardValue = null;

            if (settings.RetainClipboard)
            {
                clipboardValue = await clipboard.GetText();
            }

            await clipboard.SetText(text);

            keyboard.SendInput("Enter");
            keyboard.SendInput("Ctrl+A");
            keyboard.Paste();
            keyboard.SendInput("Enter");
            keyboard.SendInput("Enter");
            keyboard.SendInput("Up");
            keyboard.SendInput("Up");
            keyboard.SendInput("Esc");

            if (settings.RetainClipboard)
            {
                await Task.Delay(100);

                await clipboard.SetText(clipboardValue);
            }

            logger.Information("ChatService - Wrote '{text}' in the chat", text);
        }