Jump to content

Recommended Posts

Posted

Good Day.

I have programmed in Autoit a long long time ago and now I would like to pick it up again but now I am pressed to create a script that will capture the answers form a GUI with multiple input boxes in the one GUI and then create an answer file in a specific format.

ex: All in the same GUI

Incumbent 1 Incumbent 2

1: (answer 1) Points: 1: (answer 1) Points:

2. (answer 2) Points: 2. (answer 2) Points:

3: (answer 3) Points: 3: (answer 3) Points:

4: (answer 4) Points: 4: (answer 4) Points:

5: (answer 5) Points: 5: (answer 5) Points:

(Button) Populate part 1 (save) (Button) Populate part 2 (save)

(Button) Clear answer file (which would reset the answer file to it's original state)

(Button) Clear form

Answer file (standard xml format):

<?xml version="1.0" encoding="UTF-8"?>

<questions>

<question text="New table">

<answer text="" points=""/>

<answer text="" points=""/>

<answer text="" points=""/>

<answer text="" points=""/>

<answer text="" points=""/>

<answer text="" points=""/>

<answer text="" points=""/>

<answer text="" points=""/>

<answer text="" points=""/>

<answer text="" points=""/>

</question>

</questions>

The answer data would be placed between the "" in the respective lines. For text and points.

I know I'm asking a lot but I just don't know were to start. Thanks in advance for any reply.

Posted

Help file >> GUI management and then search XML in the Forum.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted

Thanks for the reply. So I looked at the help file and for the XML file it's not to relevent (my bad) it is just a TXT file. I am almost there...I was able to create my GUI with the inout boxes but now I am trying to write to a specific line and collumn but I can't fine how. I can write to the file but not hwere I want it to be.

ex:

Answer file:

< ?xml version="1.0" encoding="UTF-8"?>

< questions>

<question text="New table">

<answer text="(With answer 1, I want to write here)" points="(With answer 2, I want to write here)"/>

<answer text="(With answer 3, I want to write here)" points="(With answer 4, I want to write here)"/>

<answer text="(With answer 5, I want to write here)" points="(With answer 6, I want to write here)"/>

and so on...

Posted

That looks like an XML file to me.

< ?xml version="1.0" encoding="UTF-8"?>

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

If you've written code then best to show us what you've written.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted

#include <GUIConstants.au3>

#include <File.au3>

Global $rep1_1

Func Stop()

Exit 0

EndFunc ;==>Stop

MENU()

Func MENU()

GUICreate("Incumbant answers", 450, 500)

GUICtrlCreateLabel("Incumbant 1", 15, 15)

GUICtrlCreateLabel("Incumbant 2", 235, 15)

GUICtrlCreateLabel("Answer 1", 15, 40)

GUICtrlCreateLabel("Point", 175, 40)

GUICtrlCreateLabel("Answer 1", 235, 40)

GUICtrlCreateLabel("Point", 395, 40)

$rep1_1 = GUICtrlCreateInput("", 10, 60, 150, 20)

$point1_1 = GUICtrlCreateInput("", 170, 60, 40, 20)

$rep1_2 = GUICtrlCreateInput("", 230, 60, 150, 20)

$point1_2 = GUICtrlCreateInput("", 390, 60, 40, 20)

$write_rep1 = GUICtrlCreateButton("Write incumbant 1, 15, 450, 140, 20)

GUISetState(@SW_SHOW)

GUISetState()

While 1

Switch GUIGetMsg()

Case $GUI_EVENT_CLOSE

ExitLoop

Case $write_rep1

AddRepA()

EndSwitch

WEnd

GUIDelete()

EndFunc ;==>MENU

Func AddRepA()

$a = GUICtrlRead($rep1_1)

$file1 = FileOpen("Filepathbonusquestions.xml", 1)

FileWriteLine($file1, $a)

FileClose($file1)

EndFunc ;==>AddrepA

I only did the one line for testing and only for Incumbant 1, but I will repeat 4 more times (5 answers each).

Posted

#include <GUIConstantsEx.au3>

Global $aData[9][3] = [[8]]

GUICreate("Incumbant answers", 450, 500)
If Not @Compiled Then GUISetIcon('shell32.dll', 8)

$d1 = -20
$d2 = -37
$d3 = -20
For $i = 1 To $aData[0][0]
    GUICtrlCreateLabel("Incumbant " & $i, 10, $i * 40 + $d1)
    GUICtrlCreateLabel("Answer " & $i, 115, $i * 40 + $d2)
    GUICtrlCreateLabel("Point " & $i, 270, $i * 40 + $d2)
    $aData[$i][0] = GUICtrlCreateInput("", 110, $i * 40 + $d3, 150, 20)
    $aData[$i][1] = GUICtrlCreateInput("", 270, $i * 40 + $d3, 40, 20)
Next

$write_rep1 = GUICtrlCreateButton("Write incumbant 1", 205, 450, 140, 28)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $write_rep1
            AddRepA()
    EndSwitch
WEnd

Func AddRepA()
    Local $a = '', $hFile
    For $i = 1 To $aData[0][0]
        $a &= GUICtrlRead($aData[$i][0]) & ' = ' & GUICtrlRead($aData[$i][1]) & @CRLF
    Next
    $hFile = FileOpen(@ScriptDir & "bonusquestions.xml", 2)
    FileWriteLine($hFile, $a)
    FileClose($hFile)
EndFunc   ;==>AddRepA

  • 2 weeks later...

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...