AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Variables with special characters

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ko
Guest





PostPosted: Thu Sep 17, 2009 1:18 am    Post subject: Variables with special characters Reply with quote

I'm sure this is a simple answer.

I have a variable which is being stored through an input box that contains an "#" symbol. I'm then using this variable to send this and it freaks out.

Code:

InputBox, user, Enter User, Please enter your username
if ErrorLevel
  ExitApp
SendInput, http://www.samplewebsite.com/%user%/directory.asp
return


It's almost like it interprets the "#" as a windows-key keystroke instead of the correct symbol.
Back to top
purloinedheart



Joined: 04 Apr 2008
Posts: 537
Location: Canada

PostPosted: Thu Sep 17, 2009 1:42 am    Post subject: Reply with quote

Try SendRaw
Back to top
View user's profile Send private message
MasterFocus



Joined: 08 Apr 2009
Posts: 3035
Location: Rio de Janeiro - RJ - Brasil

PostPosted: Thu Sep 17, 2009 1:43 am    Post subject: Reply with quote

That's exactly what # represents.
Read more about the Send command.

MANUAL wrote:
#: Sends a WIN keystroke, therefore Send #e would hold down the Windows key and then press the letter "e".

_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"

Antonio França
My stuff: Google Profile
Back to top
View user's profile Send private message Visit poster's website
ko
Guest





PostPosted: Thu Sep 17, 2009 1:49 am    Post subject: Reply with quote

I figured out that {Raw} would work in the situation i posted. But in my context I would like to create a new variable and use it in conjunction with UrlDownloadToFile.

Code:

InputBox, user, Enter User, Please enter your username
if ErrorLevel
  ExitApp

CheckHere = http://www.samplewebsite.com/%user%/directory.asp
SaveHere = C:\Source.txt

UrlDownloadToFile, %CheckHere%, %SaveHere%
Back to top
anyoneelse
Guest





PostPosted: Thu Sep 17, 2009 7:52 am    Post subject: Reply with quote

ko wrote:
I figured out that {Raw} would work in the situation i posted. But in my context I would like to create a new variable and use it in conjunction with UrlDownloadToFile.

Code:

InputBox, user, Enter User, Please enter your username
if ErrorLevel
  ExitApp

CheckHere = http://www.samplewebsite.com/%user%/directory.asp
SaveHere = C:\Source.txt

UrlDownloadToFile, %CheckHere%, %SaveHere%

There is no problem embedding the # character in a variable. There is a problem using it in a url. Short fix: replace the "#" char with "%23".

Reference: Percent-encoding and UrlEscape Function

Additionally, there are several functions posted in the forums that will automatically check/encode an url. Search for URL ENCODE.
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group