Page 1 of 1

Illegal characters in a link?

Posted: 17 Jan 2022, 01:23
by PepeLapiu
So I have no problems sending a link into a chat box on a specific site. If I go like Send, DuckDuckGo.com/.
But if the link itself is stored in an INI file and extracted into VarLink, AHK won't let me use this: Send, % VarLink
It spews out some illegal character error.
How do I solve this? How do I extract a link with illegal characters in it stored in a variable into a Send command?

Re: Illegal characters in a link?

Posted: 17 Jan 2022, 05:32
by boiler
You'll need to provide some specifics because what you described wouldn't normally be the case. Show the specific error that was displayed, the contents of the .ini file section, and the lines of your script that read that in and send it. It's obviously a lot more helpful to share the error and the actual text that caused it rather than describe it as "some illegal character error."

Actually it sounds more like the error was probably about an illegal character for a variable name. There aren't illegal characters for text that gets sent. I'm thinking your Send command isn't actually as you showed it but rather that you told it to send the contents of the variable name that is contained in your variable, such as this:

Code: Select all

Send, % %VarLink%
...and your link does contain characters that are not allowed for variable names. Showing your actual code should reveal the problem.

Re: Illegal characters in a link?

Posted: 17 Jan 2022, 06:37
by swagfag
link probably contains %-encoded unicode chars
change the code to

Code: Select all

Send % "{Text}" theVar

Re: Illegal characters in a link?

Posted: 17 Jan 2022, 07:47
by boiler
That would make sense. I was taking his link example DuckDuckGo.com/ at face value, and not his Send command.

Re: Illegal characters in a link?

Posted: 17 Jan 2022, 09:18
by PepeLapiu
I can't show you the code because it was an error that previously occurred so I had to do things differently. And no, it was not DDG.com. It was something else. I'll see if I can dig up a actual link when I get home to my lappy.

Re: Illegal characters in a link?

Posted: 17 Jan 2022, 09:28
by boiler
PepeLapiu wrote: I can't show you the code because it was an error that previously occurred so I had to do things differently.
If you can’t reproduce the problem then there is no reason to post about it.

Re: Illegal characters in a link?

Posted: 17 Jan 2022, 09:31
by PepeLapiu
boiler wrote:
17 Jan 2022, 07:47
That would make sense. I was taking his link example DuckDuckGo.com/ at face value, and not his Send command.
That's what I am saying. I'll see if I can reproduce the error later tonight.

Re: Illegal characters in a link?

Posted: 18 Jan 2022, 17:16
by PepeLapiu
Okay. So I tried to make my error happen again to post it here. But I can't seem to make that error happen again. That be totally like me to only make errors and mistakes when not trying to make them. :?

But anyways, if I want Firefox to open a link stored in a variable, how do I do that? I was copying the content of the var into Firefox link field. But there's got to be a better way to do this.

Re: Illegal characters in a link?

Posted: 18 Jan 2022, 17:18
by PepeLapiu
Never mind. I figured it out.

Code: Select all

Var := "DucDuckGo.com"
Run, % Var