I have a process where I copy a link from a webpage, close that page, paste that link in the tab behind it, and then want to move my mouse to where that link was pasted.
I am familiar with using Find/Search Text on Screen & Move Mouse.
. But I have to enter the text to search. I am looking for a way to say "search for the contents of the clipboard" since I just copied the link.
Nevermind! I found an alternate method/process that will work.
ah sorry, I was about to reply this morning but then the kids started screaming bloody murder
For future reference, even if you don't need it anymore:
1.) Save the clipboard content to a variable:
async function loadClipboardIntoVariable() {
let clipboardContent = await get_clipboard_content();
await set_string_variable({variableName: "clip", to: clipboardContent})
return clipboardContent; //just to see it in the script result
}
2.) Reference that variable in the find / search text action by putting it in curly braces:
Or alternatively do everything in JavaScript:
async function searchClipboardContentOnScreen() {
let clipboardContent = await get_clipboard_content();
let actionDetails = {
BTTFindImageSearchRegion: 0,
BTTFindTextSearchDirection: 0,
BTTActionWaitForConditionsInterval: 1,
BTTActionWaitForConditionsTimeout: 10,
BTTFindTextMatchMode: 1,
BTTFindTextContinueActionExecution: 0,
BTTFindText: clipboardContent,
BTTFindTextRequiredOccurences: 0,
BTTFindTextMoveMouseTo: 2,
BTTFindTextSearchOn: 5,
};
let result = undefined;
result = await trigger_action({
json: JSON.stringify({
BTTActionCategory: 0,
BTTPredefinedActionType: 426,
BTTPredefinedActionName: "Find or Search Text on Screen & Move Mouse",
BTTGenericActionConfig2: JSON.stringify(actionDetails),
BTTEnabled2: 1,
}),
wait_for_reply: true,
});
}