Sign in to follow this  
Followers 0
Zamphire

Error with ControlGetText

8 posts in this topic

Hey guys, I'm trying to read the text out of a listbox. It's a 3rd party program if that helps any. My eventual goal is to compare the text to see if something is new then take action if it is, but right now I'm having problems just getting it to read.

I'm using this code

#include "GUIListBox.au3"
ControlGetText, $text, TListBox1, New Warehouse Orders

FileWrite('C:\test.txt', $text)

And when I try to run it I get the following error

ControlGetText, $text, TListBox1, New Warehouse Ordesr
ControlGetText^ERROR
Error: Missing separator character after keyword.

Thanks for the help ahead of time!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try

$title = 'New Warehouse Orders'
$text = ''
$control = 'TListBox1'
$controlText = ControlGetText($title, $text, $control)

FileWrite('C:test.txt', $controlText)

Edit: cutnpaste typos

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.  

Share this post


Link to post
Share on other sites

Please see the help file for help on how to use the ControlGetText function, you're missing the parentheses, and quotes around the strings. Also, your format is using AutoHotKey's format for the command, are you sure you're in the right forum? :D


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

Share this post


Link to post
Share on other sites

Please see the help file for help on how to use the ControlGetText function, you're missing the parentheses, and quotes around the strings. Also, your format is using AutoHotKey's format for the command, are you sure you're in the right forum? :D

I actually was pulling from the help file

Example
ControlGetText, OutputVar, Edit1, Untitled -

Found at the bottom of http://www.autohotkey.com/docs/commands/ControlGetText.htm

The example wasn't using parentheses or quotes so I didn't think I needed them. I'm not even sure what AutoHotKey's is...

wait a second

Well shit. Why was I viewing a autohotkey help file. No wonder this isn't working >.>

Moving on!

Realm! Your example worked... kind of. It seemed to work and it made the text file but the text file is blank. Any suggestions?

Share this post


Link to post
Share on other sites

Your links and indications are very much AutoHotKey....This is AutoIt! 2 different but similar languages.


My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.  

Share this post


Link to post
Share on other sites

Yeah, apparently what happened was that I googled ControlGetText and without really looking brought up the first link that popped up and it was an AutoHotKey link.

I'm on the right help page now, and wouldn't you know it, it makes a lot more sense :D

Anyway, I copied and pasted your script exactly Realm and it seems to work, but the text file is blank. Any idea why that would be?

Share this post


Link to post
Share on other sites

There is also a Help File that was included with your AutoIt Download. It contains more information than the online help file did, that may have change over the last year and since I last checked. However it can be found in your AutoIt3 Directory under AutoIt3/AutoIt.chm


My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.  

Share this post


Link to post
Share on other sites

Hmmm, from something I just read on the forums I'm going to guess it's not working because this program uses custom classes and apparently AutoIt only works with standard windows stuff, so that's why it doens't work. Oh well, thanks for the effort.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0