Jump to content

i need some help for inputbox functions


retaly
 Share

Recommended Posts

hy guys,

whatever i need help, i find it here :))

now i've some problem with inputbox, i dont know how can i "configure" it.

so if someone have a bit free time please how should to do these functions in my test script below here:

1.

-when you add multiple files to inputbox,, it' going to next to each other, for example, like this: D:01.jpg02.jpg

and it would be nice if the multiple files going to below each other, like this:

D:01.jpg

D:02.jpg

2.

-now you added one or more files to inputbox, when click to "Let's do it" button, you should to get 2 msg box with these messages, first:D:01.jpg and another msgbox D:02.jpg

-my "dream" now, i'd like the script give as much msgbox as line is exist (with files from lines)

i hope u can understand what i want do to, if not please ask me again about it, unfortunately my english is a bit low..

and i cant explaining things in some situation., thanks for understanding.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


Opt("GUIOnEventMode", 1)

#Region ### START Koda GUI section ###
$test = GUICreate("test script", 633, 350, 281, 129)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $test)


$addfile = GUICtrlCreateButton("Add File", 408, 300, 75, 25)
GUICtrlSetOnEvent(-1, "_addfile")
$showmsg = GUICtrlCreateButton("Let's do it", 504, 300, 75, 25)
GUICtrlSetOnEvent(-1, "_message")
GUICtrlSetState($showmsg, $GUI_DISABLE)
$List = GUICtrlCreateList("", 39, 20, 561, 253)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
;Switch $nMsg
;Case $GUI_EVENT_CLOSE
;Exit
;Case $addfile
;_addfile()

;EndSwitch
WEnd

Func _Exit()
Exit
EndFunc




Func _message()
MsgBox(0, "msg", GUICtrlRead($List))
EndFunc



Func _addfile()
Local $message = "Hold down Ctrl or Shift to choose multiple files."

Local $var = FileOpenDialog($message, @WindowsDir & "", "(*.jpg)", 1 + 4) ; how should to replace the *.jpg for open every filetype? :(


If @error Then
;MsgBox(4096, "", "No File(s) chosen")
Else
$var = StringReplace($var, "|", @CRLF)
GUICtrlSetData($List, $var)
GUICtrlSetState($showmsg, $GUI_ENABLE)

EndIf
EndFunc
Edited by retaly
Link to comment
Share on other sites

try this:

Func _addfile()
Local $message = "Hold down Ctrl or Shift to choose multiple files."

Local $var = FileOpenDialog($message, @WindowsDir & "", "(*.jpg)", 1 + 4) ; how should to replace the *.jpg for open every filetype? :(


If @error Then
;MsgBox(4096, "", "No File(s) chosen")
Else

$var = StringSplit($var, "|")

for $i = 2 to ubound($var)-1
GUICtrlSetData($List, $var[1] & "" & $var[$i])
next
GUICtrlSetState($showmsg, $GUI_ENABLE)

EndIf
EndFunc

for show the msgboxs

this:

Func _message()
$files=_GUIList_GetAllItems($List)
for $i = 0 to UBound($files)-1
MsgBox(0, "msg", $files[$i])
next
EndFunc


Func _GUIList_GetAllItems($hWnd, $Array = True)
If StringRegExp($Array, "(?i)-?1|default|True") Then
$Array = True
Else
$Array = False
EndIf
If NOT IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
Local $sRtn = "", $iLen, $tHold, $aResult, $sSep = Opt("GUIDataSeparatorChar")
$aResult = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", 0x018B, "wparam", 0, "lparam", 0)
If @Error Then Return SetError(@Error, @Extended, "")
Local $iCount = $aResult[0]
For $i = 0 To $iCount - 1
$aResult = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", 0x018A, "wparam", 0, "lparam", 0)
If @Error Then Return SetError(@Error, @Extended, "")
$iLen = $aResult[0] + 1
$tHold = DllStructCreate("wchar Text[" & $iLen & "]")
DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hWnd, "uint", 0x0189, "wparam", $i, "lparam", DllStructGetPtr($tHold))
If @Error Then Return SetError(@Error, @Extended, "")
$sRtn &= DllStructGetData($tHold, "Text") & $sSep
Next
$sRtn = StringTrimRight($sRtn, StringLen($sSep))
If $Array Then Return StringSplit($sRtn, $sSep, 2)
Return $sRtn
EndFunc ;==>_GUIList_GetAllItems

Regards

Edited by Danyfirex
Link to comment
Share on other sites

Fixed.

Func _addfile()
Local $message = "Hold down Ctrl or Shift to choose multiple files."

Local $var = FileOpenDialog($message, @WindowsDir & "", "(*.jpg)", 1 + 4) ; how should to replace the *.jpg for open every filetype? :(


If @error Then
;MsgBox(4096, "", "No File(s) chosen")
Else
$var = StringSplit($var, "|")
if ubound($var)=2 Then
GUICtrlSetData($List, $var[1])
else
for $i = 2 to ubound($var)-1
GUICtrlSetData($List, $var[1] & "" & $var[$i])
next
GUICtrlSetState($showmsg, $GUI_ENABLE)
EndIf
EndIf
EndFunc

regards

Link to comment
Share on other sites

ty ty ty, wanted this!! :D

hm, i found an interesting "bug" or i dont know..

when i've added one file with numbers and letters in name then i got error, like this:

D:11dec_1920_1080.jpg

when trying to get msg , its only freezing then closing itself.

do u have any idea to fix it?

Edited by retaly
Link to comment
Share on other sites

I don't understand what you want to mean ?

you wanted to say that the control keep disable:? so

try this I think fixed:

Func _addfile()
Local $message = "Hold down Ctrl or Shift to choose multiple files."

Local $var = FileOpenDialog($message, @WindowsDir & "", "(*.jpg)", 1 + 4) ; how should to replace the *.jpg for open every filetype? :(


If @error Then
;MsgBox(4096, "", "No File(s) chosen")
Else
$var = StringSplit($var, "|")
if ubound($var)=2 Then
GUICtrlSetData($List, $var[1])
else
for $i = 2 to ubound($var)-1
GUICtrlSetData($List, $var[1] & "" & $var[$i])
next

EndIf
EndIf
GUICtrlSetState($showmsg, $GUI_ENABLE)
EndFunc
Edited by Danyfirex
Link to comment
Share on other sites

k,

i've a last thing what i'd like to do, but i've never been used this type of autoit script, just saw once in one program, but couldnt find source for it.

i want to do same thing as first script, just add files to listview, when add a file it make a new line with file, when delet the file it delet the lines too

do u know the source for it? :S

#include <GuiMenu.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>Global Enum $idOpen = 1000, $idSave, $idInfo
Opt("GUIOnEventMode", 1)

Global $GUI, $listview, $hMenu



$GUI = GUICreate("Menu", 633, 513, 281, 129)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $GUI)

$addfile = GUICtrlCreateButton("Add File", 408, 472, 75, 25)
GUICtrlSetOnEvent(-1, "_addfile")

$List = GUICtrlCreateListView("File |test2|test3|Status", 39, 192, 561, 253)
GUICtrlCreateListViewItem("|||", $List)


$hMenu = _GUICtrlMenu_CreatePopup()
_GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idOpen)
_GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idSave)
_GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0)
_GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $idInfo)


; Register message handlers
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

GUISetState()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func _addfile()
Local $message = "Hold down Ctrl or Shift to choose multiple files."

Local $var = FileOpenDialog($message, @WindowsDir & "", "(*.jpg)", 1 + 4)


If @error Then
;MsgBox(4096, "", "No File(s) chosen")
Else
$var = StringSplit($var, "|")
if ubound($var)=2 Then
GUICtrlSetData($List, $var[1])
else
for $i = 2 to ubound($var)-1
GUICtrlSetData($List, $var[1] & "" & $var[$i])
next
GUICtrlSetState($upload, $GUI_ENABLE)
EndIf
EndIf
EndFunc

Func _Exit()
Exit
EndFunc


Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $iIDFrom, $iCode, $tNMHDR, $tInfo

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")

Switch $iIDFrom
Case $listview
Switch $iCode
Case $NM_CLICK, $NM_RCLICK
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)

If DllStructGetData($tInfo, "Item") > -1 Then
_GUICtrlMenu_TrackPopupMenu($hMenu, $GUI)
EndIf
EndSwitch
EndSwitch

Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Switch $iwParam
Case $idOpen
_WinAPI_ShowMsg("Open")
Case $idSave
_WinAPI_ShowMsg("Save")
Case $idInfo
_WinAPI_ShowMsg("Info")
EndSwitch
EndFunc ;==>WM_COMMAND
Link to comment
Share on other sites

Glad for helping you :)

for next try reading Autoit Help file. it's Amazing.

Regards.

Link to comment
Share on other sites

hy, i know, i should to read it, but i dont know what's need for my things, what's command etc.. so i cant search for it :S

i'd like to ask once more thing, and the last help from you.

i'd like to do same options in this listview as my first script here.

-add simple item, and multiple items in it.

-msgbox for every lines in listview when press upload button.

-and one new thing, Change "waiting" to "done" below status after msgboxes are closed

i know.. i still should to learn a lot of things about autiot, im trying.

#include <GuiMenu.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

Global Enum $idOpen = 1000, $idSave, $idInfo
Opt("GUIOnEventMode", 1)

Global $GUI, $listview, $hMenu
Local $status = "Waiting"

$GUI = GUICreate("Menu", 633, 513, 281, 129)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $GUI)


$addfile = GUICtrlCreateButton("Add File", 408, 422, 75, 25)
GUICtrlSetOnEvent(-1, "_addfile")
$addfile = GUICtrlCreateButton("Upload", 498, 422, 75, 25)
GUICtrlSetOnEvent(-1, "_msg")
$hListView = GUICtrlCreateListView("File|Size|Upload Status", 10, 150, 621, 250)
GUICtrlSetOnEvent(-1, "_hlistview")
;_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_FULLROWSELECT)

$Menue_Main = GUICtrlCreateMenu("main")
$Menue_Main_1 = GUICtrlCreateMenuItem("Add", $Menue_Main)
GUICtrlSetOnEvent(-1, "_addfile")
$Menue_Main_2 = GUICtrlCreateMenuItem("Delete All", $Menue_Main)
GUICtrlSetOnEvent(-1, "_delet_all_item")

$Menue_ListView = GUICtrlCreateContextMenu($hListView)
$Menue_ListView_1 = GUICtrlCreateMenuItem("Delete", $Menue_ListView)
GUICtrlSetOnEvent(-1, "_delet_selected_item")

_GUICtrlListView_SetColumnWidth($hListView, 0, 200)
_GUICtrlListView_SetColumnWidth($hListView, 1, 200)
_GUICtrlListView_SetColumnWidth($hListView, 2, 200)

_GUICtrlListView_RegisterSortCallBack($hListView)

GUISetState(@SW_SHOW)




While 1
$nMsg = GUIGetMsg()
;Switch $nMsg
;Case $GUI_EVENT_CLOSE
; Exit
;Case $Menue_Main_1 ;=>> Add ...
; $file = InputBox("", "Pls enter a file")
; $username = InputBox("", "Pls enter a username")
; $password = InputBox("", "Pls enter a password")
; GUICtrlCreateListViewItem($file & '|' & $username & '|' & $password, $hListView)

; Case $hListView ;=>> Für ListView sortieren !
; _GUICtrlListView_SortItems($hListView, GUICtrlGetState($hListView))
;EndSwitch
WEnd



Func _msg()
MsgBox(0, "msg", "...")
EndFunc

Func _hlistview()
_GUICtrlListView_SortItems($hListView, GUICtrlGetState($hListView))
EndFunc


Func _delet_all_item()
_GUICtrlListView_DeleteAllItems($hListView)
EndFunc

Func _delet_selected_item()
_GUICtrlListView_DeleteItemsSelected($hListView)
EndFunc

;=>> Function <<=
Func _ArraySow($array)
For $i = 1 To UBound($array) - 1 Step +1
MsgBox(0, "", $i & ":" & @CRLF & $array[$i])
Next
EndFunc ;==>_ArraySow


Func _addfile()
Local $message = "Hold down Ctrl or Shift to choose multiple files."

Local $var = FileOpenDialog($message, @WindowsDir & "", "(*.jpg)", 1 + 4)


If @error Then
;MsgBox(4096, "", "No File(s) chosen")
Else
$var = StringSplit($var, "|")
if ubound($var)=2 Then
$file = $var[1]
GUICtrlSetData($file, $var[1])
GUICtrlCreateListViewItem($file & '|' & '' & '|' & $status, $hListView)
else
for $i = 2 to ubound($var)-1
GUICtrlSetData($file, $var[1] & "" & $var[$i])
next
GUICtrlSetState($upload, $GUI_ENABLE)
EndIf
EndIf
EndFunc




Func _Exit()
Exit
EndFunc
Link to comment
Share on other sites

Well I got free time and try to do that I could understand you.

here code for load items to listview, for show every items in msgbox, and a label to show the state.

#include
#include
#include
#include
#include

Global Enum $idOpen = 1000, $idSave, $idInfo
Opt("GUIOnEventMode", 1)

Global $GUI, $listview, $hMenu
Local $status = "Waiting"

$GUI = GUICreate("Menu", 633, 513, 281, 129)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $GUI)


$addfile = GUICtrlCreateButton("Add File", 408, 422, 75, 25)
GUICtrlSetOnEvent(-1, "_addfile")
$addfile = GUICtrlCreateButton("Upload", 498, 422, 75, 25)
GUICtrlSetOnEvent(-1, "_msg")
$state=GUICtrlCreateLabel("Waiting",20,470,50,20)
$hListView = GUICtrlCreateListView("File|Size|Upload Status", 10, 150, 621, 250)
GUICtrlSetOnEvent(-1, "_hlistview")
;_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_FULLROWSELECT)

$Menue_Main = GUICtrlCreateMenu("main")
$Menue_Main_1 = GUICtrlCreateMenuItem("Add", $Menue_Main)
GUICtrlSetOnEvent(-1, "_addfile")
$Menue_Main_2 = GUICtrlCreateMenuItem("Delete All", $Menue_Main)
GUICtrlSetOnEvent(-1, "_delet_all_item")

$Menue_ListView = GUICtrlCreateContextMenu($hListView)
$Menue_ListView_1 = GUICtrlCreateMenuItem("Delete", $Menue_ListView)
GUICtrlSetOnEvent(-1, "_delet_selected_item")
_GUICtrlListView_SetColumnWidth($hListView, 0, 200)
_GUICtrlListView_SetColumnWidth($hListView, 1, 200)
_GUICtrlListView_SetColumnWidth($hListView, 2, 200)

_GUICtrlListView_RegisterSortCallBack($hListView)

GUISetState(@SW_SHOW)




While 1
$nMsg = GUIGetMsg()
;Switch $nMsg
;Case $GUI_EVENT_CLOSE
; Exit
;Case $Menue_Main_1 ;=>> Add ...
; $file = InputBox("", "Pls enter a file")
; $username = InputBox("", "Pls enter a username")
; $password = InputBox("", "Pls enter a password")
; GUICtrlCreateListViewItem($file & '|' & $username & '|' & $password, $hListView)

; Case $hListView ;=>> Für ListView sortieren !
; _GUICtrlListView_SortItems($hListView, GUICtrlGetState($hListView))
;EndSwitch
WEnd



Func _msg()
;MsgBox(0, "msg", "...")
$count=_GUICtrlListView_GetItemCount($hListView)

for $i = 0 to $count-1
$item=_GUICtrlListView_GetItemText($hListView,$i)
msgbox(0,"",$item)
next
If $count > 0 Then
guictrlsetdata($state,"Done")
EndIf
EndFunc

Func _hlistview()
_GUICtrlListView_SortItems($hListView, GUICtrlGetState($hListView))
EndFunc


Func _delet_all_item()
_GUICtrlListView_DeleteAllItems($hListView)
EndFunc

Func _delet_selected_item()
_GUICtrlListView_DeleteItemsSelected($hListView)
EndFunc

;=>> Function <<=
Func _ArraySow($array)
For $i = 1 To UBound($array) - 1 Step +1
MsgBox(0, "", $i & ":" & @CRLF & $array[$i])
Next
EndFunc ;==>_ArraySow


Func _addfile()
Local $message = "Hold down Ctrl or Shift to choose multiple files."

Local $var = FileOpenDialog($message, @WindowsDir & "", "(*.jpg)", 1 + 4)


If @error Then
;MsgBox(4096, "", "No File(s) chosen")
Else
$var = StringSplit($var, "|")
if ubound($var)=2 Then
$file = $var[1]
;GUICtrlSetData($hListView, $var[1])
_GUICtrlListView_AddItem($hListView,$var[1])
;GUICtrlCreateListViewItem($file & '|' & '' & '|' & $status, $hListView)
else
for $i = 2 to ubound($var)-1
_GUICtrlListView_AddItem( $hListView,$var[1] & "" & $var[$i])
;GUICtrlSetData($file, $var[1] & "" & $var[$i])
next
;GUICtrlSetState($upload, $GUI_ENABLE)
EndIf
EndIf
EndFunc




Func _Exit()
Exit
EndFunc

saludos

Edited by Danyfirex
Link to comment
Share on other sites

ye thanks, i mean the "done" will set below the "upload status" in listview, in every lines after msgbox is on, "if msgbox was succes open, because its only one example for my script, it will be one ftp uploader, the "done" text will set in lines below the "upload status" if connection and uploading was successful.

Edited by retaly
Link to comment
Share on other sites

You need look into help file.

you need this.

Regards

Link to comment
Share on other sites

  • 1 month later...

What is the issue now? As I don't feel up to the challenge of going back through 15 posts to find out the issue may be different now. Also post what you have so far, if it's runnable then that will help with your issue.

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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Well if you're giving up then the polite thing to do is let this thread die out. Shame really.

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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Hay, i still trying on it,

please help me in this problem, if i use guictrlsetdata to hListView then i can use right click + delete from list option,

but if i use _GUICtrlListView_AddItem, because i want to add multiple files to list. in this situation i cant delete items from list..

can u fix it?

#include <GuiMenu.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

Global Enum $idOpen = 1000, $idSave, $idInfo
Opt("GUIOnEventMode", 1)

Global $GUI, $listview, $hMenu
Local $status = "Waiting"

$GUI = GUICreate("Menu", 790, 513, 281, 129)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $GUI)


$addfile = GUICtrlCreateButton("Add File", 408, 422, 75, 25)
GUICtrlSetOnEvent(-1, "_addfile")
$upload = GUICtrlCreateButton("Upload", 498, 422, 75, 25)
GUICtrlSetOnEvent(-1, "_msg")
$hListView = GUICtrlCreateListView("File|Creation Time|Size|Upload Status", 40, 150, 710, 250)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES))
GUICtrlSetBkColor(-1, 0xCCCCCC)
GUICtrlSetOnEvent(-1, "_hlistview")
;_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_FULLROWSELECT)

$Menue_Main = GUICtrlCreateMenu("main")
$Menue_Main_1 = GUICtrlCreateMenuItem("Add", $Menue_Main)
GUICtrlSetOnEvent(-1, "_addfile")
$Menue_Main_2 = GUICtrlCreateMenuItem("Delete All", $Menue_Main)
GUICtrlSetOnEvent(-1, "_delet_all_item")

$Menue_ListView = GUICtrlCreateContextMenu($hListView)
$Menue_ListView_1 = GUICtrlCreateMenuItem("Delete", $Menue_ListView)
GUICtrlSetOnEvent(-1, "_delet_selected_item")

_GUICtrlListView_SetColumnWidth($hListView, 0, 200)
_GUICtrlListView_SetColumnWidth($hListView, 1, 200)
_GUICtrlListView_SetColumnWidth($hListView, 2, 200)

_GUICtrlListView_RegisterSortCallBack($hListView)

GUISetState(@SW_SHOW)




While 1
$nMsg = GUIGetMsg()
;Switch $nMsg
;Case $GUI_EVENT_CLOSE
; Exit
;Case $Menue_Main_1 ;=>> Add ...
; $file = InputBox("", "Pls enter a file")
; $username = InputBox("", "Pls enter a username")
; $password = InputBox("", "Pls enter a password")
; GUICtrlCreateListViewItem($file & '|' & $username & '|' & $password, $hListView)

; Case $hListView ;=>> Für ListView sortieren !
; _GUICtrlListView_SortItems($hListView, GUICtrlGetState($hListView))
;EndSwitch
WEnd




Func _hlistview()
_GUICtrlListView_SortItems($hListView, GUICtrlGetState($hListView))
EndFunc


Func _delet_all_item()
_GUICtrlListView_DeleteAllItems($hListView)
EndFunc

Func _delet_selected_item()
_GUICtrlListView_DeleteItemsSelected($hListView)
EndFunc



Func _addfile()
Local $message = "Hold down Ctrl or Shift to choose multiple files."

Local $var = FileOpenDialog($message, @WindowsDir & "\", "(*.jpg)", 1 + 4)



If @error Then
;MsgBox(4096, "", "No File(s) chosen")
Else
Global $var = StringSplit($var, "|")
$var = StringSplit($var, "|")
if ubound($var)=2 Then
Global $file = $var[1]
GUICtrlSetData($file, $var[1])
$File_size = FileGetSize ($var[1])
$File_t = FileGetTime($var[1], 1) ; creation Time
$File_time = $File_t[0] & "/" & $File_t[1] & "/" & $File_t[2] & " " & $File_t[3] & ":" & $File_t[4] & ":" & $File_t[5] ; detailed
Global $item = GUICtrlCreateListViewItem( $file & "|" & $File_time & "|" & $File_size &" Kb" & "|" & $status, $hListView)


; Next
;GUICtrlCreateListViewItem($file & '|' & '' & '|' & $status, $hListView)
else
for $i = 2 to ubound($var)-1
_GUICtrlListView_AddItem( $hListView,$var[1] & "\" & $var[$i])

next
GUICtrlSetState($upload, $GUI_ENABLE)
EndIf
EndIf
EndFunc

;=>> Function <<=
Func _ArraySow($array)
For $i = 1 To UBound($array) - 1 Step +1
MsgBox(0, "", $i & ":" & @CRLF & $array[$i])
Next
EndFunc ;==>_ArraySow



Func _msg()
;MsgBox(0, "msg", "...")
$count=_GUICtrlListView_GetItemCount($hListView)

for $i = 0 to $count-1
$item=_GUICtrlListView_GetItemText($hListView,$i)
msgbox(0,"",$item)
next
If $count > 0 Then
guictrlsetdata($item,"||Done")
EndIf
EndFunc


Func _Exit()
Exit
EndFunc
example script: Edited by retaly
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...