gseller Posted April 28, 2009 Share Posted April 28, 2009 Hi all,I am working on showing an icon in a listview according to what is read from an ini file. I am stuck with displaying the name of the key value and then actually applying the key value. Can someone take a look and tell me what I am doing wrong? Thank you in advance. Here is a zip with the files I can put just the code too if needed. I thought having the whole enchilada would be better. Link to comment Share on other sites More sharing options...
WideBoyDixon Posted April 28, 2009 Share Posted April 28, 2009 You might need to explain a little better what you're trying to achieve. I'm not sure I understand your original post. WBD [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
KaFu Posted April 28, 2009 Share Posted April 28, 2009 Something more like this? expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- #include <GUIConstantsEx.au3> #Include <GuiListView.au3> #include <TabConstants.au3> ;dimmed items ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dim $somethingCurIndex Dim $DMSPicture = @ScriptDir & "\dms1_icon.ico" ;end dimmed items ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;global constants ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Global Const $WM_NOTIFY = 0x004E Global Const $SS_NOTIFY = 0x0100 Global Const $WS_GROUP = 0x00020000 Global Const $SS_LEFT = 0x0000 Global Const $BS_DEFPUSHBUTTON = 0x0001 Global Const $ES_MULTILINE = 0x0004 Global Const $ES_AUTOVSCROLL = 0x0040 Global Const $WS_VSCROLL = 0x00200000 ;end global constants ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;globals ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Global $something_DoubleClicked = False ;end globals ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Opt("GUIOnEventMode", 1) ;gui necessities~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $FontSize = 16 $fsize = 14 $fcolor = 0xFFFFFF $lbgcolor = 0x65A89D $GUI_BG = 0x7CCFC1 $somethingfsize = 14 $GUI_W = "785" $GUI_H = "470" $laHors = "8" $laVert = "140" $laHorsBut = "125" $laVertBut = "30" $laButSize = "125, 25" GUISetBkColor ($GUI_BG) GUIRegisterMsg($WM_NOTIFY, "MY_WM_NOTIFY") $hGui = GUICreate("", $GUI_W, $GUI_H, (@DesktopWidth-$GUI_W)/10, (@DesktopHeight-$GUI_H)/10,-1) $Tab1 = GUICtrlCreateTab(16, 40, 689, 350) GUISetOnEvent($GUI_EVENT_CLOSE, "_close_gui") ;end gui necessities ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;begin ini read ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Global $iniFile = @ScriptDir & "\info.ini" ;end ini read ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;tab ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $TabSheet1 = GUICtrlCreateTabItem("something") $ListView_something = GUICtrlCreateListView ("Sessions",30, 85, 660, 268) GUICtrlSetStyle($ListView_something, BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $WS_VSCROLL)) GUICtrlSetOnEvent($ListView_something, "something_launch") $something_button = GUICtrlCreateButton("LAUNCH", 224, 357, 89, 25, 0) GUICtrlSetOnEvent(-1, "something_launch") GUICtrlCreateGroup("something", $laHors * 3, $laVert / 2, 672, 315) GUICtrlCreateLabel("Choose Your Session To Launch", 10, 10, 625, 20, $SS_Left) $avSwitches2 = IniReadSection($IniFile, "section") If @error Or $avSwitches2[0][0] = 0 Then MsgBox(16, "Error", "Error reading ini file, or no data.") Else $h = 0 $v = 0 For $n = 1 To $avSwitches2[0][0] GUICtrlCreateListViewItem($avSwitches2[$n][0] , $ListView_something) GUICtrlSetImage(-1, $DMSPicture, 0) $h = $h + 1 if $h > 4 Then $h = 0 $v = $v + 1 EndIf Next EndIf ; end tab ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GUISetState() While 1 Sleep(100) If $something_DoubleClicked Then something_launch() $something_DoubleClicked = False EndIf WEnd Func something_launch() $somethingCurIndex = _GUICtrlListView_GetSelectedIndices($ListView_something,true) If $somethingCurIndex[0] = 0 Then MsgBox(0, "Error", "You must select a session from the list" ) Return EndIf SplashTextOn( "Please Stand by", "Launching: " & @CRLF & IniRead($iniFile,"section","item" & ($somethingCurIndex[1] + 1),""),300, 75, -1, -1,17) ShellExecute("file.exe", " " & IniRead($iniFile,"section","item" & ($somethingCurIndex[1] - 1),""), @ProgramFilesDir & "\path\to\file","") Sleep(1000) SplashOff() EndFunc Func MY_WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam) Local $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return $GUI_RUNDEFMSG Local $Code = DllStructGetData($tagNMHDR, 3) If $wParam = $ListView_something And $Code = -3 Then $something_DoubleClicked = True Return $GUI_RUNDEFMSG EndFunc Func _close_gui() Exit EndFunc ;==>Close Up Shop OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
gseller Posted April 29, 2009 Author Share Posted April 29, 2009 (edited) KaFu... That totally works.. Thank you so much! I have been pulling my hair out and could not get that to work.. Thank You! edit: Well, it works as long as the key name is named item? Thanks for trying... Edited April 29, 2009 by gseller Link to comment Share on other sites More sharing options...
KaFu Posted April 29, 2009 Share Posted April 29, 2009 LOL, that's the way it's hardcoded based on your example. To make it dynamic replace SplashTextOn( "Please Stand by", "Launching: " & @CRLF & IniRead($iniFile,"section","item" & ($somethingCurIndex[1] + 1),""),300, 75, -1, -1,17) ShellExecute("file.exe", " " & IniRead($iniFile,"section","item" & ($somethingCurIndex[1] - 1),""), @ProgramFilesDir & "\path\to\file","") with SplashTextOn( "Please Stand by", "Launching: " & @CRLF & IniRead($iniFile,"section",_GUICtrlListView_GetItemText($ListView_something, $somethingCurIndex[1]),""),300, 75, -1, -1,17) ShellExecute("file.exe", " " & IniRead($iniFile,"section",_GUICtrlListView_GetItemText($ListView_something, $somethingCurIndex[1]),""), @ProgramFilesDir & "\path\to\file","") OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
gseller Posted April 29, 2009 Author Share Posted April 29, 2009 LOL, that's the way it's hardcoded based on your example. To make it dynamic replace SplashTextOn( "Please Stand by", "Launching: " & @CRLF & IniRead($iniFile,"section","item" & ($somethingCurIndex[1] + 1),""),300, 75, -1, -1,17) ShellExecute("file.exe", " " & IniRead($iniFile,"section","item" & ($somethingCurIndex[1] - 1),""), @ProgramFilesDir & "\path\to\file","") with SplashTextOn( "Please Stand by", "Launching: " & @CRLF & IniRead($iniFile,"section",_GUICtrlListView_GetItemText($ListView_something, $somethingCurIndex[1]),""),300, 75, -1, -1,17) ShellExecute("file.exe", " " & IniRead($iniFile,"section",_GUICtrlListView_GetItemText($ListView_something, $somethingCurIndex[1]),""), @ProgramFilesDir & "\path\to\file","")I agree! Thanks, my bad... I do get an idea from your example tho. I am hoping to make it work. Thanks again! Link to comment Share on other sites More sharing options...
KaFu Posted April 29, 2009 Share Posted April 29, 2009 I do get an idea from your example tho. I am hoping to make it work. Thanks again!Glad that I could help , you're welcome m8. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now