Sign in to follow this  
Followers 0
gseller

Need help converting an existing script to work with Autoit Build 3.2.10.0

13 posts in this topic

#1 ·  Posted (edited)

I have an existing script that searches an ini and allows results to be seen in listview. It worked fine up until this latest Autoit Build 3.2.10.0 . I made all of the changes in GuiListView.au3 but the the script will not search and the new _GUICtrlListView_DeleteAllItems I am not sure how to set the GuiCtrlDelete in it's place. Any help would be much apreciated. I have included a rar file with the example and an ini to search.

edit: typo

edit: removed email address ... Started seeing many more spam emails..

;===================================================
; Searchable Command Line Launcher by gseller © 29.8.2007
; Commands kept in an ini file can be searched and ran from the command line
; Partial code from: CyberZeroCool's "Master SMS Messanger" - Thank You CyberZeroCool!, May 17 2007
;Revised for New Autoit Build 3.2.10.0
;===================================================
#NoTrayIcon
#include <GUIConstants.au3>
#Include <GuiListView.au3>
;#include <GuiList.au3>

$IniFile = @ScriptDir & "\commands.ini"
$ini = IniReadSection($IniFile, "cmds")
If @error Or $ini[0][0] = 0 Then
    MsgBox(16, "Error", "Error reading ini file, or no data.")
Else
 EndIf
$Form1 = GUICreate("Searchable Switchboard Insert", 350, 185, 265, 96) ; creates overall gui
$searchinput = GUICtrlCreateInput("", 8, 9, 209, 21) ; input box for search
GUICtrlSetState  (-1,$GUI_FOCUS) ; gives focus to the input box for search
GUICtrlSetBkColor(-1,0xDCEBFF) ; Pale blue control background in input box for search
$searchbutton = GUICtrlCreateButton("Search", 224, 8, 89, 25, 0) ; duh - search button...
GUICtrlSetState(0,$GUI_FOCUS) ; feeblely trying to give focus to search button after typing in the input box... (need to further research this)
$clear=GUICtrlCreateButton ("Clear", 120, 160, 89, 25) ; clear search box and/or list box
$ListView1 = GUICtrlCreateListView("Key|Value", 8, 40, 335, 121) ; here is the list box that displays the search results
GUICtrlSetBkColor(-1,0xDCEBFF) ; Pale blue control background
_GUICtrlListView_SetColumnWidth ( $ListView1, 0, 400 ) ; individual sizing of each colum in the listbox
_GUICtrlListView_SetColumnWidth ( $ListView1, 1, 200 )
$launchButton = GUICtrlCreateButton("OPEN", 224, 160, 89, 25, 0) ; open selected item
$Label1 = GUICtrlCreateLabel("By: Gseller", 8, 165, 92, 17) ; label at bottom
GUISetState(@SW_SHOW)

While 1
 $hGui = GUIGetMsg()
 Switch $hGui
  Case $GUI_EVENT_CLOSE ; required to exit gui
   Exit
  case $clear ; clear button command, when clicked performs 3 functions
  GUICtrlSetData($searchinput,"") ; 1.)clears the input box for search
   search(GUICtrlRead($searchinput)) ; 2.) sends a search command so we clear the listbox.
  GUICtrlSetState  ($searchinput,$GUI_FOCUS) ; 3.) returns focus on the input box for next search
;  Case $hGui = $clear
  Case $searchbutton ; search button to initiate search of ini file
   search(GUICtrlRead($searchinput)) ; polls ini file
  Case $launchButton ; send button at bottom, this sends the command to open the resulted command line with arguments to launch session
   launch() ; calls the launch function below
  GUICtrlSetState  ($searchinput,$GUI_FOCUS) ; returns focus on the input box for next search
 EndSwitch
WEnd

Func search($text) ; search function callout
 _GUICtrlListView_DeleteAllItems ( $ListView1 );supposed to clear the listview window before new search but errors with use GUICtrlDelete
 If Not @error And IsArray($ini) Then ; 
  For $a = 1 To $ini[0][0]
   If StringInStr( $ini[$a][0], $text ) Then
    _GUICtrlListView_InsertItem( $ListView1, -1, $ini[$a][0] & "|" & $ini[$a][1] ) ; searches the array and adds results to a string
   EndIf
  Next
 EndIf
EndFunc

Func launch() ; launch function callout
 If _GUICtrlListView_GetSelectedIndices ( $ListView1, 0 ) = -1 Then 
  MsgBox(0, "Error", "You must select a carrier from the list" ) ; alert if no item is selected in the listbox after search function
  Return
 EndIf
 ShellExecute(_GUICtrlListView_GetItemTextString($ListView1, _GUICtrlListView_GetSelectedIndices($ListView1, 0), 1 )) ; launches the item selected.
 SplashTextOn( "Please Stand by", "Launching: " & @CRLF & _GUICtrlListView_GetItemTextString($ListView1, _GUICtrlListView_GetSelectedIndices($ListView1, 0), 0 ), 300, 75 ) ; displays a nice little splash window displaying the name of the item selected and says launching this item.
 Sleep(2000) ; holds splash open 2 seconds
 SplashOff() ; turns splash off when 2 sec time is up.
EndFunc
Edited by gesller

Share this post


Link to post
Share on other sites



_guictrllistviewdeleteall( $hWnd )

that should fix it up...

I don't use the beta, or the new one, I'm using 3.2.8.1 and I'm not going to upgarde...


[center][/center]

Share this post


Link to post
Share on other sites

_guictrllistviewdeleteall( $hWnd )

that should fix it up...

I don't use the beta, or the new one, I'm using 3.2.8.1 and I'm not going to upgarde...

if you do not upgrade you media player will become out dated... and will be worth nothing....

Share this post


Link to post
Share on other sites

Shut up ashley. It's the content not the version that makes the difference.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

yeah ashley what you said was so incredibly stupid...

Lets either answer the question or not post junk on here though...

Edited by DBak

[center][/center]

Share this post


Link to post
Share on other sites

if you do not upgrade you media player will become out dated... and will be worth nothing....

Totally ridiculous statement!!!!!

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@gessler

Any help on this page?

http://dundats.mvps.org/AutoIt/AutoIt3_Web...on_renaming.htm

Edit: This thread probably should be moved to General Help and Support since that's what it is.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

@gessler

Any help on this page?

http://dundats.mvps.org/AutoIt/AutoIt3_Web...on_renaming.htm

Edit: This thread probably should be moved to General Help and Support since that's what it is.

GEOSoft is cool to have, I have made these changes and my script doesn't work. Not sure what I am not seeing.

http://dundats.mvps.org/AutoIt/AutoIt3_Web...on_renaming.htm

as for the forum, yep, does belong in general help. I promise that is where I thought I opened it in.. LOL MODZ.. Please move over to general help.. I just need help, not an example anymore till it gets fixed.. :)

Share this post


Link to post
Share on other sites

someone should make a script that uses string replace for the renamed functions and writes out a log of all other lines needing changes...

That would be neat!

Plus then i would use 3.2.10.0


[center][/center]

Share this post


Link to post
Share on other sites

someone should make a script that uses string replace for the renamed functions and writes out a log of all other lines needing changes...

That would be neat!

Plus then i would use 3.2.10.0

3.2.10.0 is great, while renaming the UDF you can learn something new. I mean it's about adaptability.

@gesller: Try this?

_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($Listview1))

Share this post


Link to post
Share on other sites

3.2.10.0 is great, while renaming the UDF you can learn something new. I mean it's about adaptability.

@gesller: Try this?

_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($Listview1))

Generator that seems to work for the recovering the listview for retry. Thank you so much! Now if I can just get this to perform the search of the ini file...

Share this post


Link to post
Share on other sites

While you're at it you might want to fix

$Label1 = GUICtrlCreateLabel("By: Gseller", 8, 165, 92, 17) ; label at bottom

It would appear that you spelled your name wrong. :)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

While you're at it you might want to fix

It would appear that you spelled your name wrong. :)

Hahaha... That is actually the name I use.. When I signed up in this forum I made a mistake and could not change it. LOL I tried msg'ing mods to change it but never got a responce. So I just kept gesller. Good observation tho.. ^_^

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