Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

How to Consolewrite GUI user input

$
0
0
Hi,

Im new to AutoID and ive just been messing around with it as im going to be using AutoID for a project.

Ive managed to create a GUI with some simple buttons, Im trying to make it so when you click on 'Button1' it will bring up a another window where you can enter some information (This part i have done so far)

Im having trouble after this in using the information inputted by the user, is it possible to store this in a string like with C+?

Scenario:
User is giving a survey and is inputting the information given by the surveyor  after hitting 'Go' it should load up the page (ive used Google for testing as im not at work) and then type in the information given earlier. Here is an example of my script.

#include <GUIConstants.au3>
Opt("GuiOnEventMode", 1)
GUICreate("Gui", 500, 500)
GuiSetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
$Button1 = GUICtrlCreateButton ( "Button 1", 5, 5, 100, 200)
GUICtrlSetOnEvent(-1, "OKPressed")
$Button2 = GUICtrlCreateButton ( "Button 2", 100, 5, 100, 200)
GUICtrlSetOnEvent(-1, "OKPressedd")

GUISetState()
While 1
  Sleep(10)
WEnd
Exit
Func OKPressed()
  ;Startifscruot
  $gui = GUICreate("Input storecode and Name", 640, 280)
$input = GUICtrlCreateInput("Store Code", 10, 10, 620, 20)
$edit = GUICtrlCreateEdit("Name", 10, 40, 620, 200)
$button = GUICtrlCreateButton("Go", 10, 250, 620, 20)
GUICtrlSetOnEvent(-1, "Gopressed")
GUISetState(@SW_SHOW)
Sleep(2000)
;Endofit
EndFunc
Func Gopressed()
   WinActivate("Google - Windows Internet Explorer")
   MouseMove( 490, 502)
   MouseClick("left")
   FilewriteLine($input, GUICtrlRead
EndFunc
Func OKPressedd()
   Run("notepad.exe C:\Users\Anthony\Desktop\Startofday\Passwords")
   sleep(1000)
   $URL	= "www.google.com"
			 $fd		= FileOpen(@TEMPDir & "url.url",2)
			 if $fd = -1 Then Exit
			 FileWriteLine($fd,"[InternetShortcut]")
			 FileWriteLine($fd,"URL=" & $URL)
			 FileClose($fd)
			 Run(@comspec & " /c " & chr(34) & @TEMPDir & "url.url" & chr(34))
	sleep(5000)
	WinActivate("Google - Windows Internet Explorer")
	WinSetState("[ACTIVE]", "", @SW_MAXIMIZE)
   
EndFunc

Func SpecialEvents()
   If @GUI_CTRLID = $GUI_EVENT_CLOSE Then Exit
EndFunc


Thanks for any assistance.

Ant

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>