473,573 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

saving settings

Hi,

I was wondering how to make a single .exe file, say some kind od clock,
and be able to save some settings (alarm for example) into the same
file? Basically make code rewrite it self...

thanks!
May 29 '06 #1
11 1419
aum
On Mon, 29 May 2006 09:05:36 +0200, SuperHik wrote:
Hi,

I was wondering how to make a single .exe file, say some kind od clock,
and be able to save some settings (alarm for example) into the same
file? Basically make code rewrite it self...

thanks!


Yikes!!!

I'd strongly suggest you read the doco for ConfigParser, and load/save
your config file to/from os.path.join(os .path.expanduse r("~")).

Another option - save your stuff in the Windows Registry

--

Cheers
aum
May 29 '06 #2
aum wrote:
On Mon, 29 May 2006 09:05:36 +0200, SuperHik wrote:
Hi,

I was wondering how to make a single .exe file, say some kind od clock,
and be able to save some settings (alarm for example) into the same
file? Basically make code rewrite it self...

thanks!


Yikes!!!

I'd strongly suggest you read the doco for ConfigParser, and load/save
your config file to/from os.path.join(os .path.expanduse r("~")).

Another option - save your stuff in the Windows Registry


but if I copy this file on the other computer settings will be lost...
May 29 '06 #3
SuperHik wrote:
aum wrote:
On Mon, 29 May 2006 09:05:36 +0200, SuperHik wrote:
Hi,

I was wondering how to make a single .exe file, say some kind od clock,
and be able to save some settings (alarm for example) into the same
file? Basically make code rewrite it self...

thanks!


Yikes!!!

I'd strongly suggest you read the doco for ConfigParser, and load/save
your config file to/from os.path.join(os .path.expanduse r("~")).

Another option - save your stuff in the Windows Registry


but if I copy this file on the other computer settings will be lost...


It _might_ come as a shock to you, but when you install e.g. Word on another
computer, there aren't any documents coming with it. Especially not the
ones you wrote on that other machine.

Seriously: Who is going to copy a executable around? Do you know of any
other program that behaves like that?

Diez
May 29 '06 #4
SuperHik wrote:
aum wrote:
On Mon, 29 May 2006 09:05:36 +0200, SuperHik wrote:
Hi,

I was wondering how to make a single .exe file, say some kind od clock,
and be able to save some settings (alarm for example) into the same
file? Basically make code rewrite it self...

thanks!


Yikes!!!

I'd strongly suggest you read the doco for ConfigParser, and load/save
your config file to/from os.path.join(os .path.expanduse r("~")).

Another option - save your stuff in the Windows Registry


but if I copy this file on the other computer settings will be lost...


Put your program in a writable folder and save configuration right into
that folder. Then your can transfer the whole folder. Tip: sys.path[0]
always contains the path to the directory where "__main__" module is
located.

May 29 '06 #5
Diez B. Roggisch wrote:
SuperHik wrote:
aum wrote:
On Mon, 29 May 2006 09:05:36 +0200, SuperHik wrote:

Hi,

I was wondering how to make a single .exe file, say some kind od clock,
and be able to save some settings (alarm for example) into the same
file? Basically make code rewrite it self...

thanks!
Yikes!!!

I'd strongly suggest you read the doco for ConfigParser, and load/save
your config file to/from os.path.join(os .path.expanduse r("~")).

Another option - save your stuff in the Windows Registry
but if I copy this file on the other computer settings will be lost...


It _might_ come as a shock to you, but when you install e.g. Word on another
computer, there aren't any documents coming with it. Especially not the
ones you wrote on that other machine.

that doesn't shock me :p
anyway you're talking about instalation while I'm talkig about single
standalone file.
Besides, if it was neccessary I bet MS would make that option (and it
wouldn't be a problem since installation is not done from a sinlge file
but from the CD (should be CD-RW in that case) with lots of files and
directories so they'd create just another directory on the installation
CD, say \All Documents\ )
Seriously: Who is going to copy a executable around? Obviously I am. :D
Do you know of any other program that behaves like that? No, but for most programs I used I never bothered to check where did
they put their settings.
That's just the thing, I'm not a professional programmer so I was
wondering is it possible to do it, and if it is how much trouble would
it be. If nothing I will just make a config file right next to the
executable..
Diez

thanks!
May 29 '06 #6
> that doesn't shock me :p
anyway you're talking about instalation while I'm talkig about single
standalone file.
Besides, if it was neccessary I bet MS would make that option (and it
wouldn't be a problem since installation is not done from a sinlge file
but from the CD (should be CD-RW in that case) with lots of files and
directories so they'd create just another directory on the installation
CD, say \All Documents\ )


But that is a folder then. Go put your config-file & program in a folder,
and copy it.

Seriously: Who is going to copy a executable around?

Obviously I am. :D
Do you know of any
other program that behaves like that?

No, but for most programs I used I never bothered to check where did
they put their settings.
That's just the thing, I'm not a professional programmer so I was
wondering is it possible to do it, and if it is how much trouble would
it be. If nothing I will just make a config file right next to the
executable..


Nobody does it that way for a simple reason: lets say you stored some
config-information like an IP-address. Now moving your program somewhere
else makes that a wrong config option - and possibly your program crashes
even before you have the chance to _change_ that config setting. Now you
need either a fresh copy - or just edit/delete the config file. The latter
sounds better to me - and most probably quite a few others programmers.

Diez
May 29 '06 #7
On 2006-05-29, Diez B. Roggisch <de***@nospam.w eb.de> wrote:
It _might_ come as a shock to you, but when you install e.g.
Word on another computer, there aren't any documents coming
with it.
Documents and settings aren't quite the same thing, but it's a
valid point.
Especially not the ones you wrote on that other machine.

Seriously: Who is going to copy a executable around?
I do. I copy putty.exe around all of the time.
Do you know of any other program that behaves like that?


Back in the day, that used to be fairly common under
DOS/Windows. Not that it's still not a really bad idea.

--
Grant Edwards grante Yow! I'm wet! I'm wild!
at
visi.com
May 29 '06 #8
aum
On Mon, 29 May 2006 09:05:36 +0200, SuperHik wrote:
Hi,

I was wondering how to make a single .exe file, say some kind od clock,
and be able to save some settings (alarm for example) into the same
file? Basically make code rewrite it self...

thanks!


Another option I thought of:
- get the Nullsoft NSIS installer
- write a Python wrapper to NSIS if desired
- within your app, include:
- embedded py2exe
- embedded/wrapped NSIS
- within your app offer a menu option to 'export this
program', which changes data files as needed, then invokes
py2exe and NSIS to create a whole new installer exe

That way, you'd have what you're after - a way to distribute your app,
including its current state, as a single EXE file. Also, it would have the
advantage of this EXE being an installer which sets up start menu
shortcuts.

--

Cheers
aum
May 29 '06 #9
Grant Edwards wrote:

Documents and settings aren't quite the same thing, but it's a
valid point.
Especially not the ones you wrote on that other machine.

Seriously: Who is going to copy a executable around?


I do. I copy putty.exe around all of the time.


I download it every time, and if I didn't, I'd be pretty annoyed if I'd copy
it to a friends machine containing ALL MY KEYS embedded into it.
Do you know of any other program that behaves like that?


Back in the day, that used to be fairly common under
DOS/Windows. Not that it's still not a really bad idea.


Back in the day self-modifying code was the craze too. And _some_ people
even do it in python :)

Diez
May 30 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
1874
by: MLH | last post by:
GHudson has working procedures posted at http://www.access-programmers.co.uk/forums/showthread.php?t=66320 They work. Relationships, however, and some minor default settings are not preserved. Reestablishing some default settings and settings is a small price to pay for a set of text files that may save your database from total loss #AND#...
3
1090
by: Marco Roberto | last post by:
Hi, does anybody what is the best format to save particular system settings (ex: Default path to save files, etc) in .Net (XML, ini files, or registry)? Best Regards, Marco
7
1505
by: timb | last post by:
Hi, is it possible to access the properties of a class or structure in a for each statement? I want to iterate through the stirng properties in my class or structure and then write them away to the config file. thanks for your help in advance --
4
2366
by: Kourosh | last post by:
I have a log file that is viewed on the local machine. There are some settings on the html page that allow the user to specify how the file is viewed. I'm just wnodering what are my options in saving these settings (so they could be reloaded next time the user loads the page). Writing to registry, a file, or a cookie? what's the right approach?
4
12443
by: Bill Nguyen | last post by:
How can I detect timezone and whether daylight saving is applied on a client PC/server using VB.NET? Thanks Bill
2
2930
by: Tal Shachar | last post by:
Hi, I have a windows application that needs to save some user preferences to an xml and to load it on the next application run. Saving the preferences is done per user. I know that there is a way of saving it to some path under "Documents and Settings/UserName/...." , but I don't know the correct approach (e.g. path naming convention, how to...
0
1566
by: =?Utf-8?B?VHJhY2tz?= | last post by:
Does the toolstripcontainer etc work at all? I want to save the settings for the toolstrip positions in my app so they start up with the saved positions. Tried using: ToolStripManager.SaveSettings(Me) in form.closing with ToolStripManager.LoadSettings(Me) in form load
3
2193
by: RobEveryThingIsPossible | last post by:
IN VISTA MS Access 2000 Printer Settings Not Saving With Vista Bus. The printer settings (Label or Env.) keep on change back to another setting after saving them on a report or form, when viewing them on other Vista computers. I have tried many things see Example: Open my report in Design mode. Select Page Setup. On the Page tab,...
27
6814
by: RobG | last post by:
I was investigating a function to determine whether daylight saving was being observed on a particular date (given the platform's regional settings) and came across a suggestion at merlyn.com to test the time zone offset on a variety of dates to see if it changes. Based on that, I developed the following checkDST() function which, as far as I...
2
1143
by: AGP | last post by:
VB.NET 2005 i was reading some of the documentation on saving settings and i think i have a good grasp on things with the My.Settings classes. I understand how to bind a control to a setting and also how to save settings manually. The only thing I havent beeen able to find is how to do a massive amount of controls in one swoop. Say on my app...
0
7668
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8179
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8035
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5556
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5257
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3698
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3694
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2166
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
992
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.