Rawox Posted June 18, 2009 Share Posted June 18, 2009 Hi again! I made a script and 2 friends of me helped with the coding but it doesn't works 100%. Just try to create a new tab and look at what is wrong expandcollapse popup#include <Array.au3> #include <ButtonConstants.au3> #Include <Constants.au3> #include <EditConstants.au3> #Include <File.au3> #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <GuiImageList.au3> #Include <GuiListView.au3> #include <GuiTab.au3> #include <ListviewConstants.au3> #include <IE.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> Global $Tabs[1] = [ "Demo Tab" ] $IniDirectory = @MyDocumentsDir & "\Rawox.ini" $Title = "XECuter v3" $i = 1 Opt ( "GUIResizeMode", 802 ) ;'///////////////////////////////////// INI /////////////////////////////////////'; If NOT FileExists ( $IniDirectory ) Then IniWrite ( $IniDirectory, "XECuter", "Popup on exit", "1" ) IniWrite ( $IniDirectory, "XECuter", "Save configuration", "1" ) IniWrite ( $IniDirectory, "XECuter", "Start with Windows", "4" ) IniWrite ( $IniDirectory, "XECuter", "Autominimze", "4" ) EndIf ;'////////////////////////////////// TRAY MENU //////////////////////////////////'; #Region GUI Opt ( "TrayMenuMode", 1 ) $Simple = TrayCreateItem ( "Simple View" ) $Adva = TrayCreateItem ( "Advanced View" ) TrayCreateItem ( "" ) $About = TrayCreateItem ( "About" ) $Devart = TrayCreateItem ( "DeviantArt" ) TrayCreateItem ( "" ) $TExit = TrayCreateItem ( "Exit" ) TrayItemSetState ( $Simple, $TRAY_DEFAULT ) TraySetClick ( 8 ) TraySetToolTip ( $Title ) ;'///////////////////////////////////// GUI /////////////////////////////////////'; $GUI = GUICreate ( $Title, 278, 276 ) $Tab = GUICtrlCreateTab ( 3, 3, 274, 245 ) GUICtrlCreateTabItem ( "Tabs" ) GUICtrlCreateGroup ( "Information", 14, 35, 250, 42 ) $CountTabs = _GUICtrlTab_GetItemCount ( $Tab ) $NUsedTabs = GUICtrlCreateLabel ( "You are currently using " & $CountTabs-1 & " out of 4 available tabs.", 24, 53 ) GUICtrlCreateGroup ( "Default Tab", 14, 82, 250, 50 ) $NDefault = GUICtrlCreateCombo ( "", 24, 100, 150, 20 ) $NSetDefault = GUICtrlCreateButton ( "Set tab", 174, 99, 80, 23 ) GUICtrlCreateGroup ( "Add Tab", 14, 137, 120, 100 ) GUICtrlCreateLabel ( "Name:", 24, 158 ) $NTabNameA = GUICtrlCreateInput ( "", 24, 175, 100, 20 ) $NCreate = GUICtrlCreateButton ( "Create", 24, 199, 100, 25 ) GUICtrlCreateGroup ( "Delete Tab", 142, 137, 120, 100 ) GUICtrlCreateLabel ( "Select:", 152, 158 ) $NTabNameD = GUICtrlCreateCombo ( "", 152, 175, 100, 20 ) $NDelete = GUICtrlCreateButton ( "Delete", 152, 199, 100, 25 ) ;'///////////////////////////////////// TAB //////////////////////////////////////'; GUICtrlCreateTabItem ( "Demo Tab" ) $Input = GUICtrlCreateInput ( "", 10, 35, 165, 20 ) $Select = GUICtrlCreateButton ( "Browse", 214, 34, 55, 22 ) $Load = GUICtrlCreateButton ( "Load", 175, 34, 40, 22 ) $Listexe = GUICtrlCreateListView ( "Files|Directory", 10, 65, 260, 150 ) $DeleteExe = GUICtrlCreateButton ( "Delete from list", 10, 219, 130, 22 ) $RunExe = GUICtrlCreateButton ( "Run selected", 140, 219, 130, 22 ) GUICtrlCreateTabItem ( "" ) ;'/////////////////////////////////// OPTIONS ////////////////////////////////////'; $Exit = GUICtrlCreateButton ( "Exit", 185, 250, 90, 22 ) $Minimize = GUICtrlCreateButton ( "Minimze", 94, 250, 90, 22 ) $More = GUICtrlCreateButton ( "Advanced", 3, 250, 90, 22 ) $Popup = GUICtrlCreateCheckBox ( "Disable pop-up on exit", 10, 277 ) $SaveConfig = GUICtrlCreateCheckBox ( "Save configuration", 10, 297 ) $Windows = GUICtrlCreateCheckBox ( "Start with Windows", 155, 277 ) $AMinimize = GUICtrlCreateCheckBox ( "Autominimze", 155, 297 ) $deviantART = GUICtrlCreateButton ( "DeviantArt", 3, 323, 90, 22 ) $AboutP = GUICtrlCreateButton ( "About", 94, 323, 90, 22 ) $Save = GUICtrlCreateButton ( "Save Options", 185, 323, 90, 22 ) ;'//////////////////////////////////// CHANGES /////////////////////////////////////'; GUICtrlSetData ( $NDefault, Arr2Str($Tabs) ) GUICtrlSetData ( $NTabNameD, Arr2Str($Tabs) ) GUICtrlSetColor ( $Input, 0x666666 ) $CountTabs = _GUICtrlTab_GetItemCount ( $Tab ) GUICtrlSetData ( $NUsedTabs, "You are currently using " & $CountTabs-1 & " out of 4 available tabs." ) _GUICtrlListView_SetColumn ( $Listexe, 0, "Files", 170 ) _GUICtrlListView_SetColumn ( $Listexe, 1, "Directory", 86 ) _GUICtrlListView_SetExtendedListViewStyle ( $Listexe, BitOR ( $LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES ) ) #EndRegion #Region Checks If IniRead ( $IniDirectory, "XECuter", "Popup on exit", "4" ) = 1 Then GUICtrlSetState ( $Popup, $GUI_CHECKED ) Else GUICtrlSetState ( $Popup, $GUI_UNCHECKED ) EndIf If IniRead ( $IniDirectory, "XECuter", "Save configuration", "4" ) = 1 Then GUICtrlSetState ( $SaveConfig, $GUI_CHECKED ) Else GUICtrlSetState ( $SaveConfig, $GUI_UNCHECKED ) EndIf If IniRead ( $IniDirectory, "XECuter", "Start with Windows", "4" ) = 1 Then GUICtrlSetState ( $Windows, $GUI_CHECKED ) Else GUICtrlSetState ( $Windows, $GUI_UNCHECKED ) EndIf If IniRead ( $IniDirectory, "XECuter", "Autominimze", "4" ) = 1 Then GUICtrlSetState ( $AMinimize, $GUI_CHECKED ) Else GUICtrlSetState ( $AMinimize, $GUI_UNCHECKED ) EndIf #EndRegion GUICtrlSetState ( $Listexe, $GUI_FOCUS ) GUISetState ( @SW_SHOW, $GUI ) Func _ArrayCount($arr) Local $Count, $i $Count = 0 For $i In $arr $Count += 1 Next Return $Count EndFunc Func Arr2Str ( $arr, $sep = "|" ) If IsArray ( $arr ) Then $out = "" $first = True For $i In $arr If $first = True Then $first = False Else $out &= $sep EndIf $out &= $i Next Return $out Else Return -1 EndIf EndFunc Func GetFilesRecursive ( $Type, $Dir, $First=true ) If $Dir = @HomeDrive & "\" Then $Driveletter = @HomeDrive $Driveletter = StringLeft ( $Driveletter, 1 ) $Confirm = MsgBox ( 52, "Are you sure?", "You have just selected your " & $Driveletter & "-drive, which contains Windows files. Loading in all these files will ask very much of your computer, and will make it very slow." & Chr(13) & Chr(13) & "Are you sure you want to continue?" ) If $Confirm = 7 Then Return False EndIf EndIf If $First = true Then $Size = WinGetClientSize ( $Title ) If $Size[1] = 276 Then $LoadingGui = GUICreate ( "Loading...", 80, 10, @DesktopWidth/2-60, @DesktopHeight/2-10, $DS_SETFOREGROUND ) GUICtrlCreateLabel ( "Loading...", 0, 10, 120, 20, $SS_CENTER ) GuiSetStyle ( $WS_POPUPWINDOW, $WS_EX_TOPMOST ) GUISetState ( @SW_SHOW, $LoadingGui ) Else $LoadingGui = GUICreate ( "Loading...", 80, 10, @DesktopWidth/2-60, @DesktopHeight/2-10-72, $DS_SETFOREGROUND ) GUICtrlCreateLabel ( "Loading...", 0, 10, 120, 20, $SS_CENTER ) GuiSetStyle ( $WS_POPUPWINDOW, $WS_EX_TOPMOST ) GUISetState ( @SW_SHOW, $LoadingGui ) EndIf EndIf $List = _FileListToArray ( $Dir, "*." & $Type, 1 ) If isArray ( $List ) Then $Count=$List[0] _ArrayDelete ( $List, 0 ) Global $Temp[1] For $i In $List Dim $Compose[2] = ['',''] $Compose[0]=StringReplace($Dir&'\', "\\", "\") $Compose[1]=$i _ArrayConcatenate($Temp, $Compose) Next _ArrayDelete ( $Temp, 0 ) $List=$Temp EndIf $Folders = _FileListToArray ( $Dir, '*', 2 ) If isArray ( $Folders ) Then If $Folders[0] > 0 Then _ArrayDelete($Folders, 0) For $Folder In $Folders $Temp = GetFilesRecursive ( $Type, $dir & "\" & $Folder, False) If isArray ( $List ) Then _ArrayConcatenate ( $List, $Temp ) Else $List = $Temp EndIf Next EndIf EndIf If $First = true Then GUIDelete ( $LoadingGui ) EndIf Return $List EndFunc While 1 $msg = GUIGetMsg(1) $nmsg = TrayGetMsg() Select Case $msg[0] = $RunExe $i = 0 $CountItems = _GUICtrlListView_GetItemCount ( $Listexe ) Do If _GUICtrlListView_GetItemState ( $Listexe, $i, $LVIS_SELECTED ) Then $Read2 = _GUICtrlListView_GetItemTextArray ( $Listexe, $i ) If GUICtrlRead ( $AMinimize ) = $GUI_CHECKED Then GUISetState ( @SW_HIDE, $GUI ) EndIf ShellExecute ( $Read2[2] & $Read2[1] ) EndIf $i += 1 Until $i = $CountItems $i = 0 Case $msg[0] = $DeleteExe $j = 0 $CountItems = _GUICtrlListView_GetItemCount ( $Listexe ) _ArrayDelete($CountItems, 0) Do If _GUICtrlListView_GetItemState ( $Listexe, $j, $LVIS_SELECTED ) Then _GUICtrlListView_DeleteItem ( $Listexe, $j ) EndIf $j += 1 Until $j = $CountItems $j = 0 Case $msg[0] = $Select $SelectFolder = FileSelectFolder ( "Choose a folder.", "" ) GUICtrlSetData ( $Input, $SelectFolder ) $Function = GetFilesRecursive("exe", GUICtrlRead ( $Input )) _GUICtrlListView_DeleteAllItems ( $Listexe ) If isArray($Function) Then For $j=0 To _ArrayCount($Function)/2 Step 2 GUICtrlCreateListViewItem ( $Function[$j+1] & "|" & $Function[$j], $Listexe ) Next EndIf Case $msg[0] = $NCreate $Read = GUICtrlRead ( $NTabNameA ) If $Read <> "" Then GUICtrlSetData ( $NDefault, "" ) GUICtrlSetData ( $NTabNameD, "" ) _GUICtrlTab_InsertItem ( $Tab, 1, $Read ) _ArrayAdd ( $Tabs, $Read ) _ArrayReverse($Tabs) GUICtrlSetData ( $NDefault, Arr2Str($Tabs) ) GUICtrlSetData ( $NTabNameD, Arr2Str($Tabs) ) $CountTabs = _GUICtrlTab_GetItemCount ( $Tab ) _GUICtrlTab_ClickTab ( $Tab, $CountTabs-1 ) $Input = GUICtrlCreateInput ( "", 10, 35, 165, 20 ) $Select = GUICtrlCreateButton ( "Browse", 214, 34, 55, 22 ) $Load = GUICtrlCreateButton ( "Load", 175, 34, 40, 22 ) $Listexe = GUICtrlCreateListView ( "Files|Directory", 10, 65, 260, 150 ) $DeleteExe = GUICtrlCreateButton ( "Delete from list", 10, 219, 130, 22 ) $RunExe = GUICtrlCreateButton ( "Run selected", 140, 219, 130, 22 ) _GUICtrlListView_SetColumn ( $Listexe, 0, "Files", 170 ) _GUICtrlListView_SetColumn ( $Listexe, 1, "Directory", 86 ) _GUICtrlListView_SetExtendedListViewStyle ( $Listexe, BitOR ( $LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES ) ) _GUICtrlTab_ClickTab ( $Tab, 0 ) GUICtrlSetData ( $NUsedTabs, "You are currently using " & $CountTabs-1 & " out of 4 available tabs." ) If $CountTabs = 5 Then GUICtrlSetState ( $NTabNameA, $GUI_DISABLE ) GUICtrlSetState ( $NCreate, $GUI_DISABLE ) GUICtrlSetData ( $NTabNameA, "Maximum reached" ) Else GUICtrlSetState ( $NTabNameA, $GUI_ENABLE ) GUICtrlSetState ( $NCreate, $GUI_ENABLE ) EndIf EndIf Case $msg[0] = $GUI_EVENT_CLOSE GUISetState ( @SW_HIDE, $GUI ) Case $msg[0] = $Exit ExitScript() Case $msg[0] = $More $Size = WinGetClientSize ( $Title ) If $Size[1] = 276 Then GUICtrlSetData ( $More, "Simplified" ) $Pos = WinGetPos ( $Title ) WinMove ( $Title, "", $Pos[0], $Pos[1]-50, $Pos[2], $Pos[3]+72 ) Else GUICtrlSetData ( $More, "Advanced" ) $Pos = WinGetPos ( $Title ) WinMove ( $Title, "", $Pos[0], $Pos[1]+50, $Pos[2], $Pos[3]-72 ) EndIf Case $msg[0] = $Minimize GUISetState ( @SW_HIDE, $GUI ) Case $msg[0] = $deviantART _IECreate ( "http://rawox.deviantart.com", 1, 1, 0, 1 ) Case $msg[0] = $Save If @OSVersion = "WIN_VISTA" Then If IsAdmin () Then $Read1 = GUICtrlRead ( $Popup ) $Read2 = GUICtrlRead ( $SaveConfig ) $Read3 = GUICtrlRead ( $Windows ) $Read4 = GUICtrlRead ( $AMinimize ) IniDelete ( $IniDirectory, "XECuter" ) IniWrite ( $IniDirectory, "XECuter", "Popup on exit", $Read1 ) IniWrite ( $IniDirectory, "XECuter", "Save configuration", $Read2 ) IniWrite ( $IniDirectory, "XECuter", "Start with Windows", $Read3 ) IniWrite ( $IniDirectory, "XECuter", "Autominimze", $Read4 ) If GUICtrlRead ( $Windows ) = $GUI_CHECKED Then RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "XECuter", "REG_SZ", @ScriptFullPath ) Else RegDelete ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "XECuter" ) EndIf Else MsgBox ( 64, "Admin Rights required", "To save your configuration on Windows Vista please restart " & $Title & " and run this application with full admin rights." ) EndIf Else $Read1 = GUICtrlRead ( $Popup ) $Read2 = GUICtrlRead ( $SaveConfig ) $Read3 = GUICtrlRead ( $Windows ) $Read4 = GUICtrlRead ( $AMinimize ) IniDelete ( $IniDirectory, "XECuter" ) IniWrite ( $IniDirectory, "XECuter", "Popup on exit", $Read1 ) IniWrite ( $IniDirectory, "XECuter", "Save configuration", $Read2 ) IniWrite ( $IniDirectory, "XECuter", "Start with Windows", $Read3 ) IniWrite ( $IniDirectory, "XECuter", "Autominimze", $Read4 ) If GUICtrlRead ( $Windows ) = $GUI_CHECKED Then RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "XECuter", "REG_SZ", @ScriptFullPath ) Else RegDelete ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "XECuter" ) EndIf EndIf Case $nmsg = $TRAY_EVENT_PRIMARYUP GUISetState ( @SW_SHOW, $GUI) Case $nmsg = $Simple $Size = WinGetClientSize ( $Title ) If $Size[1] = 276+72 Then GUICtrlSetData ( $More, "Advanced" ) $Pos = WinGetPos ( $Title ) WinMove ( $Title, "", $Pos[0], $Pos[1]+50, $Pos[2], $Pos[3]-72 ) EndIf GUISetState ( @SW_SHOW, $GUI ) Case $nmsg = $Adva $Size = WinGetClientSize ( $Title ) If $Size[1] = 276 Then GUICtrlSetData ( $More, "Simplified" ) $Pos = WinGetPos ( $Title ) WinMove ( $Title, "", $Pos[0], $Pos[1]-50, $Pos[2], $Pos[3]+72 ) EndIf GUISetState ( @SW_SHOW, $GUI ) Case $msg[0] = $AboutP About() Case $nmsg = $About About() Case $nmsg = $TExit ExitScript() Case $msg[0] = $load $Function = GetFilesRecursive("exe", GUICtrlRead ( $Input )) _GUICtrlListView_DeleteAllItems ( $Listexe ) If isArray($Function) Then For $j=0 To _ArrayCount($Function)/2 Step 2 GUICtrlCreateListViewItem ( $Function[$j+1] & "|" & $Function[$j], $Listexe ) Next EndIf Case $nmsg = $Devart _IECreate ( "http://rawox.deviantart.com", 1, 1, 0, 1 ) EndSelect WEnd Func About() MsgBox ( 64, "About " & $Title, $Title & " was made by Cas Cornelissen (Rawox)," & @CRLF & "Mathijs Henquet (Matiq) helped with the development." ) EndFunc Func ExitScript() If GUICtrlRead ( $Popup ) = $GUI_CHECKED Then Exit Else $Box = MsgBox ( 308, $Title, "Are you sure you want to exit " & $Title & "?" ) If $Box = 6 Then Exit EndIf EndIf EndFunc Link to comment Share on other sites More sharing options...
Zedna Posted June 18, 2009 Share Posted June 18, 2009 You can't mix Autoit's native Tab functions with UDFs ones--> _GUICtrlTab_InsertItem()Look here for details:http://www.autoitscript.com/forum/index.ph...st&p=531772 Resources UDF ResourcesEx UDF AutoIt Forum Search 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