IniWrite and IniRead not working for 2nd gui.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
TheEpicFaceGamer
Posts: 9
Joined: 20 Aug 2020, 16:01
Contact:

IniWrite and IniRead not working for 2nd gui.

22 Aug 2020, 21:06

So, I am trying to IniWrite and Make a file, Then IniRead and paste it in a second GUI,
At "IniWrite, 10, C:\Users\Ethan\Desktop\GoogleMeetSchoolHackSaveFileChats.ini, Main, Value" It's supposed to create a file, but it doesn't. I think the issue is that it is in a second GUI and I didn't state it the correct way, but I'm not sure how to correct it.
The "IniRead, Chat1Read, GoogleMeetSchoolHackSaveFileChats.ini, section1, key
Gui Control, 2: Chat1, %Chat1Read%" for each edit box it's supposed to take out from the file and paste whatever is in the sections in the .ini and paste them in the edit boxes at the 2nd file.

Code: Select all

ButtonSaveChats:
{
Gui, Submit, NoHide
Gui, 2: Submit, NoHide
IniWrite, 10, C:\Users\Ethan\Desktop\GoogleMeetSchoolHackSaveFileChats.ini, Main, Value
IniWrite, %Chat1%, GoogleMeetSchoolHackSaveFileChats.ini, section1, key
IniWrite, %Chat2%, GoogleMeetSchoolHackSaveFileChats.ini, section2, key
IniWrite, %Chat3%, GoogleMeetSchoolHackSaveFileChats.ini, section3, key
IniWrite, %Chat4%, GoogleMeetSchoolHackSaveFileChats.ini, section4, key
IniWrite, %Chat5%, GoogleMeetSchoolHackSaveFileChats.ini, section5, key
IniWrite, %Chat6%, GoogleMeetSchoolHackSaveFileChats.ini, section6, key
IniWrite, %Chat7%, GoogleMeetSchoolHackSaveFileChats.ini, section7, key
IniWrite, %Chat8%, GoogleMeetSchoolHackSaveFileChats.ini, section8, key
}
return
Here is the button script where it makes a .ini file and then pastes whatever is in the edit boxes. (Chat1-8 are edit boxes on the second gui.) (The second GUI is shown if you press the Set Links on the first GUI, but I didn't put that in this post.)
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: IniWrite and IniRead not working for 2nd gui.

23 Aug 2020, 01:11

Code: Select all

iniP := USERPROFILE "\Desktop\GoogleMeetSchoolHackSaveFileChats.ini"

Chat1 := "a"			; creating content for testing
Chat2 := "b"			; s.a.

Gui, 1:New				; https://www.autohotkey.com/boards/viewtopic.php?f=76&t=80218
Gui, Add, Edit, vE1		; edit field that gets updated with the value taken from the ini
Gui, Show,,% chr(32)	; showtime
Sleep 5000				; suspense delay!

ButtonSaveChats:
    Gui,	Submit, NoHide
    Gui, 2: Submit, NoHide
    IniWrite, 10,% iniP , Main, Value
    Loop 8
        IniWrite,% Chat%A_Index%,% iniP, section%A_Index%, key
	IniRead, Chat1Read,% iniP, section1, key					; let's get its first value ...
	GuiControl,, E1,% Chat1Read									; to update the edit field
	Sleep 5000
	Gui, Destroy												; getting rid of that ame gui
Return

F12::Run,% "notepad.exe " iniP									; press F12 to check the created ini-file.
User avatar
Maestr0
Posts: 136
Joined: 05 Dec 2013, 17:43

Re: IniWrite and IniRead not working for 2nd gui.

23 Aug 2020, 03:01

here is some code that gives you an idea of how you could troubleshoot your issue and how information from different GUIs work.
I think your issue might be in the variable your second GUI outputs to, but I can't tell because you didn't supply that code.

Code: Select all

  gosub gui1
  gosub gui2

  msgbox should be empty `n %1_edit% : %2_edit%

  gui, submit, nohide
  gui, 2:submit, nohide

  msgbox should be filled`n %1_edit% : %2_edit%
return

gui1:
  gui, add, edit, v1_edit, this is a triumph
  gui, show
return

gui2:
  gui, 2:add, edit, v2_edit, I'm making a note here: huge success
  gui, 2:show
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 117 guests