VB6

Calling Perl script with Shell() from VB

Page 1 of 1

4 Replies - 3178 Views - Last Post: 27 May 2005 - 06:57 AM Rate Topic: -----

#1 vanhkhuyen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 25-May 05

VB6

Posted 25 May 2005 - 01:51 PM

Plz help ! I am able to call .exe and .bat program with Shell() function in VB6 program. However, I couldn't do this with my Perl script (.pl). The message that I got was "Invalid function call or argument" . I kept the code the same as when it worked for the .exe and .bat files. The only thing that I changed was .pl (instead of .exe). I tried the work around way by calling .bat file instead of .pl. However, I don't think I will be happy with that if there's maybe a way to deal directly with this Shell() function for my Perl program. :rolleyes: :D

This is my code
sOutPutFile = "C:\Ecsais\MSBHP2FT.FLT"
sExeProgram = "C:\Ecsais\perl MSBHP2FT.pl" & " C:\Ecsais\MSB_OP.FIL"

oFSO.CreateTextFile sOutPutFile, True
lPid = Shell(sExeProgram, vbNormalFocus)

The program failed right here at the last line. Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: VB6

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 247
  • View blog
  • Posts: 13,505
  • Joined: 12-July 02

Re: VB6

Posted 25 May 2005 - 07:48 PM

Does that command run correctly when you simply put it in the command line?
Was This Post Helpful? 0
  • +
  • -

#3 vanhkhuyen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 25-May 05

Re: VB6

Posted 26 May 2005 - 07:31 AM

Yes, it runs fine on the command window manually. As I mentioned, the .bat file is working with Shell(). Thanks :D
Was This Post Helpful? 0
  • +
  • -

#4 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 247
  • View blog
  • Posts: 13,505
  • Joined: 12-July 02

Re: VB6

Posted 26 May 2005 - 06:28 PM

Is the word perl in this statement
C:\Ecsais\perl MSBHP2FT.pl


a folder, or the command the invoke the perl environment? If it's the command, shouldn't it be
perl C:\Ecsais\MSBHP2FT.pl


?
Was This Post Helpful? 0
  • +
  • -

#5 vanhkhuyen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 25-May 05

Re: VB6

Posted 27 May 2005 - 06:57 AM

I tried both with and without the perl command with that Shell(). They're all working by themself on the command line though but not with Shell() function. Thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1