|
Answer» I have some code that is suppose to find y VALUES for -10->10 for an input y=mx+b formula. And then run _graph.bat with said points as arguments. I'm getting a lot of errors when I try to run it with any equation (type mismatch [string " "]). It is not very consistent as to which string it decides to pick, mainly bouncing between " " and m. Any help would be much appreciated. Code: [Select]dim m,opp,b,working,points m = wscript.arguments(0) opp = Wscript.arguments(1) b = Wscript.arguments(2)
for i=-10 to 10 if opp = "+" then working = m * i + b Elseif opp = "-" then working = m * i - b End if points = points + working + " " Next
Dim objShell Set objShell = WScript.CreateObject ("WScript.shell") objShell.run "graph.bat" + points Set objShell = NOTHING
Edit: added quotes and it WORKED, now it cant find my file. I added %cd% as the 4th arguments, but can't get it to load 'objShell.run cd + "\graph.bat" + points'. it can't find the file.
EDIT2: So it turns out my objShell.run syntax was WRONG, and you use & not + to combine strings >.< FINISHED code: Code: [Select]'wscript //nologo _findLine.vbs "%m%" "%opp%" "%b%"
dim m,opp,b,working,points,cd m = wscript.arguments(0) opp = Wscript.arguments(1) b = Wscript.arguments(2)
for i=-10 to 10 if opp = "+" then working = m * i + b Elseif opp = "-" then working = m * i - b End if points = points & " " & i & "." & working Next
Dim objShell Set objShell = WScript.CreateObject ("WScript.shell") objShell.run("%comspec% /k _graph.bat" + points), 1, True Set objShell = Nothing
|