Sign in to follow this  
Followers 0
AndreasVliegen

Run() with variables

12 posts in this topic

#1 ·  Posted (edited)

Hi :(

----------------------

I'm trying to use the Windows's netsh firewall syntax in AutoIt..

This is my script so far:

$ver = "v1.8.1"
$installdir = RegRead("HKLM\SOFTWARE\Inloggen bij Teletop", "")
$prog = $installdir & "\Inloggen bij Teletop " & $ver & ".exe"
Run("netsh firewall add allowedprogram program = " & $prog & " name = ""Inloggen bij Teletop"" mode = ENABLE")

Well this isn't working, it's hat got to do with the quotes ("), I don't know what's the right combination / order with the quotes...

When I do it like this, it works... but i want it with the vars :) :

Run("netsh firewall add allowedprogram program = ""D:\Program Files\Inloggen bij Teletop v1.8.1\Inloggen bij Teletop v1.8.1.exe"" name = ""Inloggen bij Teletop"" mode = ENABLE")

The prog var is the good var.. the only problem are the quotes...

Can somebody help me with this?

Cheers,

Andreas

Edited by AndreasVliegen

Share this post


Link to post
Share on other sites



Did you try using "&" between the quotes?

$ver = "v1.8.1"
$installdir = RegRead("HKLM\SOFTWARE\Inloggen bij Teletop", "")
$prog = $installdir & "\Inloggen bij Teletop " & $ver & ".exe"
Run("netsh firewall add allowedprogram program = " & $prog & " name = " & "Inloggen bij Teletop" & " mode = ENABLE")


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Did you try using "&" between the quotes?

$ver = "v1.8.1"
$installdir = RegRead("HKLM\SOFTWARE\Inloggen bij Teletop", "")
$prog = $installdir & "\Inloggen bij Teletop " & $ver & ".exe"
Run("netsh firewall add allowedprogram program = " & $prog & " name = " & "Inloggen bij Teletop" & " mode = ENABLE")
That one isn't working :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Parameters need to be quoted .... this should be close (untested):

Run(@ComSpec & " /c netsh firewall add allowedprogram program = ""D:\Program Files\Inloggen bij Teletop v1.8.1\Inloggen bij Teletop v1.8.1.exe"" name = ""Inloggen bij Teletop"" mode = ENABLE")
oÝ÷ Øè®f¥*ky÷«¶¬Á¬¢ºÞiÖX²jëh×6Run(@ComSpec & ' /c netsh firewall add allowedprogram program = "D:\Program Files\Inloggen bij Teletop v1.8.1\Inloggen bij Teletop v1.8.1.exe" name = "Inloggen bij Teletop" mode = ENABLE')
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Parameters need to be quoted .... this should be close (untested):

Run(@ComSpec & " /c netsh firewall add allowedprogram program = ""D:\Program Files\Inloggen bij Teletop v1.8.1\Inloggen bij Teletop v1.8.1.exe"" name = ""Inloggen bij Teletop"" mode = ENABLE")
I need it with variables,

and this works, i know that already:

Run("netsh firewall add allowedprogram program = ""D:\Program Files\Inloggen bij Teletop v1.8.1\Inloggen bij Teletop v1.8.1.exe"" name = ""Inloggen bij Teletop"" mode = ENABLE")

But that is without the vars :)

Share this post


Link to post
Share on other sites

Run(@ComSpec & ' /c netsh firewall add allowedprogram program = "' & $prog & '" name = "Inloggen bij Teletop" mode = ENABLE')


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Run(@ComSpec & ' /c netsh firewall add allowedprogram program = "' & $prog & '" name = "Inloggen bij Teletop" mode = ENABLE')
Thank you! This one works! :D:oops::):(

Share this post


Link to post
Share on other sites

Run(@ComSpec & ' /c netsh firewall add allowedprogram program = "' & $prog & '" name = "Inloggen bij Teletop" mode = ENABLE')
OK, give it up JdeB... how'd you get the syntax color coding to paste into your reply? :)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

he ain't tell'in

Share this post


Link to post
Share on other sites

Just don't know.... I only know how SciTE does it...

Jon is the expert web syntax highlighter .. :(

I do all my AutoIT work in SciTE, and copy\paste to the forum from it all the time (like to hit the code with Tidy before posting it). I've never noticed the color coding preserved before. I also note your color coding was not preserved where I quoted it in my post... hmm... :)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

I do all my AutoIT work in SciTE, and copy\paste to the forum from it all the time (like to hit the code with Tidy before posting it). I've never noticed the color coding preserved before. I also note your color coding was not preserved where I quoted it in my post... hmm... :)

The color coding is not preserved from SciTE but when pasted in the forum post and you surround it with [ autoit] ... [ /autoit] in stead of [ code] ... [ /code] it will now be color coded with another php script.

:(


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0