C
C#3y ago
Jiodi

❔ Problem with Visual Studio C#

Why do you need it. Like for what.
52 Replies
Miki_Official
Miki_Official3y ago
I want to make code that will auto paste link into google
Jiodi
JiodiOP3y ago
Ok but like from what? A google extension?
Thinker
Thinker3y ago
Why do you need this? If you want to open a website you can just do that through Process
Miki_Official
Miki_Official3y ago
i know
Thinker
Thinker3y ago
Then why not use that?
Miki_Official
Miki_Official3y ago
i need to copy and paste certian code for a web page @thinker227
Thinker
Thinker3y ago
wat Describe in words what you are trying to do.
Pobiega
Pobiega3y ago
input automation, like a password manager?
Miki_Official
Miki_Official3y ago
using System; using System.Windows.Forms; using TextCopy; class Program { static void Main(string[] args) { string textToCopy = "Hello, world!"; // Copy the text to clipboard Clipboard.SetText(textToCopy); // Wait for a moment to ensure clipboard has the text System.Threading.Thread.Sleep(100); // Use SendKeys to send Ctrl+V to paste the text SendKeys.Send("^v"); // Clear the clipboard Clipboard.Clear(); } } @thinker227
Thinker
Thinker3y ago
what does this have to do with opening websites
Miki_Official
Miki_Official3y ago
bruh can you just help me
Thinker
Thinker3y ago
What are you trying to do? Are you trying to open a website from code?
Miki_Official
Miki_Official3y ago
ye just help me
Thinker
Thinker3y ago
One second.
Miki_Official
Miki_Official3y ago
please
Thinker
Thinker3y ago
Process.Start(new ProcessStartInfo()
{
FileName = "https://www.youtube.com/watch?v=oT3mCybbhf0",
UseShellExecute = true
});
Process.Start(new ProcessStartInfo()
{
FileName = "https://www.youtube.com/watch?v=oT3mCybbhf0",
UseShellExecute = true
});
Miki_Official
Miki_Official3y ago
ye i did this already now i need to paste text like open youtube and just SEARCH for rickroll or something
Thinker
Thinker3y ago
wat Paste text?
Miki_Official
Miki_Official3y ago
ye copy text from clipboard and paste itr
Thinker
Thinker3y ago
paste it where
Miki_Official
Miki_Official3y ago
dont know
Thinker
Thinker3y ago
so you don't know what you're trying to do
Miki_Official
Miki_Official3y ago
like in notepad ok open notepad paste text from clipboard nothing else
Miki_Official
Miki_Official3y ago
Miki_Official
Miki_Official3y ago
code + errors what's wrong there?
Thinker
Thinker3y ago
Clipboard does not contain a definition for Clear
Miki_Official
Miki_Official3y ago
so how do i clear the clipboard?
Thinker
Thinker3y ago
What library are you using
Miki_Official
Miki_Official3y ago
Miki_Official
Miki_Official3y ago
? wdym
Thinker
Thinker3y ago
TextCopy?
Miki_Official
Miki_Official3y ago
i dont know
Thinker
Thinker3y ago
GitHub
GitHub - CopyText/TextCopy: A cross platform package to copy text t...
A cross platform package to copy text to and from the clipboard. - GitHub - CopyText/TextCopy: A cross platform package to copy text to and from the clipboard.
Miki_Official
Miki_Official3y ago
ye but it dont recognize the clipboard
Miki_Official
Miki_Official3y ago
Miki_Official
Miki_Official3y ago
i fixed few errors 2 more to go
Thinker
Thinker3y ago
If you read the documentation of the library, you'll see that you should use ClipboardService.SetText instead of Clipboard.SetText
Miki_Official
Miki_Official3y ago
lool
Thinker
Thinker3y ago
And I'd guess that "clearing" the clipboard would amount to ClipboardService.SetText("");
Miki_Official
Miki_Official3y ago
fixed thank you can i ping you when i ran to new problem?
Thinker
Thinker3y ago
no
Miki_Official
Miki_Official3y ago
k bye
Thinker
Thinker3y ago
Also instead of that Thread.Sleep you should really be using await ClipboardService.SetTextAsync(yourText); which waits for the text to be set
Miki_Official
Miki_Official3y ago
should i?
Thinker
Thinker3y ago
yes, yes you probably should
Miki_Official
Miki_Official3y ago
yo and if i have 2 .cs codes
Miki_Official
Miki_Official3y ago
Miki_Official
Miki_Official3y ago
when i ran it, will it start both of them?
Thinker
Thinker3y ago
It will run the method called Main, or the file containing top-level code
Miki_Official
Miki_Official3y ago
wtf, is this
Jiodi
JiodiOP3y ago
Dude you're not a very good helpee Also if you're hacking some opening a page and copy pasting crap just use selenium or something
Accord
Accord3y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?