Jump to content

Problem with storing certain window titles (in this case, Notepad++) into ini files


Recommended Posts

#include <Misc.au3>

MsgBox ( 0, "Test", "Select a window to test." )

Do
Until _IsPressed(01)

Sleep ( 500 )

$sTitle = WinGetTitle ( "[ACTIVE]" )
$aPos = WinGetPos ( "[ACTIVE]" )

IniWrite ( "config.ini", $sTitle, "X", $aPos[0] )
IniWrite ( "config.ini", $sTitle, "Y", $aPos[1] )
IniWrite ( "config.ini", $sTitle, "W", $aPos[2] )
IniWrite ( "config.ini", $sTitle, "H", $aPos[3] )

I'm trying to store a window title and associated information into an ini file using IniWrite(). Notepad++ seems to break the [section]. Can somebody help me find a way around this issue? I appreciate any help.

Edit: Not FileWrite(), I'm sorry. I was in a rush to send this forum post before I had to leave somewhere. I meant IniWrite()

Edited by D3fr0s7
Correction to original question
Link to post
Share on other sites
  • Developers

The posted script is confusing as there is no FileWrite() in it and what exactly is the relation to Notepad++?
Try to explain your issue is a way we can understand and replicate it.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

I'm working on a script that will save window titles and their positions into an ini file for later use. It was going good until IniWrite() tried to write a window title that contained brackets in it, as I've just found I was able to replicate with a regular notepad file, the name of which is "File with [brackets] in the name.txt" so now that I was able to sit down and mess with the program a little, I've found that window titles that contain brackets seem to be ruining the IniWrite() function's job. Is there a way around this issue?

NotePad++ isnt the problem, it was that the title of the program that I happened to use and that broke my script was titled "Notepad++ [administrator]" and it was the brackets, not necessarily the Notepad++ program that caused it. Attached is a picture of the inifile that this creates a problem in:

1312249744_Screenshot2022-12-0218195777.png.67dc698705cc1e6d11446323d806ab61.png

I'd appreciate any suggestions to get around this issue.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...