supersonic Posted April 10, 2008 Share Posted April 10, 2008 (edited) Hello to everybody reading my post, I'm converting our batch script (*.cmd) to AutoIt scripts. Therefore I have to convert the following batch command sequence: @echo off set test=PING.EXE %test% 192.168.0.1 Any ideas? Greets, -supersonic. Edited April 10, 2008 by supersonic Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 10, 2008 Moderators Share Posted April 10, 2008 Hello to everybody reading my post,I'm converting our batch script (*.cmd) to AutoIt scripts.Therefore I have to convert the following batch command sequence:@echo offset test=PING.EXE%test% 192.168.0.1Any ideas?Greets,-supersonic.Can you use the Ping function in the help file? 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. Link to comment Share on other sites More sharing options...
supersonic Posted April 10, 2008 Author Share Posted April 10, 2008 This is just an example script. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 10, 2008 Moderators Share Posted April 10, 2008 This is just an example script.And? There are plenty of "examples" of batch conversion on the forum if you are just looking for a generalization on how to do it for many different functions.I think my point was to look at the help file for standard functions before you try to recreate them all using cmd.exe.But I'll humor you all the same:http://www.autoitscript.com/forum/index.ph...st&p=308667http://www.autoitscript.com/forum/index.ph...st&p=313340 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. Link to comment Share on other sites More sharing options...
supersonic Posted April 10, 2008 Author Share Posted April 10, 2008 Hm... Maybe you got me wrong... When I parse text file value - e. g. "exampleFunc()" - returns. This value is a name of a function. To call this function I could use this: If $i = "exampleFunc()" Then $returnCode = exampleFunc() EndIf More useful could be a command like this: CallAsAFunction($i) Any ideas? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 10, 2008 Moderators Share Posted April 10, 2008 (edited) Hm... Maybe you got me wrong...When I parse text file value - e. g. "exampleFunc()" - returns.This value is a name of a function.To call this function I could use this:If $i = "exampleFunc()" Then $returnCode = exampleFunc()EndIfMore useful could be a command like this:CallAsAFunction($i)Any ideas?You answered your own question.Call($i)Edit:Without the parenthesis in "exampleFunc()" of course... Would have to be "exampleFunc" Edited April 10, 2008 by SmOke_N 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. Link to comment Share on other sites More sharing options...
supersonic Posted April 10, 2008 Author Share Posted April 10, 2008 I tried this before but nothing happens. Even when the function not exists, like: $i = thisFuncNotExists Call($i) No error msg at all. Link to comment Share on other sites More sharing options...
weaponx Posted April 10, 2008 Share Posted April 10, 2008 (edited) I tried this before but nothing happens.Even when the function not exists, like:$i = thisFuncNotExistsCall($i)No error msg at all.You have to handle the error.$i = "thisFuncNotExists"Call($i)If @ERROR Then MsgBox(0,"","Function: " & $i & " does not exist")EDIT: Good point rich Edited April 10, 2008 by weaponx Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 10, 2008 Share Posted April 10, 2008 (edited) That should be a syntax error on thisFuncNotExists because it's not a proper token though. Did you mean for it to be in quotes? Edited April 10, 2008 by Richard Robertson Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 10, 2008 Moderators Share Posted April 10, 2008 I tried this before but nothing happens. Even when the function not exists, like: $i = thisFuncNotExists Call($i) No error msg at all.You can't call a function that doesn't exist. Local $vCallFunc Switch Random(1, 2, 1) Case 1 $vCallFunc = "One" Case 2 $vCallFunc = "Two" EndSwitch Call($vCallFunc) Func One() MsgBox(64, "Info", "You called function one") EndFunc Func Two() MsgBox(64, "Info", "You called function two") EndFunc 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. Link to comment Share on other sites More sharing options...
supersonic Posted April 11, 2008 Author Share Posted April 11, 2008 Shame on me. Of course it works like you said. I got it ... Better later than never! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now