Paste data in field and use it Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
magicool
Posts: 2
Joined: 23 Nov 2017, 06:58

Paste data in field and use it

23 Nov 2017, 07:51

Hello,
Need some help with my script please!
I can paste the data from clipboard, but on submit/START FileAppend does not read/use the data from the fields MyEditControl2 and MyEditControl1.
What am I doing wrong?

Thank you!

Code: Select all

#SingleInstance Force
#Persistent
#NoEnv
SetBatchLines, -1

Gui, MyGUI:Font, s10 cNavy wBold,

Gui, MyGUI:Add, Text, x10 y10 w200 h16 , ADDRESS
Gui, MyGUI:Add, Edit, x10 y30 w500 h30 vMyEditControl2 hwndMyEditControlID1,
Gui, MyGUI:Add, Button, x520 y30 w200 h30 gPaste1, Paste

Gui, MyGUI:Add, Text, x10 y70 w200 h16 , NAME
Gui, MyGUI:Add, Edit, x10 y90 w500 h30 vMyEditControl1 hwndMyEditControlID1,
Gui, MyGUI:Add, Button, x520 y90 w200 h30 gPaste2, Paste

Gui, MyGUI:Font, s16 wBold, 
Gui, MyGUI: Add, Button, x10 y130 w710 h40 gButtonOK, START

Gui, MyGUI:Font, s10 cNavy,
Gui, MyGUI:Add, Text, x400 y180 w100 h20 , Helper

Gui, MyGUI:Show, x765 y246 h200 w800, Helper
Return

ButtonOK:
Gui MyGUY: Submit
	Goto, Insert

Paste1:
GuiControl, MyGUI:, MyEditControl2, % clipboard
return

Paste2:
GuiControl, MyGUI:, MyEditControl1, % clipboard
return

Insert:
FileDelete, details.json
FileAppend, {`n    "settings": {`n        "key": "%MyEditControl2%"`, `n        "server": "%MyEditControl1%"`n    }`, `n    "type": "custom"`n}, details.json

GuiClose:
ExitApp
Odlanir
Posts: 659
Joined: 20 Oct 2016, 08:20

Re: Paste data in field and use it  Topic is solved

23 Nov 2017, 08:21

You have also named the HVND var for the two edit controls with the same name. Correct it. Even if you don't use any HWND in your script.
I suggest also to put a return after every subroutine.
This should work.

Code: Select all

Insert:
Gui, Submit, NoHide ; <------------------ Insert this in your subroutine
FileDelete, details.json
FileAppend, {`n    "settings": {`n        "key": "%MyEditControl2%"`, `n        "server": "%MyEditControl1%"`n    }`, `n    "type": "custom"`n}, details.json
return
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
magicool
Posts: 2
Joined: 23 Nov 2017, 06:58

Re: Paste data in field and use it

23 Nov 2017, 08:52

Yes!!! That works!
Thank you so much!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: coder96, Google [Bot], RandomBoy, Rohwedder and 171 guests