Jump to content
Sign in to follow this  
Shravank

GetText not retrieving name of the index

Recommended Posts

I am trying to get the Text of given item in controllistview object (SysListView32). 

ControlListView("Select", "", "[CLASS:SysListView32; INSTANCE:1]", "Select",0,0)

This statement is selecting the item but below statement is not getting the text of the item. It is returning item no not text.

    $txtItem = ControlListView("Select", "", "[CLASS:SysListView32; INSTANCE:1]", "GetText",0)

Let me know if I am missing anything here.

Share this post


Link to post
Share on other sites

Did not try but maybe you need a second 0 here (...., "GetText",0, 0)

Do you get an error? Always check for errors.


Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

Moved to the appropriate forum, as the DEV forum very clearly states:

Quote

Do not create AutoIt-related topics here, use AutoIt General Help and Support

 


"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites

On installing SciTE4AutoIt3.exe, the program displays the name of the item. However, while compiling, I am encountering below error message:

---------------------------
AutoIt Error
---------------------------
Line 45  (File "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3"):

#include <WinAPIFiles.au3>

Error: Error opening the file.

---------------------------
OK   
---------------------------
How to resolve this issue.

Share this post


Link to post
Share on other sites
10 minutes ago, Shravank said:

How to resolve this issue.

You are sure you installed Autoit3 in the standard way with the standard installer as this sounds like a standard UDF can't be found?
If so, which version of AutoIt3 and SciTE4AutoIt3 are you running?

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Hi,

I have updated both to the latest and 'AutoIt' error is resolved.

for the actual problem under this thread, the problem is resolved if the script is compiled using 'AutoIt v3' -> Compile Script to .exe (x64) option. Using this .exe, it is getting the item text.

If it is compiled from Tools->Compile option within AutoIT, then GetText is not getting the text of the item.

Thanks,

Shravan

 

 

On installing SciTE4AutoIt3.exe, the program displays the name of the item. However, while compiling, I am encountering below error message:

---------------------------
AutoIt Error
---------------------------
Line 45  (File "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3"):

#include <WinAPIFiles.au3>

Error: Error opening the file.

---------------------------
OK   
---------------------------
How to resolve this issue.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By jantograaf
      Hi all,
      I've been search all around this forum for a solution, but so far haven't been able to find one. So I thought I'd explain it as good as possible and ask here for your views on the issue.
      Situation:
      I'm trying to automatically (on first run of a newly installed PC for our customers) open the adapter properties of a specific network adapter and then disable all protocols except TCP/IP V4. This is needed for specific functionality with hardware connected to this adapter. I am aware of most of the existing tools (wmic/netsh/devcon/...) to interfere with network adapters, but apart from a WHOLE lot of work in the registry, automating the checkmarks in the properties window should be the fastest solution.
      System is Windows 10 64-Bit and I've compiled the application as a x64-executable (since I know from the past that the choice between 32- and 64-bit can have consequences for interaction with SysListViews).
      Let's suppose the adapter is called "ADAPTERXX" (I am aware that my screenshot shows FUJIFILM, but that's from my own PC)
      Problem:
      I am perfectly able to automatically open the properties window of the correct adapter using the following code (I know the sending of the keystrokes can be programmed in a little loop, no worries, I'll get to this a little later, this is just a quick draft)...
      ShellExecute("control.exe","ncpa.cpl",@WindowsDir,"",@SW_SHOW) WinWait("Network Connections","") WinActivate("Network Connections","") WinWaitActive("Network Connections","") Send("{F5}") Sleep(250) BlockInput(1) Send("{A}") Send("{D}") Send("{A}") Send("{P}") Send("{T}") Send("{E}") Send("{R}") Send("{X}") Sleep(500) Send("{APPSKEY}") Sleep(100) Send("{R}") Local $ListWindow = WinWaitActive("ADAPTERXX Properties","") When I arrive in this window, I can detect which specific options has which specific ID in the SysListView32-instance by using:
      ControlListView("ADAPTERXX Properties","","[CLASSNN:SysListView321]","FindItem","Client for Microsoft Networks") But then, I can't control the checkmark in front of the text and the icon... I've tried lots of solutions.
      I've tried checking the state, but this next command always returns 'True'
      Local $GHandle = ControlGetHandle("ADAPTERXX Properties","","[CLASSNN:SysListView321]") MsgBox(0,"Is Item3 checked?",_GUICtrlListView_GetItemChecked($GHandle,3)) I've tried selecting or deselecting, but no result...
      ControlListView("FUJIFILM Properties","","[CLASSNN:SysListView321]","Deselect",$List_CMN) Creating an array of the window returns an empty array
      Local $ListArray = _GUICtrlListView_CreateArray($GHandle,Default)  
      If anyone has any ideas, please shoot. It's also something that anyone can try at home with their own 'network properties', just change the ADAPTERXX to another name and the code to select the right adapter in the network connections window (all the little keystrokes). I'm open to any and all suggestions, I'm just at the end of my wits here...
      Thanks in advance!
      Jan

    • By martinstut
      While developing an AutoIt-based application for an international christian organization, the need came up to provide this application for users of different native languages. So MsgBox(64, "App Title", "Please reboot your computer to complete the process.") is no longer good enough. The application needs to present its user interface in a different language, depending on the user’s preference.
      Of course there are many approaches to implement this. But however you do it, you will need two different toolkits: one for the translator and one for the programmer.
      The programmer will need something to define the translatable strings or, preferably, extract them from the source code.
      The translator will need something to edit the translation.
      The programmer will need something to incorporate the translation in to the program.
      And all of this should be repeatable with little effort when a few strings in the program change – don’t make the translator retranslate everything if you just add two strings for a new little feature of your program.
      To avoid reinventing the wheel, I decided to go the route many large open source projects go: gettext.
      So I've built a small toolkit utilizing the style and some tools of GNU gettext to create AutoIt applications that can be translated into any language by just adding a corresponding [language].po file.
      I've explained the reasoning and overview in https://martinstutenglish.wordpress.com/2016/06/10/internationalizing-autoit-applications-by-something-similar-to-gnu-gettext/
      Technical details and downloadable files, including a very small example application, are in https://github.com/martinstut/gettext_au3 (updated as I improve the toolkit), most of which is also contained in the attached ZIP file.
      Hopefully this helps you to internationalize your own applications.
      gettext_au3-20160617.zip
    • By goss34
      Hi Guys,

      I am writing a script that will check a set of folders to populate a list with available data.

      Here is how i create the liveview:


      $listview = GUICtrlCreateListView("", 10, 30, 330, 250) _GUICtrlListView_InsertColumn($listview, 0, "Client Name", 160) _GUICtrlListView_InsertColumn($listview, 1, "Available P11D Data", 160) If FileExists($Location & "2005-2006\P11DDATA.MDB") Then GUICtrlCreateListViewItem($Client & "|2005-2006", $listview) EndIf If FileExists($Location & "2006-2007\P11DDATA.MDB") Then GUICtrlCreateListViewItem($Client & "|2006-2007", $listview) EndIf
      Next here i want to select one of the list view items and when i click open it will run the relevant command.


      GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState() Do $msg = GUIGetMsg() If $msg = $open Then $iSelect = ControlListView($hGUI, "", $listview, "GetSelected") If $iSelect = "" Then MsgBox(0, "ERROR!", "No data selected, the program will now exit.") Exit EndIf If $iSelect = 0 Then Run('"C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE" /runtime /wrkgrp "' & $Location & '2005-2006\P11D.mdw" "' & $Location & '2005-2006\P11DSys.mdb"') EndIf If $iSelect = 1 Then MsgBox(0, "Pretend Run", "2006-2007") EndIf

      The problem i am having is with this line:

      $iSelect = ControlListView($hGUI, "", $listview, "GetSelected")
      Depending on which item is seleted it flags it using a 0, 1, 2 onwards where as i want it to get the text from the list view because if all the data doesnt exists the numbers are not in the correct order so it will run the wrong command.

      I have tried GetText but either i dont understand the syntax so am doing it wrong or it just doesnt work (most likely the first :-()

      Can anyone help?

      Thank you

      P.S. If anyone can identify why this line doesnt work properly that would be appreciated:

      If $iSelect = "" Then
      MsgBox(0, "ERROR!", "No data selected, the program will now exit.")
      Exit
      EndIf
      If i dont have the "Exit" command it automatically launches the next command down which it shouldnt as that isnt selected!
×
×
  • Create New...