Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Send raw % Percent Sign?



  • Please log in to reply
4 replies to this topic
infiniteMPG
  • Members
  • 34 posts
  • Last active: Mar 10 2014 07:29 PM
  • Joined: 13 Nov 2009

Trying to write part of a script to wildcard search that is passing along a variable to an application that for it's wildcard searching uses the % percent sign.  For example to search for "shutoff" you have to send "%shutoff%".  I found a way to do it that works but thinking that there might be a simpler way.

 

This gathers the wildcard text to search :

 

 InputBox, wildcard, Part Description Wildcard?, Enter Text
 if ErrorLevel
  Exit

 

Then I define a variable that literally equals the percent sign :

 

percentage := "%"

 

Then I send this to the application :

 

send, %percentage% %wildcard% %percentage%

 

Is there an easier way to do this?

 

 

 

 

 

 



noname
  • Members
  • 650 posts
  • Last active:
  • Joined: 12 Nov 2011
InputBox, wildcard, Part Description Wildcard?, Enter Text
 if ErrorLevel
  Exit
send {asc 0037}%wildcard%{asc 0037}
return

% is asci 37


winXP  and ahk unicode


sinkfaze
  • Moderators
  • 6367 posts
  • Last active: Nov 30 2018 08:50 PM
  • Joined: 18 Mar 2008
I see no reason why you couldn't use send {`%} %wildcard% {`%}

AfterLemon
  • Moderators
  • 237 posts
  • Connoisseur of Boobs
  • Last active: Jan 04 2016 11:12 PM
  • Joined: 09 Oct 2012
I thought you'd handle this one easily sinkfaze. Your script errors before it loads.
 
Here are 4 examples, all work and can be used together even.
$v::
Wildcard=example one
Send, % "%" . wildcard . "%"  ;Uses Send as a string, instead of just text w/ variables
return

$b::
wildcard=example two
Send, `%%wildcard%`%  ;Uses Send as text w/ variables, but escapes % sign
return

$n::
wildcard:="%example three%";  ;Uses Send as text w/ variables, but sets variable as string of text
Send, %wildcard%
return

$m::
wildcard:="%example four%"  ;Uses Send as string and sets variable as string of text
Send, % wildcard
return
And here's a little more complex one. Sets up a variable, sets the variable inside the variable, then uses Send, % to send the "variable inside the variable"'s contents.
$c::
wildcard:="examplefive"  ;Sets variable as string of text
%wildcard% := "testing"  ;Sets variable inside first variable (examplefive) as separate string of text
Send, % %wildcard%       ;Uses Send command as a string, which is sending the contents of the variable inside wildcard as a string of text
return
Let me know if you need something else.


infiniteMPG
  • Members
  • 34 posts
  • Last active: Mar 10 2014 07:29 PM
  • Joined: 13 Nov 2009
✓  Best Answer

Thanks for the replies.  The best and simplest option is :

 

$b::
wildcard=example two
Send, `%%wildcard%`%  ;Uses Send as text w/ variables, but escapes % sign
return

 

As the variable %wildcard% is input via an InputBox and don't want the operator to have to input the percent signs into the text they enter.