Shell command ...type mismatch - help!

I keep getting an error message that there is a type mismatch in the code line where it says: “taskId% = Shell(NetPath", 6)”

Can anyone help me on this …I have never used the shell command before and the way that the help database explains it gets me confused.

This agent is run from the action menu in the database.

Thanks,

Dan

Sub Initialize

Dim session As New notessession

Dim db As NotesDatabase

Dim profiledoc As notesdocument 'The Profile document

Dim NetPath As Variant

Set db = session.CurrentDatabase

'Set NetPath with value from the “DriveMappingCode” field from the Database Configuration document

Set profiledoc = db.GetProfileDocument("(Database Configuration)")

'NetPath= "cmd /c net use  \\1.1.222.1\Tiildata\ TIIL!fnp1 /user:administrator"

NetPath= profiledoc.GetItemValue("DriveMappingCode")	

taskId% = Shell(NetPath", 6) 'The 6 is used to minimize the DOS command window

End Sub

Subject: Shell command …type mismatch - help!

I’m not sure if this will solve the problem but I think you need to change this linetaskId% = Shell(NetPath", 6)

to

taskId% = Shell(NetPath, 6)

You do not need the double quotes.

HTH

JB

Subject: RE: Shell command …type mismatch - help!

Thanks James,actually I had corrected that (but forgot to update the content of this post) and it still gave me the same error.

By the way, what does the Taskid% do? Is that the way to execute a shell command?

Dan

Subject: RE: Shell command …type mismatch - help!

Try this…

Sub Initialize

Dim session As New notessession

Dim db As NotesDatabase

Dim profiledoc As notesdocument 'The Profile document

Dim NetPath As Variant

Dim strNetPath As String

Dim taskID as long

Set db = session.CurrentDatabase

'Set NetPath with value from the “DriveMappingCode” field from the Database Configuration document

Set profiledoc = db.GetProfileDocument(“(Database Configuration)”)

'NetPath= “cmd /c net use \1.1.222.1\Tiildata\ TIIL!fnp1 /user:administrator”

NetPath= profiledoc.GetItemValue(“DriveMappingCode”)

strNetPath = Cstr(NetPath(0))

taskId& = Shell(strNetPath, 6) 'The 6 is used to minimize the DOS command window

End Sub

HTH

JB

Subject: RE: Shell command …type mismatch - help!

JB,

Nice Catch. Completely missed that data type.

Shawn

Subject: RE: Shell command …type mismatch - help!

Thanks Shawn,

I hope it helped Dan.

JB

Subject: RE: Shell command …type mismatch - help!

TaskId% is setting a local variable of type integer to what is returned from the shell command.

From the designer help:

Return value

If LotusScript successfully starts program, Shell returns the number 33.

What is the NetPath variable set to after this line of code executes?

NetPath= profiledoc.GetItemValue(“DriveMappingCode”)

And did the error get generated when you used this line:

'NetPath= “cmd /c net use \1.1.222.1\Tiildata\ TIIL!fnp1 /user:administrator”

Shawn