![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
|
When using variables things dont work..
Been trying to figure out how to make it work for the last few hours, not sure what to search for on google, so i thought i'd ask here, and *hope* for an answer
If InStr(dmsg, prefix & "makedir") = 1 Then Dim MakeDirectory As String 'MsgBox dat(4), vbOKOnly, "Testing.." MakeDirectory = dat(4) Call MkDir(MakeDirectory) End If but if i change it to dat(4) which is part of an array, and in the MsgBox shows fine as "C:\Testing" it wont work.. dmsg, refers to the first word/command given to it on the irc server and dat(4) refers to the second, like example: (+Keiran) .makedir C:\Testing Hope ive explained it Ok ! Thanks |
|
|
|
|
|
#2 |
|
Expert Programmer
|
Well MkDir("C:\TestingThis") works fine for me... so my next guess it that the 4 element (i forgot how indexing works in vb) of your array dat is something different. Although your msgbox works maybe there is space or and odd character at the end throwing it off?
Does it bomb out...? Does it produce an error?
__________________
"When in Rome, Do as the Romans Do" "Beauty is in the eye of the BEER holder" "Save your breath your going to need it for your blow up doll later" SearchLores.org |
|
|
|
|
|
#3 |
|
Newbie
|
I changed the code to have error checking, and to remove any spaces from the variable to see if that was the problem
If InStr(dmsg, prefix & "makedir") = 1 Then On Error GoTo mkdirerr Dim Dir2Make As String Dir2Make = Replace(dat(4), " ", "") Call MkDir(Dir2Make) wsCon.SendData SendMessage & "Operation Complete " & vbCrLf mkdirerr: wsCon.SendData SendMessage & "Operation Failed - " & Err.Description & vbCrLf End If This is the error i get ( 11:43:26 ) ( Keiran[away] ) .makedir C:\Testing ( 11:43:28 ) ( Administrator ) Operation Failed - Path not found |
|
|
|
|
|
#4 |
|
Programmer
|
put the array declaration up
that may be the error I havn't used VB in a while but isn't an array like this data[4] or is taht only c
__________________
Get programming and game creation tutorials and discuss apon you peers at http://s14.invisionfree.com/tsoft We also accept custom software requests and new mods will be needed soon |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|