Filling web form using checkboxes in GUI => text related to checkboxes pasted separately

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
docfizzle
Posts: 37
Joined: 08 Sep 2022, 21:09

Filling web form using checkboxes in GUI => text related to checkboxes pasted separately

Post by docfizzle » 09 Oct 2022, 17:46

Hey there, everyone!

I am using a GUI to create text that I want to submit into two separate text boxes on a web form.

Right now, all the text related to the checked text boxes gets put on the clipboard and pasted as one clump.

To make it possible to split the text related to the GUI checkboxes, I'm thinking about separating the text somehow to textblock1 and textblock2.

Then send/paste textblock1 and textblock2 into different parts of a web form separated by {tab}. I would also send a few other keystrokes to completely fill out the web form.

The question that I am struggling with:
How could I approach modifying this script to break up the text from the checkboxes into textblock1 and textblock2 to input text separated by {tab} into different text boxes in a webform?

* This script is a variation on the script from this thread: GUI checkboxes to generate text in Edit control - viewtopic.php?style=1&f=76&t=109051&p=485975#p485531

Code: Select all

Gui, Add , Text    ,, Insert Text
Gui, Add , CheckBox, vSRC  gUpdate, Student Responsibility Checklist
Gui, Add , CheckBox, vI20  gUpdate, I-20
Gui, Add , CheckBox, vI94  gUpdate, I-94
Gui, Add , CheckBox, vVisa gUpdate, Visa
Gui, Add , CheckBox, vPPT  gUpdate, Passport
Gui, Add , CheckBox, vDep  gUpdate, Dependent Docs
Gui, Add , Text    , wp y+20 , Email Template:
Gui, Add , Edit    , w500 vtext r10
Gui, Add , Button  , wp, Copy
Gui, Show,         , E-mail
Return

Update:
Gui, Submit, NoHide
text = ....                                                 ; this text needs to be pasted into textbox 1 : ""
text .= SRC ? "SRC text" document : ""        ; intended for textbox 1 : ""
text .= I20 ? "I20 text" document : ""          ; intended for textbox 1 : ""
text .= I94 ? "I94 text" document : ""          ; this text needs to be pasted into textbox 2 (separated by one tab on web form) : ""
text .= Visa ? "Visa Text" document : ""       ; intended for textbox 2 : ""
text .= PPT ? "PPT Text" document : ""        ; intended for textbox 2 : ""
text .= Dep ? "Dep Text" document : ""        ; intended for textbox 2 : ""

GuiControl,, text, %text%
Return

ButtonCopy:
Gui, Submit, NoHide
Clipboard := "", Clipboard := text
ClipWait, 0
If ErrorLevel
     MsgBox, 48, Error    , An error occurred while waiting for the clipboard.
Else 
	;shift focus to what needs focus - using WordPad for testing purposes
	{
	if WinExist("Document - WordPad")
	WinActivate ; Use the window found by WinExist.
	sleep 100
	Send, ^v ; would like to split this into text into textblock1 and textblock2 separated by a tab on the web form
	send {tab}
	send [standard text that needs to be sent into textbox 3 in web form]
	send {tab}
	send [standard text that needs to be sent into textbox 4 in web form]
	}
	Return
Return
Any thoughts on how to approach this?
Thank you so much for considering this with me!
Last edited by docfizzle on 12 Oct 2022, 15:39, edited 11 times in total.

docfizzle
Posts: 37
Joined: 08 Sep 2022, 21:09

Re: Filling web form using GUI - sending tabs, etc.

Post by docfizzle » 09 Oct 2022, 22:14

....
Last edited by docfizzle on 10 Oct 2022, 17:32, edited 1 time in total.

User avatar
mikeyww
Posts: 27214
Joined: 09 Sep 2014, 18:38

Re: Filling web form using GUI - sending tabs, etc.

Post by mikeyww » 10 Oct 2022, 06:24

Hi,

I did not try your script, but if you are setting the clipboard and then pasting it, I would recommend :arrow: ClipWait.

docfizzle
Posts: 37
Joined: 08 Sep 2022, 21:09

Re: Filling web form using GUI - sending tabs, etc.

Post by docfizzle » 10 Oct 2022, 14:49

Thank you for the tip, Mikey - and thank you for all that you contribute to this forum - you have helped me significantly.

Fixed a basic mistake.
Last edited by docfizzle on 10 Oct 2022, 21:45, edited 1 time in total.

User avatar
mikeyww
Posts: 27214
Joined: 09 Sep 2014, 18:38

Re: Filling web form using GUI - sending tabs, etc.

Post by mikeyww » 10 Oct 2022, 14:59

Code: Select all

Gui, Font, s10
Gui, Add , Text    ,, Which documents are missing?
Gui, Add , CheckBox, vSRC  gUpdate, Student Responsibility Checklist
Gui, Add , CheckBox, vI20  gUpdate, I-20
Gui, Add , CheckBox, vI94  gUpdate, I-94
Gui, Add , CheckBox, vVisa gUpdate, Visa
Gui, Add , CheckBox, vPPT  gUpdate, Passport
Gui, Add , CheckBox, vDep  gUpdate, Dependent Docs
Gui, Add , Text    , wp y+20 , Email Template:
Gui, Add , Edit    , w500 vtext r10
Gui, Add , Button  , wp, Copy
Gui, Show,         , E-mail
Return

Update:
Gui, Submit, NoHide
text = Hello student,`n`nI have reviewed your check in submission. Before I can accept your check in documents, please address the following:`n

text .= SRC ? "`nStudent Responsibility Checklist (SRC) – filled out during your CANVAS check-in course" document : ""
text .= I20 ? "`nI-20 page 1 (or DS-2019 page 1) – please physically sign at the bottom of page 1 in ink before scanning if you have not already done that" document : ""
text .= I94 ? "`nYour most recent I-94 (Go to the CBP website AFTER you arrive in the U.S. and choose Most Recent I-94, not Travel History" document : ""
text .= Visa ? "`nYour US visa showing F-1 or J-1 classification" document : ""
text .= PPT ? "`nYour passport picture page showing the expiration date of your passport" document : ""
text .= Dep ? "`nIf you have F-2 or J-2 dependents (spouse and/or children) who traveled with you to the US, scan their documents too and include them in the PDF that you submit." document : ""

text .= "`n`nPlease make sure to upload ALL FIVE required documents again and click SUBMIT. Your request is currently noted as Clarification Requested in MPassport and is available for you to edit. You can access this request from the Requests tab under the heading Pending Requests. Please do not begin a brand new request.`n`nTake Care,`n`nOfficer Name`nInternational Center"
GuiControl,, text, %text%
Return

ButtonCopy:
Gui, Submit, NoHide
Clipboard := "", Clipboard := text
ClipWait, 0
If ErrorLevel
     MsgBox, 48, Error    , An error occurred while waiting for the clipboard.
Else MsgBox, 64, Clipboard, %Clipboard%
Return
Explained: ClipWait

docfizzle
Posts: 37
Joined: 08 Sep 2022, 21:09

Re: Filling web form using GUI - sending tabs, etc.

Post by docfizzle » 10 Oct 2022, 17:31

Thank you so much - I figured out my silly mistake and got things back on track!!

Now I am using ClipWait as you recommended.

docfizzle
Posts: 37
Joined: 08 Sep 2022, 21:09

Re: Filling web form using GUI - sending tabs, etc.

Post by docfizzle » 10 Oct 2022, 21:58

mikeyww wrote:
10 Oct 2022, 14:59

Code: Select all

Gui, Font, s10
Gui, Add , Text    ,, Which documents are missing?
Gui, Add , CheckBox, vSRC  gUpdate, Student Responsibility Checklist
Gui, Add , CheckBox, vI20  gUpdate, I-20
Gui, Add , CheckBox, vI94  gUpdate, I-94
Gui, Add , CheckBox, vVisa gUpdate, Visa
Gui, Add , CheckBox, vPPT  gUpdate, Passport
Gui, Add , CheckBox, vDep  gUpdate, Dependent Docs
Gui, Add , Text    , wp y+20 , Email Template:
Gui, Add , Edit    , w500 vtext r10
Gui, Add , Button  , wp, Copy
Gui, Show,         , E-mail
Return

Update:
Gui, Submit, NoHide
text = Hello student,`n`nI have reviewed your check in submission. Before I can accept your check in documents, please address the following:`n

text .= SRC ? "`nStudent Responsibility Checklist (SRC) – filled out during your CANVAS check-in course" document : ""
text .= I20 ? "`nI-20 page 1 (or DS-2019 page 1) – please physically sign at the bottom of page 1 in ink before scanning if you have not already done that" document : ""
text .= I94 ? "`nYour most recent I-94 (Go to the CBP website AFTER you arrive in the U.S. and choose Most Recent I-94, not Travel History" document : ""
text .= Visa ? "`nYour US visa showing F-1 or J-1 classification" document : ""
text .= PPT ? "`nYour passport picture page showing the expiration date of your passport" document : ""
text .= Dep ? "`nIf you have F-2 or J-2 dependents (spouse and/or children) who traveled with you to the US, scan their documents too and include them in the PDF that you submit." document : ""

text .= "`n`nPlease make sure to upload ALL FIVE required documents again and click SUBMIT. Your request is currently noted as Clarification Requested in MPassport and is available for you to edit. You can access this request from the Requests tab under the heading Pending Requests. Please do not begin a brand new request.`n`nTake Care,`n`nOfficer Name`nInternational Center"
GuiControl,, text, %text%
Return

ButtonCopy:
Gui, Submit, NoHide
Clipboard := "", Clipboard := text
ClipWait, 0
If ErrorLevel
     MsgBox, 48, Error    , An error occurred while waiting for the clipboard.
Else MsgBox, 64, Clipboard, %Clipboard%
Return
Explained: ClipWait
Thank you, Mikey! I integrated ClipWait and reformulated my original question in the first post of this thread.

User avatar
mikeyww
Posts: 27214
Joined: 09 Sep 2014, 18:38

Re: Filling web form using checkboxes in GUI - text related to checkboxes + sending {tab}

Post by mikeyww » 11 Oct 2022, 06:34

Instead of moving backwards in the thread, I would recommend posting any related new questions in a reply below. This eases understanding and response.

docfizzle
Posts: 37
Joined: 08 Sep 2022, 21:09

Re: Filling web form using checkboxes in GUI - text related to checkboxes + sending {tab}

Post by docfizzle » 12 Oct 2022, 12:26

Thanks for the tip, Mikey! I'll keep things moving forward. I was mainly concerned that I did not ask my question clearly enough.

I think that I want to:
1) create text from some checkboxes on GUI => click submit

2) text from first few checkboxes => variable1 => clipboard => paste into textbox1 on website
text from last few checkboxes => variable2 => clipboard => paste into textbox2 on website

I keep running into obstacles with the approaches I have tried.

User avatar
mikeyww
Posts: 27214
Joined: 09 Sep 2014, 18:38

Re: Filling web form using checkboxes in GUI => text related to checkboxes pasted separately

Post by mikeyww » 13 Oct 2022, 06:37

You build a variable called "text". Instead, you can build two separate variables, and then use each of them when needed.

docfizzle
Posts: 37
Joined: 08 Sep 2022, 21:09

Re: Filling web form using checkboxes in GUI => text related to checkboxes pasted separately

Post by docfizzle » 21 Oct 2022, 20:52

Thanks Mikey... and hello everyone!

I know that I am fairly off in terms of how I'm trying to approach this.

Would totally appreciate any direction!
Gui, Add , Text ,, Insert Text
Gui, Add , CheckBox, vSRC gUpdate, Student Responsibility Checklist
Gui, Add , CheckBox, vI20 gUpdate, I-20
Gui, Add , CheckBox, vI94 gUpdate, I-94
Gui, Add , CheckBox, vVisa gUpdate, Visa
Gui, Add , CheckBox, vPPT gUpdate, Passport
Gui, Add , CheckBox, vDep gUpdate, Dependent Docs
Gui, Add , Text , wp y+20 , Email Template:
Gui, Add , Edit , w500 vtext r10
Gui, Add , Button , wp, Copy
Gui, Show, , E-mail
Return

Update:
Gui, Submit, NoHide
text1 = .... ; this text needs to be pasted into textbox 1 : ""
text1 .= SRC ? "SRC text" document : "" ; intended for textbox 1 : ""
text1 .= I20 ? "I20 text" document : "" ; intended for textbox 1 : ""
text1 .= I94 ? "I94 text" document : "" ; this text needs to be pasted into textbox 2 (separated by one tab on web form) : ""
text2 .= Visa ? "Visa Text" document : "" ; intended for textbox 2 : ""
text2 .= PPT ? "PPT Text" document : "" ; intended for textbox 2 : ""
text2 .= Dep ? "Dep Text" document : "" ; intended for textbox 2 : ""

GuiControl,, text, %text%
GuiControl,, text2, %text2%
Return

ButtonCopy:
Gui, Submit, NoHide
Clipboard := "", Clipboard := text
ClipWait, 0
If ErrorLevel
MsgBox, 48, Error , An error occurred while waiting for the clipboard.
Else
;shift focus to what needs focus - using WordPad for testing purposes
{
if WinExist("Document - WordPad")
WinActivate ; Use the window found by WinExist.
sleep 100
Send, ^v ; text1
send {tab}
Clipboard := "", Clipboard := text2
ClipWait, 0
Send, ^v ; text2
}
Return

User avatar
mikeyww
Posts: 27214
Joined: 09 Sep 2014, 18:38

Re: Filling web form using checkboxes in GUI => text related to checkboxes pasted separately

Post by mikeyww » 22 Oct 2022, 06:40

One helpful approach to debugging is to determine the values of the variables in your script. Although you set the clipboard to text, you are actually using a variable named text1.

Post Reply

Return to “Ask for Help (v1)”