Hi Martin,
I have a flow that sends the url of a voice search to my computer . To accomplish that im using the Autoremote plugin and EventGhost on my computer to receive the message and open the url.
The problem is that EventGhost doesn't like blank spaces at all so a search for '' auto magic'' turns into a search for ''auto'' only...
The search is been passed by a variable called ''avcommnofilter'' ( the variable is provided by the AutoRemote plugin ) and my question is: how to replace the spaces within the variable with a + ??? ( like: auto+magic)
Thank you !
Search and Replace Within a Variable
Moderator: Martin
- TheBrain1984
- Posts: 137
- Joined: 07 Aug 2013 08:17
- Location: Germany
Re: Search and Replace Within a Variable
Action: Script
var_b = replace(var_a, "auto magic", "auto+magic")
OR
var_b = replaceAll(var_a, "auto magic", "auto+magic")
var_a is the variable that includes the string "auto magic" and var_b is the variable that get's the string with "auto+magic"
var_b = replace(var_a, "auto magic", "auto+magic")
OR
var_b = replaceAll(var_a, "auto magic", "auto+magic")
var_a is the variable that includes the string "auto magic" and var_b is the variable that get's the string with "auto+magic"
Re: Search and Replace Within a Variable
How would i go about it TheBrain ??
Something like this ?
var_b = replaceAll(var_avcommnofilter, " ", "+")
Something like this ?
var_b = replaceAll(var_avcommnofilter, " ", "+")
- TheBrain1984
- Posts: 137
- Joined: 07 Aug 2013 08:17
- Location: Germany
Re: Search and Replace Within a Variable
This will replace all Spaces to "+". If this is what you want, than oyur solution would be correct.
Re: Search and Replace Within a Variable
It sounds like the text might be passed to the computer as part of an URL parameter. If this is the case, you would also have to escape some other characters like question marks and equal signs.
To do this you can use function var_b = encodeURLForm(var_a);.
To do this you can use function var_b = encodeURLForm(var_a);.
Re: Search and Replace Within a Variable
I've tried a few things without success. Could you guys explain in details or make the necessary changes for me ?
http://automagic4android.com/flow.php?i ... b953ac5a7a
Thanks !
http://automagic4android.com/flow.php?i ... b953ac5a7a
Thanks !
Re: Search and Replace Within a Variable
Sorry, I don't use the plugins used by your flow so I'm not really able to test the flow.
I assume that you could change the following line in the AutoRemote action plugin:
putString("message", "http://google.com/search?q={avcommnofilter}");
to
putString("message", "http://google.com/search?q={encodeURLFo ... mnofilter)}");
I assume that you could change the following line in the AutoRemote action plugin:
putString("message", "http://google.com/search?q={avcommnofilter}");
to
putString("message", "http://google.com/search?q={encodeURLFo ... mnofilter)}");
Re: Search and Replace Within a Variable
WONDERFUL !
Thats a solution for all my problems related to Phone/PC communication !
Martin, where is the ''DONATE BUTTON'' my friend ?
I need to click it a few times
Thats a solution for all my problems related to Phone/PC communication !
Martin, where is the ''DONATE BUTTON'' my friend ?
I need to click it a few times