Asper Posted July 1, 2009 Share Posted July 1, 2009 Hi to all I'm making a scripy using a Gui with listview element, needing to delete a listview element I included GUIListView.au3 but when I execute the script compiler return me this error CODEC:\Programmi\AutoIt3\Include\Security.au3(59,1) : ERROR: syntax error why? This is my code CODEFunc Configura() #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> #Region ### START Koda GUI section ### Form= $_1 = GUICreate("Configurazione", 403, 255, 192, 125) $Griglia = GUICtrlCreateListView("Ext.|Programma associato", 14, 22, 358, 136) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 300) $Griglia_0 = GUICtrlCreateListViewItem("|", $Griglia) $Griglia_1 = GUICtrlCreateListViewItem("A|One", $Griglia) $Griglia_2 = GUICtrlCreateListViewItem("B|Two", $Griglia) $Griglia_3 = GUICtrlCreateListViewItem("C|Three", $Griglia) $Esci = GUICtrlCreateButton("Chiudi", 256, 224, 65, 25, $WS_GROUP) $Label1 = GUICtrlCreateLabel("Applicativo", 104, 168, 67, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Exe = GUICtrlCreateInput("Exe", 96, 184, 281, 21) $Ext = GUICtrlCreateInput("Ext", 24, 184, 57, 21) $Aggiungi = GUICtrlCreateButton("Aggiungi", 24, 160, 20, 20, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, "C:\Documents and Settings\Utente\Documenti\Autoit\AutoIt Project\Associa\Risorse\PIU.BMP", -1) GUICtrlSetTip(-1, "Aggiunge l'estensione") $Elimina = GUICtrlCreateButton("Elimina", 376, 24, 20, 20, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, "C:\Documents and Settings\Utente\Documenti\Autoit\AutoIt Project\Associa\Risorse\DELETE.BMP", -1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _CaricaGriglia() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Esci Exit Case $Elimina $Temp = _GUICtrlListView_DeleteItemsSelected ($Griglia) Case $Aggiungi $Temp = GUICtrlCreateListViewItem(GUICtrlRead($Ext) & "|" & GUICtrlRead($EXE), $Griglia) EndSwitch WEnd EndFunc Func _CaricaGriglia() $TempGriglia = GUICtrlCreateListViewItem("A|One", $Griglia) $TempGriglia1 = GUICtrlCreateListViewItem("B|Two", $Griglia) $TempGriglia2 = GUICtrlCreateListViewItem("C|Three", $Griglia) EndFunc Please help many tnx in advance for any info Link to comment Share on other sites More sharing options...
Lars Posted July 1, 2009 Share Posted July 1, 2009 Works now, If you place your GUI in a function you should first declare globals, or make a GUI array global and use that for your GUI components CODE #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> #Region ### START Koda GUI section ### Form= $_1 = GUICreate("Configurazione", 403, 255, 192, 125) $Griglia = GUICtrlCreateListView("Ext.|Programma associato", 14, 22, 358, 136) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 300) $Griglia_0 = GUICtrlCreateListViewItem("|", $Griglia) $Griglia_1 = GUICtrlCreateListViewItem("A|One", $Griglia) $Griglia_2 = GUICtrlCreateListViewItem("B|Two", $Griglia) $Griglia_3 = GUICtrlCreateListViewItem("C|Three", $Griglia) $Esci = GUICtrlCreateButton("Chiudi", 256, 224, 65, 25, $WS_GROUP) $Label1 = GUICtrlCreateLabel("Applicativo", 104, 168, 67, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Exe = GUICtrlCreateInput("Exe", 96, 184, 281, 21) $Ext = GUICtrlCreateInput("Ext", 24, 184, 57, 21) $Aggiungi = GUICtrlCreateButton("Aggiungi", 24, 160, 20, 20, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, "C:\Documents and Settings\Utente\Documenti\Autoit\AutoIt Project\Associa\Risorse\PIU.BMP", -1) GUICtrlSetTip(-1, "Aggiunge l'estensione") $Elimina = GUICtrlCreateButton("Elimina", 376, 24, 20, 20, BitOR($BS_BITMAP,$WS_GROUP)) GUICtrlSetImage(-1, "C:\Documents and Settings\Utente\Documenti\Autoit\AutoIt Project\Associa\Risorse\DELETE.BMP", -1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Func _CaricaGriglia() $TempGriglia = GUICtrlCreateListViewItem("A|One", $Griglia) $TempGriglia1 = GUICtrlCreateListViewItem("B|Two", $Griglia) $TempGriglia2 = GUICtrlCreateListViewItem("C|Three", $Griglia) EndFunc Func _main() _CaricaGriglia() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Esci Exit Case $Elimina $Temp = _GUICtrlListView_DeleteItemsSelected ($Griglia) Case $Aggiungi $Temp = GUICtrlCreateListViewItem(GUICtrlRead($Ext) & "|" & GUICtrlRead($EXE), $Griglia) EndSwitch WEnd EndFunc _main() 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