Civ4 PBEM Emailer

I dunno, like I said I don't use it. Try PMing Bathsheba666 if ruff isn't about.

EDIT: Have you got a D: drive as well? ;)
 
There's a function called SHGetFolderPath which should give you the correct folder to use.

EDIT: Looks like they changed it http://msdn.microsoft.com/en-us/library/bb762188(v=VS.85).aspx

EDIT2: Vista and Win7 only let apps save data to the user application data folder IIRC.
umm - do you have that in vb? I'll dig out the function that I am using to get the program location and post that if it helps. Vista actually intercepted my calls to the program location and returned the virtual location - it was confusing the heck out of me looking for that data file that it says it was creating and reading(!) ... I just couldn't see it in the folder (this was before I knew about the virtual location).
 
Derrrr
I can only see an exe and 3 icons? where should I be looking for xml?
The (almost) first thing that the program does is create a xml based ini file in the program location. That file is called 'Civ4PBEMEmailer_Init.xml'. I would guess that Win7 is blocking the program from creating that file. Try manually creating the file (see file name above) and put in it, the following:

Code:
<?xml version="1.0"?>
<ROOT>
  <DataPath v="5" />
  <UserDefined v="-" />
</ROOT>
The 'DataPath' value determines where the program looks for the data file. The values are 1, 2, 3, 4, 5 or 6 (see below for locations). Once that file is created and it has a valid data location (and the ability to write data to that data location), it should be fine (famous last words).

 
This is the line of code that points me to the exe folder ...
Code:
Dim lPath As String
lPath = System.AppDomain.CurrentDomain.BaseDirectory()
I'll see if google will be my friend.

Edit: Hmm - this might be what I am after ... http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx

lPath = Environment.GetFolderPath(Environment.SpecialFolder.System)

Differences between the Windows versions
XP/Server 2003

ApplicationData: C:\Documents and Settings\<user name>\Application Data
CommonApplicationData: C:\Documents and Settings\All Users\Application Data
CommonProgramFiles: C:\Program Files\Common Files
DesktopDirectory: C:\Documents and Settings\<user name>\Desktop
LocalApplicationData: C:\Documents and Settings\<user name>\Local Settings\Application Data
MyDocuments: C:\Documents and Settings\<user name>\My Documents
ProgramFiles: C:\Program Files
System: C:\WINDOWS\system32
Vista/Win7/Server 2008

ApplicationData: C:\Users\<user name>\AppData\Roaming
CommonApplicationData: C:\ProgramData
ProgramFiles: C:\Program Files
CommonProgramFiles: C:\Program Files\Common Files
DesktopDirectory: C:\Users\<user name>\Desktop
LocalApplicationData: C:\Users\<user name>\AppData\Local
MyDocuments: C:\Users\<user name>\Documents
System: C:\WINDOWS\system32
 
Yeah that looks the schnizz.

I had a look at that AppDomain thingy last night when it was late - that looks more to do with locating assemblies and such. And yikes Windows programming has changed a lot since I last had to do any ;)

The main rule is you can't write to the application folder in newer version of Windows I think.

It really makes distributing applications a pain in the arse.

Using the registry is probably better than using config files, especially for something as simple as your XML document. Use an XML document if you want a lot of data or structured data. But you can just serialize stuff anyway with .NET and if you don't have the data (first run/want to modify) just bring up a dialog then serialize the data.
 
Using the registry is probably better than using config files, especially for something as simple as your XML document. Use an XML document if you want a lot of data or structured data. But you can just serialize stuff anyway with .NET and if you don't have the data (first run/want to modify) just bring up a dialog then serialize the data.
:run: I thought I was advanced using xml and now you want me to use the registry! I'm not a programer - I just fiddle with this stuff.
 
The registry is standard on all Windows versions, it's the best place for small config stuff like that. EDIT: I bet the app framework you use to create the app even creates a registry key for you!

XML is good for complicated stuff like the civ 4 config files. I've used it before for UI layouts and stuff.

Look into serialisation though - it's easy.
 
Hah I got a part solution.

I set the security on the folder, (did this last night but didn't work) Must have had a late last night brain seizure.

1. Right click the Civ4PBEM_Emailer folder and select properties.
2. click the security tab
3. Click edit
4. Click on the user you normally log in as
5. Click the tick box full control (some other ticks appear below it)
6. Click OK twice and try opening it now.

That should allow the exe to create the file in the folder for windows7 and probably xp too, but haven't tried that.

Now can I get it to work with hotmail? :lol:
 
:smoke: It worked on hotmail

ere is the blurb from their site:

Your account's SMTP server is smtp.live.com (port 25.) Just in case you need your account's entire POP3 settings, here they are:

- POP3 Server: pop3.live.com (port 995)

Note: Please make sure to check the box that indicates that your outgoing server requires authentication (in most e-mail clients, this is not checked by default).

- Username: your full e-mail address
- Password: your Windows Live ID password

Our POP3 service requires that you use Secure Sockets Layer (SSL) with the POP and SMTP connection and use SMTP authentication. This is to ensure that your e-mail address and password are not subject to tampering.

While for your IP address, you have to contact your ISP (Internet Service Provider) for this information.

This is really cool once you get it set up. :woohoo:

Don't forget to save the xml button or else you have to enter it twice, believe me I know :sad:
 
:smoke: It worked on hotmail
I was wondering if it would work on other email providers. I am going to link to your two posts re Win7 and Hotmail.
 
Thanks for the hard work Ruff this is a great time saver. Once you set up the games it's a simple task to send them out.

What's next selecting from your contacts:)
Maybe that's a step too far, would be good though.
 
I'm in the process of changing where the program stores its required info (mainly data directory). I have a trial version that can write and pull that info from my XP registry but the web sites I see say that Vista and W7 are more careful about letting programs do that.

So - some questions:
- can I get the installation program to add the registry keys?
- if so, how?
- anyone out there with Vista / W7 that wants to be a tester?

Dev Items
  • add check to see if using registry (working in dev copy)
  • if not, try and read ini_xml file and update registry (working in dev copy)
  • if that doesn't work, display pop-up asking where to store the data file - update registry on valid user entry
  • add another field to swap out in emails (Civ4GameName)
  • try and extract the Civ4GameName from the save
  • provide user edit access to the Civ4GameName fields
 
I've just upgraded to Win7 and this program has stopped working. Does anyone who has win7 got this working?
 
See my post above. You need to set up the securities in Win7. It's default is to lock everything out so you have to give the user you log in with, full access to write to the folders.

It's been working fine on Windows 7 since I got it set up.
 
yeah - I just needed to re-read the thread. I did see your post (thx) and I gave myself rights to edit the setup xml folder and pointed it to where the data xml stuff was (under my games). I need to tighten up the program to use the register and to ask where the initial data file should be kept.
 
I have a new version of this ready to deploy. Nothing major, just some background stuff. I'm basically using the program to learn stuff. This versions changed involved me learning how to access and change values in the registry, add registry items during the install process and background workers.

Change List
  • uses windows registry to hold the default XML data location
  • added a 'please wait' graphic while emails are being sent
  • installs to 'prog files\RuffCutCode\PBEMEmailer'
Anyway - anyone want to test it?
 
What's the goss on Win 7... ?
I have Win7 and the latest version of this is behaving fine. See the first post for the latest version and the change log.
 
Top Bottom