Comatose 290 Taboo Programmer Team Colleague

I'd personally like to keep the conversation on the forum. This helps other people who run into the same or similar problems without having to post and post and post..... I have written a number of servers and clients in VB, so let me know what you need.

Comatose 290 Taboo Programmer Team Colleague

That's actually a really good way of doing it (if you are doing it programmatically) but I'm sure if you manipulate the word object (create an instance of Word with VB [ set wordvar = createobject("Word.Application") ]) then you should be able to copy everything in it into a variable (using a range) and then simple post that text into the RTF..... I would still personally create the word object, and then programmatically save it as an RTF and then load it with my app. The reason is, you are then working with a copy of the actual file, so if the user screws up or something, you can always impliment a recover function that..... eah, you get the point.

Comatose 290 Taboo Programmer Team Colleague

Simple enough, just use a timer control.... then in the timer control grab the current time. If the current time, is equal to the time specified, then consolidate your database. Check this thread, which works for the date (simple enough to modify for the time): http://www.daniweb.com/techtalkforums/thread45561.html

Comatose 290 Taboo Programmer Team Colleague

That was freaking awesome, I'm giving rep points for that one Iamthwee.

Comatose 290 Taboo Programmer Team Colleague

A Range, for what?

Comatose 290 Taboo Programmer Team Colleague

I Agree with you Dani, but I think those subscriptions are in fact spam.

Comatose 290 Taboo Programmer Team Colleague

Well, if it's a coma delimited, then it won't be in the format of:

name=lastname,firstname
id=123456
condAdmit=yes
ave=82

name=lastname,firstname
id=987456
condAdmit=no
ave=n/a (or blank)

instead it would look more like: lastname,firstname,123456,yes,82 You probably will need more than one if else, and maybe even something more dramatic. I don't have office installed, so it's hard for me to test macro's, and figure out what commands and keywords will work, and which ones won't. I use VB6, which is a full fledged programming language.... VBA is not. It is possible to use WSH (or VB6) to directly work with the data, and even handle all of the word document, without the need for ever even loading word. I could make a WSH file (or a VB program) that does everything you specified above, without ever having to load word from the user interface (the program or script can create an instance of word, and do everything behind the scenes). What I can do, is give you some code, and a layout of how to work with it, and you can figure out if it works in VBA inside of word or not.

Some code that would be certainly required, would be to split apart the information by coma, and put each piece of that information into variables. Then you test each piece against whatever criteria you need to, and go from there. Some of the code would look like this:

dim Parts() as string
dim LastName as string
dim …
Comatose 290 Taboo Programmer Team Colleague

No, but I believe people should be significantly more thorough when it comes to convictions.... not just because someone has to pay for the crime.... which happens all too often. Why leave a case open, when it can be closed? Why stay here in this jury room any longer, I just want to go home, so screw it, he's guilty.

Comatose 290 Taboo Programmer Team Colleague

I still need the layout of the CSV file, and how it will be in the file. Where do I get the name address and ID number? Salutation is simple enough, assuming we can figure out part 1. How do we determine if they are admitted? Do we have admitted file that we can test the student against to see if they are admitted already? The rest of it is based on the rest of the information that we don't have yet.... so, it all can be done, assuming the rest of it gets layed out. It sounds like you have a pretty good idea what you are doing (recording macro's and going to add the logic in), so, what do you need from me?

Can this be done as an EXE from VB? Does this have to be a macro in the file? Can it be a WSH Script?

Comatose 290 Taboo Programmer Team Colleague

Ok, I got lost when you asked about converting variables to text. No, the chances of getting perl to work in word are real slim. It's easy enough to read the csv file, and work with it. It's definately easy enough to find out what kind of letter is required, and make it generate text based on that.... I need you to lay out for me though, in greater detail, (more like a step by step outline: program needs to first read the file, second get the student name, third, etc, etc), and I can help you more.

Comatose 290 Taboo Programmer Team Colleague

Ok, there is no way to tell you a code, but someone can tell you how to code a timer....which is easy enough.

Comatose 290 Taboo Programmer Team Colleague

For Starters...
I was recently helping someone with Random Files, and I realized as I googled along, that it took me some time to find any kind of information about random files, and how to go about working them. I had to pop in an old 3 1/2 inch floppy, and extract some ancient code that I had worked on in high school to get myself back up to speed. That said, it only seems right that the Daniweb community should have something to keep us brushed up on this.

What Are Random Files?
Random files, in the simplest possible explanation, are databases. That's a pretty bold statement, when you take into consideration access and SQL, but a random file is a file that holds records that are always the same. Don't get confused when I say that, because it would be silly to have a file with 10 records of the same person.... what I mean, is that all the type of information in the fields is the same. So, you might want to have a rolodex program, that keeps track of your contacts. You know that you will always have a string (sequence of characters) for the First and Last Name.... you will most likely have numbers for the zip code, and so forth. One of the Advantages to using random files, in place of a Flat File, is that you can work with 1 record at a time, without having to loop …

Comatose 290 Taboo Programmer Team Colleague

Breaking The Law and being punished doesn't constitute war. Wordnet defines Collateral Damage, as inadvertent casualties and destruction inflicted on civilians in the course of military operations, not quite the same thing.

Comatose 290 Taboo Programmer Team Colleague

I found three on the web.... the second seems like it would be the easiest to impliment, while not actually 1 control, it gives the same functionality using a textbox and a dropdown box:
http://codeproject.com/jscript/jsactb.asp
http://www.mattkruse.com/javascript/autocomplete/
http://webfx.eae.net/dhtml/combobox/combo_demo.htm

Comatose 290 Taboo Programmer Team Colleague

Ok, So just the potion where you upload your photo? You realize that you need a server to talk to (which accepts the photo) so that you can begin socket communications between the server and the client?

Edit: I have no intention on bidding on this, but it's not spam since I got a response and further clarification, thus I'm leaving it.

Comatose 290 Taboo Programmer Team Colleague

You are saying that it's 5 to 6 hours of work to make a program that is able to incorporate all the protocols from the four major IM services, plus, build a server that is capable of authentication, querying for proximity zip-codes, transfer of photo's, and have it's own chat protocol.... 7 days (May 22) is probably not enough time with a team of programmers, more less a single person competing for a job. I haven't decided yet if this is creative spam, or the rantings of a delusionist.

Comatose 290 Taboo Programmer Team Colleague

first thing you need to do, is post a few lines of the text file. So, for example, is the textfile tab delimited? If you post a couple of the records in the file (or however it's setup) then I can help you out a bit more with decoding the file. As for moving it to another folder, that's no problem, but if the file name is the same every time (so the program makes a textfile in folder XXX and the filename is the same each time right?) when we move it to YYY, will it need to overwrite the current file, append the current file, or save the newly moved file with a different name? Checking every 2 minutes isn't a problem either. Let me know what you have, and I'll see what I can do.

Comatose 290 Taboo Programmer Team Colleague

C or C++. Unless you do a lot of crafty programming, VB is bulky, and simply an awful tool for game creation.

Comatose 290 Taboo Programmer Team Colleague

"It's Better For 1000 Guilty Men To Go Free, Than For 1 Innocent To Be Punished"

Comatose 290 Taboo Programmer Team Colleague

:) I'll walk you through it.

  1. First, we declare the variables we will use (with the exception of the noted)

  2. we check if the user selected one of the accounts that is listed in the listbox, if not, we complain, and exit the sub.
  3. We Ask the user for an amount to debit, if they leave it blank, or click cancel, we forget about it, and leave the sub
  4. We Made it this far, so we know the user selected something in the listbox, so, we find out what they selected, and split apart the string by space (which is how it's shown in the listbox). This makes an Array that contains each field of the info in the listbox.
  5. We Assign CardNo and PinNo Variables To The Card Number and The Pin Number That Is Stored In the Listbox
  6. We Open the File, And Check every record to see if the card number and the pin number, are the same as the card number and pin number of the account selected in the listbox.... if they are the same, then we have the record we want to work with... In order for us to remember which Record Number We Are Fiddling With, We Set the "SelRec" variable to the same number as the number we are in our loop (so, we set SelRec To The Record Number)
  7. We Close The File, And Re-Open It Again, To Retrieve The Record Number That We …
Comatose 290 Taboo Programmer Team Colleague

Sounds Pretty complicated actually.... but you are more than welcome... I hope it all turns out alright.

Comatose 290 Taboo Programmer Team Colleague

If you don't mind me asking, why does it have to be done in a random file? Homework? If there is any other way, believe me, you want it. That said, I've added a button (Debit Button) To Your Project, that debits a given amount from the selected account. Hope your up for a bit of constructive criticism, because I'm about to lay it out. One Thing, is I would change the setup a bit, so that you don't have to select a file, and then seperately display the records in it with another button. Both Of those operations should go hand in hand, for user interface comfortability.... You select the file, and Bam, Everything is Ready. Speaking of which, have you clicked the button to load a file, and then clicked "Cancel" on the common dialog box? Nice Surprize there.

You made life a bit more complicated by using a sorted listbox.... my first plan was to add a new listbox that would remain hidden, and would directly coorespond to the record selected in the listbox, but you can't keep record numbers in line with record info, when the listboxes get sorted.... SO, we had to rip apart the information (by " ") in the listbox, and then open the file and loop through every record, and compare it to the card number and the pin. If both of those matched, then we set a variable that contains the record number that was selected by the user in …

Comatose 290 Taboo Programmer Team Colleague

As far as I know you can't. I believe you could port your source to VB6 with minor modifications, and then compile the EXE from VB, but I'm pretty sure that VBA (macro's and such) are interpreted, and must remain that way.

Comatose 290 Taboo Programmer Team Colleague

Ok, first thing's first. I have to Strongly Discourage Your selection in record keeping. I have TONS of reasons why, but the most compelling reasons can not be explained with words..... they come from experience in so doing. If this is not a school project, and/or this is not a required means to storing your data (if it's a school project, then naturally the teacher would want it done a certain way, if it's a business application, there might be some kind of sick reason why the business/customer wants it done that way), then your best bet is change the way the data is stored. Period. I have a lot of experience working with databases stored using random files and user defined types.... and every outcome has turned out poorly.

I also don't believe in encouraging change without offering an alternative, and therefore, I suggest 2 alternatives. 1, would be use a structured database (be it SQL, or Access.... or oracle, who cares.... something made for storing records.), and the other, is to use a delimited flat file. Both of these options make your life, infinitely better, and simplier. One main point is portability. Eventually, you are going to want to port the information into another program (I know it doesn't seem that way now, and maybe with this app you won't, but getting started running with your shoe laces tied sucks). I can't tell you the number of times I saved data a certain way (using random files …

Comatose 290 Taboo Programmer Team Colleague

again, I have to know exactly how the textfile is setup (the file with the accounts) if you post a few of the records, and modify them if needs be for confidintiality reasons, I can help you a lot more.

Comatose 290 Taboo Programmer Team Colleague

Sendkeys is usually not a great idea.... because there are a ton of problems that can occur. What if the user switches focus (or what if there is spyware or some other junk that spawns new windows for the hell of it), while your program is in the midst of sending keys..... all hell can break loose. Read up on this thread, and check out this page: http://www.daniweb.com/techtalkforums/post127770.html
http://www.scriptlogic.com/Kixtart/htmlhelp/Functions/sendkeys.htm

Private Sub Form_Load()
Shell "c:\windows\notepad.exe", vbNormalFocus
Me.Show
AppActivate "Untitled - Notepad"
SendKeys "This Is A Test!"
SendKeys "+{HOME}"
End Sub
Comatose 290 Taboo Programmer Team Colleague

Ok, I'm not clear on what you are doing really. I understand that you want to install the updates, 1 by 1..... but when does windows conflict? What's the problem? Do you know the commandline needed to launch the updates you want to launch? Doing this in a batch file is possible, (assuming I understand exactly what you are doing), but I don't see the pro's of using a batch versus a VB program.....

Comatose 290 Taboo Programmer Team Colleague

I would do it differently. depending on the size of the file, I would either read the entire file into memory, and then manipulate what I want to change, and then over-write the file with the new information, or (assuming the file is pretty big) read the data in, line by line, and change what I need when I get to that line, and in the mean time write the information back to a temporary file. Once The loop is done, I'd delete the original, and rename the temp file to the name of the original. I would use put either (unless the file is somehow a random access or binary), but I'd use the print command..... if you post the file (or some of it) so that I can get a better feel for it, I can help you out a little more. Also, something to keep in mind, is that it depends on how you open the file..... say: open "c:\somefile.txt" for output as #1 will automagically over-write anything in the file, when you do your first print #1, "new data" .

Comatose 290 Taboo Programmer Team Colleague

Actually, unless specifically noted otherwise (by the use of option base, or something nuts) then 0 is the default element of an array, so, X(0) would = 1, and X(254) = 255. Declaring it is not the same at all. It looks to me though, that the TP Code (which I know nothing about) is creating a user-defined type (looks like 2 types, but I don't know TP, type 1 being called elements, and type 2 being called Xpath.) Then it looks like variables Path0,Path1,Path2 are defined as type element, and Path is defined as type Xpath. I'm not 100% sure what the program you are trying to re-write does, so it makes it a lot harder for me to try to explain everything.... if you post a new thread in the VB forum, detailing the program you are trying to write, I can probably help more. It's best to have it as detailed as possible, with steps.... it would also help if you explain EXACTLY what the TP program does.....

Comatose 290 Taboo Programmer Team Colleague

You'll want to look into the "sendkeys" command. This command allows you to send keystrokes to applications (shift-end, ctrl-c, ctrl-v). Keep in mind, sendkeys only sends keystrokes to the currently active (foreground) window. So, you'll want to make whatever window you want to mess with the foreground first, with either appactivate, or the setforegroundwindow (and setactivewindow) api calls. If you want to get more complicated than that (say, cross-task subclassing) you are going to want to be very... very careful.

Comatose 290 Taboo Programmer Team Colleague

In VB, The shell command (and many, many others) spawns a process, and then immediately returns to the next line of code execution. This isn't a problem, really. The problem comes about, when you want to WAIT for a spawned process to finish, before spawning a new process. For example, if I wanted to spawn notepad, and a calculator at the same time, this code would work (technically, it's not at the same time, but it's one immediately after the other, and doesn't wait.... so it appears to be at the same time):

shell "c:\windows\notepad.exe"
shell "c:\windows\system32\calc.exe"
Comatose 290 Taboo Programmer Team Colleague

Wrong Forum, C# can be found here:
http://www.daniweb.com/techtalkforums/forum61.html

Comatose 290 Taboo Programmer Team Colleague

Not really. That's why it's called a "combo box" because it combines both a listbox feel with a textbox functionality. To give it the feel that you are after, however, simply change it's style property to 2, and it will behave like you want.

Comatose 290 Taboo Programmer Team Colleague

Which is cool, but since my opinions differ based on religious and political stand points, it's impossible for me to answer the poll.

Comatose 290 Taboo Programmer Team Colleague
dim Progs(5) as string ' change this to 1 less than the number of programs
Progs(0) = "c:\program_path\program1.exe"
Progs(1) = "c:\program_path\program2.exe"
Progs(2) = "c:\program_path\program3.exe"
Progs(3) = "c:\program_path\program4.exe"
Progs(5) = "c:\program_path\program5.exe"

dim WSH as object
set wsh = createobject("WScript.Shell")
for each Prog in Progs
     wsh.run Prog, 1, 1
next Prog
Comatose 290 Taboo Programmer Team Colleague

Again Roxsy, Religiously, or Politically?

Comatose 290 Taboo Programmer Team Colleague

I hate to say it, but I think the best bet you have is to re-write the program.

Comatose 290 Taboo Programmer Team Colleague

You can define byte arrays in VB like so:

dim Path0(49) as byte

But keep in mind, that's as literal bytes. If the actual path is a string (sequence of characters) you probably wouldn't want to define it as a byte. I'm guessing the TP code IF Path[z] IN Path2 THEN is checking if Path2 contains the same data as a substring as Path[z] has. (so, if Path[z] = "hello", and path2 = "hello world", that it would return true). In VB, this is done with instr function. This thread should PROBABLY be moved to the VB forum, however.... let me know if this is what you had in mind.

Comatose 290 Taboo Programmer Team Colleague

The question isn't detailed enough for me. I have conflicting beliefs when it comes to political views and religious views. So, it depends on which nail you are hanging this question.

Politically: Kill them all!
Religiously: No Way Jose'

Comatose 290 Taboo Programmer Team Colleague
Private Sub Text1_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
    Case 48 To 57
        ' These are acceptable keystrokes
    Case 8
        
    Case Else
        ' These are unacceptable, and should be ignored
        KeyAscii = 0
    End Select
    
End Sub
Comatose 290 Taboo Programmer Team Colleague

Hmn, wouldn't you convert VOB's to AVI's?

Comatose 290 Taboo Programmer Team Colleague

or something.

Comatose 290 Taboo Programmer Team Colleague

I'm going to need a bit more information than that. Auto-cad is a program of it's own, so, I'm not sure what you are trying to do.

Comatose 290 Taboo Programmer Team Colleague
Comatose 290 Taboo Programmer Team Colleague

Only if you want to get crazy, and try to do it through a dos command line...say, using shell, or making a batch file, and then shelling the batch file. Opening a file for append should never over-write anything, unless there is already nothing there. Appending a file means literally to add to the end of. I suppose you could post your code that appends, so we can check it out.

Comatose 290 Taboo Programmer Team Colleague

176

Comatose 290 Taboo Programmer Team Colleague

Let's not bump old threads for one.... and secondly, it has nothing to do with my ability or inability to write virus code. It has to do with not helping someone to become a pest. I care if someone releases a virus, especially a virus I wrote, that could potentially infect and ruin thousands of machines. Use your head.

Comatose 290 Taboo Programmer Team Colleague

Adding new menu's to the parent is easy enough.... all you do is make the menu items a control array (by naming them all the same thing, but changing the index to the next number up). Then, just like any object in a control array, load the element, and set it's properties. Once you get into sub-menu's (menu's with child menus [with the cute little arrow pointing right]) you are going to have a much more difficult time. If you are talking about adding items to a pre-existing sub-menu, cool, no problem, just treat it like you would another control array. The hard-part, is when you want to start adding your own sub-menu's to the parent menu, with sub-menu items.
You'll need to use the API to mess with menu's any more complex than that. You can check here for a good reference of menu api's: http://www.mangovision.com/vbapi/ref/funcc.html#menus. And http://www.mangovision.com/vbapi/ref/g/getmenu.html gives you a little code (they all will) on how to work menu's in the API. And Yet Here is a nice one: http://www.mangovision.com/vbapi/ref/i/insertmenuitem.htm.

Anyway, Attached is a project that does the simple addition of menu item's by using a control array, but should you need more, the API is the best bet and the way to go.

Comatose 290 Taboo Programmer Team Colleague

172

Comatose 290 Taboo Programmer Team Colleague

162