Kein Problem. ![]()
Beiträge von Xenobiologist
-
-
Spoiler anzeigen
[autoit]#Region ;************ Includes ************
[/autoit] [autoit][/autoit] [autoit]
#Include <WindowsConstants.au3>
#Include <File.au3>
#Include <Debug.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#EndRegion ;************ Includes ************GUIRegisterMsg($WM_NOTIFY, 'WM_NOTIFY')
[/autoit] [autoit][/autoit] [autoit]$hGUI = GUICreate("Test", 500, 500)
[/autoit] [autoit][/autoit] [autoit]Global $hListView = GUICtrlCreateListView("Items", 10, 10, 480, 380)
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlListView_SetColumnWidth($hListView, 0, 450)Global $startfolder = @ScriptDir
[/autoit] [autoit][/autoit] [autoit]
Global $FileList = _FileListToArray($startfolder, '*.xls?', 1)
For $i = 1 To UBound($FileList) -1
GUICtrlCreateListViewItem($FileList[$i], $hListView)
Next$hButton = GUICtrlCreateButton("Search", 10, 460, 100, 30)
[/autoit] [autoit][/autoit] [autoit]
$input = GUICtrlCreateInput("", 200, 460, 100, 30)GUISetState()
[/autoit] [autoit][/autoit] [autoit]; Scroll down to hide top item
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_GUICtrlListView_Scroll($hListView, 0, 500)While 1
[/autoit] [autoit][/autoit] [autoit]
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $hButton
$iIndex = _GUICtrlListView_FindInText($hListView, GUICtrlRead($input))
_GUICtrlListView_ClickItem($hListView, $iIndex)
EndSwitch
WEndFunc WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
[/autoit] [autoit][/autoit] [autoit]
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTab
Local $cpMin, $cpMax, $tMsgFilter, $iTab
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, 'hWndFrom'))
$iIDFrom = DllStructGetData($tNMHDR, 'IDFrom')
$iCode = DllStructGetData($tNMHDR, 'Code')
Switch $hWndFrom
; Listivew
Case GUICtrlGetHandle($hListView)
;~ ConsoleWrite("Listview" & @CRLF)
Switch $iCode
Case $NM_DBLCLK
Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $iLparam)
_DebugPrint('$NM_DBLCLK' & @LF & '--> hWndFrom:' & @TAB & $hWndFrom & @LF & _
'-->IDFrom:' & @TAB & $iIDFrom & @LF & _
'-->Code:' & @TAB & $iCode & @LF & _
'-->Index:' & @TAB & DllStructGetData($tInfo, 'Index') & @LF & _
'-->SubItem:' & @TAB & DllStructGetData($tInfo, 'SubItem') & @LF & _
'-->NewState:' & @TAB & DllStructGetData($tInfo, 'NewState') & @LF & _
'-->OldState:' & @TAB & DllStructGetData($tInfo, 'OldState') & @LF & _
'-->Changed:' & @TAB & DllStructGetData($tInfo, 'Changed') & @LF & _
'-->ActionX:' & @TAB & DllStructGetData($tInfo, 'ActionX') & @LF & _
'-->ActionY:' & @TAB & DllStructGetData($tInfo, 'ActionY') & @LF & _
'-->lParam:' & @TAB & DllStructGetData($tInfo, 'lParam') & @LF & _
'-->KeyFlags:' & @TAB & DllStructGetData($tInfo, 'KeyFlags'))
$file = _GUICtrlListView_GetItemText($hListView, DllStructGetData($tInfo, 'Index'), 0)
ConsoleWrite($file & @LF)
ShellExecute(@ScriptDir & '\' & $file)
;~ $cpPassword = _GUICtrlListView_GetItemText($logins_LV, DllStructGetData($tInfo, 'Index'), 2)
EndSwitch
EndSwitch
EndFunc ;==>WM_NOTIFYFunc _DebugPrint($s_text, $line = @ScriptLineNumber)
[/autoit] [autoit][/autoit] [autoit][/autoit]
ConsoleWrite( _
'!===========================================================' & @LF & _
'+======================================================' & @LF & _
'-->Line(' & StringFormat('%04d', $line) & '):' & @TAB & $s_text & @LF & _
'+======================================================' & @LF)
EndFunc ;==>_DebugPrint -
Ja, das geht. Zeig mal dein Skript oder einen testbaren Ausschnitt.
-
Ja, in dem du die ID einfach weglässt.
-
Teste mal so
[autoit]#include <Excel.au3>
[/autoit][autoit][/autoit][autoit]
#include <File.au3>
#include <Array.au3>Global $startfolder = @ScriptDir
[/autoit][autoit][/autoit][autoit]
Global $FileList = _FileListToArray($startfolder, '*.xls?', 1)
If @error = 4 Then MsgBox(0, "", "No Folders Found.")For $i = 1 To UBound($FileList) - 1
[/autoit]
$oExcel = _ExcelBookOpen($startfolder & '\' & $FileList[$i], 0)
If @error = 1 Then MsgBox(0, "Error!", "Unable to Create the Excel Object")
_ExcelBookSaveAs($oExcel, @TempDir & '\' & StringTrimRight($FileList[$i], StringInStr($FileList[$i], '.', Default, -1, 0, 0)), "txt", 0, 1, "ReadOnly")
If Not @error Then ConsoleWrite("File : " & @TempDir & '\' & StringTrimRight($FileList[$i], 4) & '.txt' & " was saved!" & @LF)
_ExcelBookClose($oExcel, 1, 0)
Next -
Hier mal quick & dirty erweitert. Damit solltest du weiterkommen.
Spoiler anzeigen
[autoit]#include <Excel.au3>
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
#include <File.au3>
#include <Array.au3>Local $folder = FileSelectFolder("Choose a folder.", "")
[/autoit] [autoit][/autoit] [autoit]Local $FileList = _FileListToArray($folder, '*.xls', 1)
[/autoit] [autoit][/autoit] [autoit]
If @error = 1 Then
MsgBox(0, "", "No Folders Found.")
Exit
EndIf
If @error = 4 Then
MsgBox(0, "", "No Files Found.")
Exit
EndIf
_ArrayDisplay($FileList, "Dateien die verarbeitet werden!")For $i = 1 To UBound($FileList) - 1
[/autoit] [autoit][/autoit] [autoit]
$oExcel = _ExcelBookOpen($folder & '\' & $FileList[$i], 0);Show any errors that might occur when Opening the File
[/autoit] [autoit][/autoit] [autoit]
If @error = 1 Then
MsgBox(0, "Error!", "Unable to Create the Excel Object")
Exit
ElseIf @error = 2 Then
MsgBox(0, "Error!", "File does not exist - Shame on you!")
Exit
EndIf_ExcelBookSaveAs($oExcel, @TempDir & '\' & StringTrimRight($FileList[$i], 4), "txt", 0, 1, "ReadOnly") ;Save the File as 'SaveAsExample2.xls"
[/autoit]
If Not @error Then MsgBox(0, "Success", "File : "& @TempDir & '\' & StringTrimRight($FileList[$i], 4) & '.txt' & " was saved!", 3)
_ExcelBookClose($oExcel, 1, 0) ;This method will save then Close the file, without any of the normal prompts, regardless of changes
Next -
-
Wie willst du es denn haben? Beschreib es mal mit Worten.
User wählt Ordner aus, alle Dateien des Ordners mit Endung xls werden umbenannt?
Rekursiv von dem Ordner?
Keine Auswahl sondern einfach immer alle xls Files aus dem Ordner in dem die exe liegt?
Gibt ja viele Möglichkeiten mit GUI oder ohne usw. -
Noch einfacher sowas
Spoiler anzeigen
[autoit]#include <Excel.au3>
[/autoit] [autoit][/autoit] [autoit]$sFilePath1 = @ScriptDir & "\arbeitszeit.xls" ;This file should already exist
[/autoit] [autoit][/autoit] [autoit]
$oExcel = _ExcelBookOpen($sFilePath1);Show any errors that might occur when Opening the File
[/autoit] [autoit][/autoit] [autoit]
If @error = 1 Then
MsgBox(0, "Error!", "Unable to Create the Excel Object")
Exit
ElseIf @error = 2 Then
MsgBox(0, "Error!", "File does not exist - Shame on you!")
Exit
EndIf_ExcelBookSaveAs($oExcel, @TempDir & "\SaveAsExample2", "txt", 0, 1, "ReadOnly") ;Save the File as 'SaveAsExample2.xls"
[/autoit]
If Not @error Then MsgBox(0, "Success", "File was Saved!", 3)
_ExcelBookClose($oExcel, 1, 0) ;This method will save then Close the file, without any of the normal prompts, regardless of changesDu kannst es auch im Hintergrund öffnen lassen.
-
Hast du dir die Hilfe schon angeschaut?
_ExcelReadSheetToArray
Da gibt es Beispiele. -
So geht es:
[autoit]ControlClick("Setup - OpenSSL Light (32-bit)", "&Next >", '')
[/autoit] -
Das was du sonst manuell mit fsutil machst, sollte man problemlos mit Autoit automatisieren können.
Reicht dir das? -
Könntest auch hingehen und wirklich entsprechend viele Items erstellen, wenn es mehrere Zeilen sind und diese gleichfarbig einfärben.
Und dann ggf. noch eine Spalte davor in der du die eigentliche Zeilennummer anzeigst.Sowas
1|TEXT
1|zweite Zeile
2|Hurra
3|Tolle Wurst
3|zweite Zeile der Wurst
4| ... -
Wenn ich das richtig sehe, dann hast du doch "nur" ein Darstellungsproblem und kein Datenverarbeitungsproblem oder nicht?
Also wozu der Aufwand?
Nimm ein Edit
-
HI,
habe dies gefunden:
Spoiler anzeigen
[autoit]; by GreenCan
[/autoit] [autoit][/autoit] [autoit]#include <GUIConstants.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>Global $View_multiline_ToolTip = True
[/autoit] [autoit][/autoit] [autoit]
Global $Baloon_ToolTip = 1 ; should be 0 or 1
Global $Fly_Over = False
Global $iLastItem = -1, $iLastsubitemNR = -1
Global $hGUI_Multiline, $View_Multiline, $ColName ; Multiline cell viewer windowMsgBox(0, "Demo", "Click on any cell, the cells containing multiple lines" & @CRLF & "will show a popup or ToolTip with the formatted text" & @CRLF & @CRLF & "Change '$NM_CLICK' to '$LVN_HOTTRACK'" & @CRLF & "for a fly-over effect", 10)
[/autoit] [autoit][/autoit] [autoit]$GUI = GUICreate("Listview with Pop-up for multiline cells")
[/autoit] [autoit][/autoit] [autoit]$hListView = GUICtrlCreateListView("Title 1", 10, 10, 380, 350, -1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
[/autoit] [autoit][/autoit] [autoit]; fill with example data
[/autoit] [autoit][/autoit] [autoit]
; Add columns
_GUICtrlListView_AddColumn($hListView, "Title 2", 100)
_GUICtrlListView_AddColumn($hListView, "Title 3", 150); Add some rows
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlListView_AddItem($hListView, "A1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "A2" & @CRLF & "Example of multiline text", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "A3" & @CRLF & "Example of multiline text" & @CRLF & "3rd line", 2)_GUICtrlListView_AddItem($hListView, "B1", 1)
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlListView_AddSubItem($hListView, 1, "B2" & @CRLF & "Line 2" & @CRLF & "Line 3" & @CRLF & "Line 4", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "B3", 2)_GUICtrlListView_AddItem($hListView, "C1")
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlListView_AddSubItem($hListView, 2, "C2" & @CRLF & "Another multiline text", 1)
_GUICtrlListView_AddSubItem($hListView, 2, "C3" & @CRLF & "Another Example of multiline text", 2)
; done; configuration settings
[/autoit] [autoit][/autoit] [autoit]
$multiline_ToolTip = GUICtrlCreateCheckbox("Tooltip", 10, 365, 70)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
If $View_multiline_ToolTip = True Then
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetTip($multiline_ToolTip, "Checked, Tooltip will be shown")
Else
GUICtrlSetTip($multiline_ToolTip, "Unchecked, Pop-Up will be shown")
EndIf$Baloon_Tip = GUICtrlCreateCheckbox("Baloon", 80, 365, 70)
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
If $Baloon_ToolTip = 1 Then
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetTip($Baloon_Tip, "Checked, Display as Balloon Tip Requires IE5+")
Else
GUICtrlSetTip($Baloon_Tip, "Unchecked, Normal Tooltip")
EndIf$FlyOver = GUICtrlCreateCheckbox("Fly-Over effect", 150, 365, 100)
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
If $Fly_Over = True Then
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetTip($FlyOver, "Checked, Fly-Over effect ")
Else
GUICtrlSetTip($FlyOver, "Unchecked, Click on Cell")
EndIfGUISetState()
[/autoit] [autoit][/autoit] [autoit]
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")While 1
[/autoit] [autoit][/autoit] [autoit]
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ToolTip("") ; clean remaining ToolTip from WM_NOTIFY if necessary
GUIDelete($GUI)
ExitCase $msg = $multiline_ToolTip
[/autoit] [autoit][/autoit] [autoit]
If $View_multiline_ToolTip = True Then
$View_multiline_ToolTip = False
GUICtrlSetTip($multiline_ToolTip, "Unchecked, Pop-Up will be shown")
ToolTip("") ; clean remaining ToolTip from WM_NOTIFY if necessary
Else
$View_multiline_ToolTip = True
GUICtrlSetTip($multiline_ToolTip, "Checked, Tooltip will be shown")
View_MultilineCell("") ; clean remaining Pop-up from WM_NOTIFY if necessary
EndIfCase $msg = $Baloon_Tip
[/autoit] [autoit][/autoit] [autoit]
If $Baloon_ToolTip = 1 Then
$Baloon_ToolTip = 0
GUICtrlSetTip($Baloon_Tip, "Unchecked, Normal Tooltip")
Else
$Baloon_ToolTip = 1
GUICtrlSetTip($Baloon_Tip, "Checked, Display as Balloon Tip Requires IE5+")
EndIfCase $msg = $FlyOver
[/autoit] [autoit][/autoit] [autoit]
If $Fly_Over = True Then
$Fly_Over = False
GUICtrlSetTip($FlyOver, "Unchecked, Click on Cell")
Else
$Fly_Over = True
GUICtrlSetTip($FlyOver, "Checked, Fly-Over effect ")
EndIfEndSelect
[/autoit] [autoit][/autoit] [autoit]
WEnd
#FUNCTION# ==============================================================
Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
[/autoit] [autoit][/autoit] [autoit]
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")Switch $hWndFrom
[/autoit] [autoit][/autoit] [autoit]
Case $hWndListView
If $Fly_Over = False Then
Switch $iCode
Case $NM_CLICK ; when clicking on a cell that is multiline, a tooltip will display the contentLocal $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam)
[/autoit] [autoit][/autoit] [autoit]
Local $iItem = DllStructGetData($tInfo, "Item")
Local $subitemNR = DllStructGetData($tInfo, "SubItem")
$Column_attribute = _GUICtrlListView_GetColumn($hListView, $subitemNR)
; if no cell change return without doing anything
If $iLastItem = $iItem And $iLastsubitemNR = $subitemNR Then Return 0
$iLastItem = $iItem
$iLastsubitemNR = $subitemNRLocal $sToolTipData = _GUICtrlListView_GetItemText($hListView, $iItem, $subitemNR)
[/autoit] [autoit][/autoit] [autoit]
$Mypos = StringInStr($sToolTipData, @CRLF)
If $Mypos > 0 Then
If $View_multiline_ToolTip = True Then
ToolTip($sToolTipData, MouseGetPos(0) + 20, MouseGetPos(1) + 20, "", 0, $Baloon_ToolTip)
Else
View_MultilineCell($sToolTipData, $Column_attribute[5] & " Row " & $iItem + 1)
EndIf
Else
If $View_multiline_ToolTip = True Then
ToolTip("")
Else
View_MultilineCell("")
EndIf
;ConsoleWrite("R" & $iItem & "C" & $subitemNR & " No tip" & @CR)
EndIf
EndSwitch
Else
Switch $iCode
Case $Fly_Over = True And $LVN_HOTTRACK; Sent by a list-view control when the user moves the mouse over an item
Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam)
Local $iItem = DllStructGetData($tInfo, "Item")
Local $subitemNR = DllStructGetData($tInfo, "SubItem")
$Column_attribute = _GUICtrlListView_GetColumn($hListView, $subitemNR)
; if no cell change return without doing anything
If $iLastItem = $iItem And $iLastsubitemNR = $subitemNR Then Return 0
$iLastItem = $iItem
$iLastsubitemNR = $subitemNRLocal $sToolTipData = _GUICtrlListView_GetItemText($hListView, $iItem, $subitemNR)
[/autoit] [autoit][/autoit] [autoit]
$Mypos = StringInStr($sToolTipData, @CRLF)
If $Mypos > 0 Then
If $View_multiline_ToolTip = True Then
ToolTip($sToolTipData, MouseGetPos(0) + 20, MouseGetPos(1) + 20, "", 0, $Baloon_ToolTip)
Else
View_MultilineCell($sToolTipData, $Column_attribute[5] & " Row " & $iItem + 1)
EndIf
Else
If $View_multiline_ToolTip = True Then
ToolTip("")
Else
View_MultilineCell("")
EndIf
;ConsoleWrite("R" & $iItem & "C" & $subitemNR & " No tip" & @CR)
EndIf
EndSwitch
EndIf
EndSwitchReturn $GUI_RUNDEFMSG
[/autoit] [autoit][/autoit] [autoit]
EndFunc ;==>WM_NOTIFY
#FUNCTION# ==============================================================
Func View_MultilineCell($Cell_content, $Column_name = "")
Local $Msg2If $Cell_content = "" Then
[/autoit] [autoit][/autoit] [autoit]
; clicked on nonmultiline cell, so close the window
$window_open = WinList("Cell Content")
If $window_open[0][0] > 0 Then GUIDelete($hGUI_Multiline)
Return
Else
$window_open = WinList("Cell Content") ; check if window already exists
If $window_open[0][0] = 0 Then
; if the window does not exist yet, create it
Local $window_width = 300
Local $window_heigth = 300
$hGUI_Multiline = GUICreate("Cell Content", $window_width, $window_heigth, 1, 1, ($WS_POPUPWINDOW), $WS_EX_TOPMOST, $GUI)
$ColName = GUICtrlCreateLabel("Content of " & $Column_name, 10, 2, $window_width)
$View_Multiline = GUICtrlCreateEdit($Cell_content, 5, 20, $window_width - 10, $window_heigth - 40, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
GUICtrlSetColor(-1, 0x2601D3)
GUICtrlSetBkColor(-1, 0xEAFFE8)
GUICtrlCreateLabel("Click on any non-multiline cell to hide this pop-up", 35, $window_heigth - 15, $window_width)
GUICtrlSetFont(-1, 7, 400)
Else
; window already exist so only change the content
GUICtrlSetData($ColName, "Content of " & $Column_name) ; column title
GUICtrlSetData($View_Multiline, $Cell_content) ; cell content
EndIf
GUISetState()
ReturnEndIf
[/autoit]
EndFunc ;==>View_MultilineCell
;~ #FUNCTION# ==============================================================Ansonsten ersetzen und danach zurückübersetzen.
-
-
[autoit]
#RequireAdmin
[/autoit][autoit][/autoit][autoit]
$i = 1While True
[/autoit][autoit][/autoit][autoit]
$sKey = RegEnumKey("HKCR", $i)
If @error > 0 Then
ConsoleWrite('!' & $i & ' ' & @error & @LF)
ExitLoop
EndIf
If @error < 0 Then
MsgBox(16, 'ERROR', 'i = ' & $i & @CRLF &'Hier schon gescheitert!')
Exit (0)
EndIfIf StringInStr($sKey, "Citrix.ICAClient") Then
[/autoit]
ConsoleWrite('!' & "HKCR\" & $sKey & @CRLF)
Else
ConsoleWrite($i & ': ' & $sKey & @CRLF)
EndIf
$i += 1
WEndUnd so?
-
Schon klar. Aber es geht erstmal darum deinen Fehler zu finden.
Wenn er sofort rausspringt, dann lass dir doch mal @error ausgebenIf @error Then consoleWrite(@error)
-
Problem gelöst oder?
So kannst du dir alles auch schön angucken
Spoiler anzeigen
[autoit]$i = 1
[/autoit] [autoit][/autoit] [autoit]While True
[/autoit]
$sKey = RegEnumKey("HKCR", $i)
If @error Then ExitLoop
If StringInStr($sKey, "Citrix.ICAClient") Then
ConsoleWrite('!' & "HKCR\" & $sKey & @CRLF)
Else
ConsoleWrite($i & ': ' & $sKey & @CRLF)
EndIf
$i += 1
WEnd -
Einverstanden
Spoiler anzeigen
[autoit]#include<Constants.au3>
[/autoit] [autoit][/autoit] [autoit]
#include-once;=
[/autoit] [autoit][/autoit] [autoit]
; Customizable File Open/Save dialogs
; by Siao
;=#Region OFN Constants
[/autoit] [autoit][/autoit] [autoit]Global Const $OFN_ALLOWMULTISELECT = 0x200
[/autoit] [autoit][/autoit] [autoit]
Global Const $OFN_CREATEPROMPT = 0x2000
Global Const $OFN_DONTADDTORECENT = 0x2000000
Global Const $OFN_ENABLEHOOK = 0x20
Global Const $OFN_ENABLEINCLUDENOTIFY = 0x400000
Global Const $OFN_ENABLESIZING = 0x800000
Global Const $OFN_ENABLETEMPLATE = 0x40
Global Const $OFN_ENABLETEMPLATEHANDLE = 0x80
Global Const $OFN_EXPLORER = 0x80000
Global Const $OFN_EXTENSIONDIFFERENT = 0x400
Global Const $OFN_EX_NOPLACESBAR = 0x1
Global Const $OFN_FILEMUSTEXIST = 0x1000
Global Const $OFN_FORCESHOWHIDDEN = 0x10000000
Global Const $OFN_HIDEREADONLY = 0x4
Global Const $OFN_LONGNAMES = 0x200000
Global Const $OFN_NOCHANGEDIR = 0x8
Global Const $OFN_NODEREFERENCELINKS = 0x100000
Global Const $OFN_NOLONGNAMES = 0x40000
Global Const $OFN_NONETWORKBUTTON = 0x20000
Global Const $OFN_NOREADONLYRETURN = 0x8000
Global Const $OFN_NOTESTFILECREATE = 0x10000
Global Const $OFN_NOVALIDATE = 0x100
Global Const $OFN_OVERWRITEPROMPT = 0x2
Global Const $OFN_PATHMUSTEXIST = 0x800
Global Const $OFN_READONLY = 0x1
Global Const $OFN_SHAREAWARE = 0x4000
Global Const $OFN_SHAREFALLTHROUGH = 2
Global Const $OFN_SHARENOWARN = 1
Global Const $OFN_SHAREWARN = 0
Global Const $OFN_SHOWHELP = 0x10
Global Const $OFN_USEMONIKERS = 0x1000000
Global Const $OFS_MAXPATHNAME = 128Global Const $CDM_FIRST = 1124
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Global Const $CDM_GETFILEPATH = $CDM_FIRST + 0x1
Global Const $CDM_GETFOLDERIDLIST = $CDM_FIRST + 0x3
Global Const $CDM_GETFOLDERPATH = $CDM_FIRST + 0x2
Global Const $CDM_GETSPEC = $CDM_FIRST + 0x0
Global Const $CDM_HIDECONTROL = $CDM_FIRST + 0x5
Global Const $CDM_SETCONTROLTEXT = $CDM_FIRST + 0x4
Global Const $CDM_SETDEFEXT = $CDM_FIRST + 0x6
Global Const $CDM_LAST = 1224Global Const $CDN_FIRST = -601
[/autoit] [autoit][/autoit] [autoit]
Global Const $CDN_INITDONE = $CDN_FIRST - 0x0
Global Const $CDN_INCLUDEITEM = $CDN_FIRST - 0x7
Global Const $CDN_FOLDERCHANGE = $CDN_FIRST - 0x2
Global Const $CDN_HELP = $CDN_FIRST - 0x4
Global Const $CDN_SELCHANGE = $CDN_FIRST - 0x1
Global Const $CDN_TYPECHANGE = $CDN_FIRST - 0x6
Global Const $CDN_SHAREVIOLATION = $CDN_FIRST - 0x3
Global Const $CDN_FILEOK = $CDN_FIRST - 0x5
Global Const $CDN_LAST = -699;;explorer style dialog control indentifiers
[/autoit] [autoit][/autoit] [autoit]
Global Const $chx1 = 0x410 ;The read-only check box
Global Const $cmb1 = 0x470 ;Drop-down combo box that displays the list of file type filters
Global Const $stc2 = 0x441 ;Label for the cmb1 combo box
Global Const $cmb2 = 0x471 ;Drop-down combo box that displays the current drive or folder, and that allows the user to select a drive or folder to open
Global Const $stc4 = 0x443 ;Label for the cmb2 combo box
Global Const $edt1 = 0x480;Edit control that displays the name of the current file, or allows the user to type the name of the file to open. Compare with cmb13.
Global Const $stc3 = 0x442 ;Label for the cmb13 combo box and the edt1 edit control
Global Const $lst1 = 0x460 ;List box that displays the contents of the current drive or folder
Global Const $stc1 = 0x440 ;Label for the lst1 list box
;~ Global Const $IDOK = 1 ;The OK command button (push button)
;~ Global Const $IDCANCEL = 2 ;The Cancel command button (push button)
Global Const $pshHelp = 0x040e ;The Help command button (push button);; reverse-engineered command codes for SHELLDLL_DefView (Paul DiLascia, MSDN Magazine — March 2004)
[/autoit] [autoit][/autoit] [autoit]
Global Const $ODM_VIEW_ICONS = 0x7029
Global Const $ODM_VIEW_LIST = 0x702b
Global Const $ODM_VIEW_DETAIL = 0x702c
Global Const $ODM_VIEW_THUMBS = 0x702d
Global Const $ODM_VIEW_TILES = 0x702e#EndRegion
[/autoit] [autoit][/autoit] [autoit];#
[/autoit] [autoit][/autoit] [autoit]
; _FileOpenDialogEx()
; Initiates a customizable Open File Dialog.
; Parameters:
; $sTitle - dialog title, see FileOpenDialog()
; $sInitDir - initial folder, see FileOpenDialog()
; $sFilter - file type filter, see FileOpenDialog()
; $iOptions - can be one or combination of the following:
; $OFN_FILEMUSTEXIST
; $OFN_PATHMUSTEXIST
; $OFN_ALLOWMULTISELECT
; $OFN_CREATEPROMPT
; $OFN_ENABLESIZING
; $OFN_DONTADDTORECENT
; $OFN_FORCESHOWHIDDEN
; $OFN_NONETWORKBUTTON
; $OFN_EX_NOPLACESBAR
;
; $sDefaultName - default filename, see FileOpenDialog()
; $hParent - handle of dialog's parent window (0 if none)
; $sHookName - name of user defined dialog hook procedure ("" if none). See examples.
; $hTemplate - handle to a file or memory object containing custom dialog template (0 if none). See examples.
; $sTemplateName - name of a dialog template resource in the module identified by the $hTemplate ("" if none or if $hTemplate is memory object handle). See examples.
; Return values:
; Success: string value of chosen filename(s), see FileOpenDialog()
; Failure: Sets @error to 1
; Remarks:
; Using hook function you can customize dialog to greater extent - hide/show controls, change text of controls, and do other neat things.
; Hook function should have 4 params ($hWnd, $Msg, $wParam, $lParam) and works similar to GuiRegisterMsg() functions. For more information refer http://msdn2.microsoft.com/en-us/library/ms646960(VS.85).aspx
; Using custom templates you can add controls to a common dialog. To handle these custom controls, use hook function.
;#
Func _FileOpenDialogEx($sTitle = "", $sInitDir = "", $sFilter = "All Files (*.*)", $iOptions = 0, $sDefaultName = "", $hParent=0, $sHookName="", $hTemplate=0, $sTemplateName="")Local $sRet = _GetOpenSaveFileName('GetOpenFileName', $sHookName, $hTemplate, $sTemplateName, $hParent, $sTitle, $sInitDir, $sFilter, $iOptions, $sDefaultName)
[/autoit] [autoit][/autoit] [autoit]
If @error Then SetError(@error)
Return $sRet
EndFunc
;#
; _FileSaveDialogEx()
; Initiates a customizable Save File Dialog.
; Parameters:
; $sTitle - dialog title, see FileSaveDialog()
; $sInitDir - initial folder, see FileSaveDialog()
; $sFilter - file type filter, see FileSaveDialog()
; $iOptions - can be one or combination of the following:
; $OFN_PATHMUSTEXIST
; $OFN_OVERWRITEPROMPT
; $OFN_ENABLESIZING
; $OFN_DONTADDTORECENT
; $OFN_FORCESHOWHIDDEN
; $OFN_NONETWORKBUTTON
; $OFN_EX_NOPLACESBAR
;
; $sDefaultName - default filename, see FileSaveDialog()
; $hParent - handle of dialog's parent window (0 if none)
; $sHookName - name of user defined dialog hook procedure ("" if none). See examples.
; $hTemplate - handle to a file or memory object containing custom dialog template (0 if none). See examples.
; $sTemplateName - name of a dialog template resource in the module identified by the $hTemplate ("" if none or if $hTemplate is memory object handle). See examples.
; Return values:
; Success: string value of chosen filename, see FileSaveDialog()
; Failure: Sets @error to 1
; Remarks:
; Using hook function you can customize dialog to greater extent - hide/show controls, change text of controls, and do other neat things.
; Hook function should have 4 params ($hWnd, $Msg, $wParam, $lParam) and works similar to GuiRegisterMsg() functions. For more information refer http://msdn2.microsoft.com/en-us/library/ms646960(VS.85).aspx
; Using custom templates you can add controls to a common dialog. To handle these custom controls, use hook function.
;#
Func _FileSaveDialogEx($sTitle = "", $sInitDir = "", $sFilter = "All Files (*.*)", $iOptions = 0, $sDefaultName = "", $hParent=0, $sHookName="", $hTemplate=0, $sTemplateName="")Local $sRet = _GetOpenSaveFileName('GetSaveFileName', $sHookName, $hTemplate, $sTemplateName, $hParent, $sTitle, $sInitDir, $sFilter, $iOptions, $sDefaultName)
[/autoit]
If @error Then SetError(@error)
Return $sRet
EndFunc
;###################################
;#
; _GetOpenSaveFileName()
; Internal
;#
Func _GetOpenSaveFileName($sFunction, $sHookProc, $hTemplate, $sTemplateName, $hParent, $sTitle, $sInitDir, $sFilter, $iOptions, $sDefaultName)
Local $taFilters, $tFile, $_OFN_HookProc = 0, $fUnicode = @AutoItUnicode , $iFlagsEx = 0, $iFlagsForced = BitOR($OFN_EXPLORER,$OFN_HIDEREADONLY,$OFN_NODEREFERENCELINKS)
$iOptions = BitOR($iFlagsForced, $iOptions)
If BitAND($iOptions, $OFN_EX_NOPLACESBAR) Then
$iOptions = BitXOR($iOptions, $OFN_EX_NOPLACESBAR)
$iFlagsEx = $OFN_EX_NOPLACESBAR
EndIf
Local $tagBuffer = "char[4096]", $iBufferSize = 4095
If $fUnicode Then $tagBuffer = "w" & $tagBuffer
Local $aFilters = StringSplit($sFilter, "|"), $saFilters = "", $tagFilters = "", $aFiltSplit, $i
For $i = 1 To $aFilters[0]
$aFiltSplit = StringRegExp($aFilters[$i], "(?U)\A\h*(.+)\h*\((.*)\)", 1)
$saFilters &= $aFilters[$i] & Chr(0) & $aFiltSplit[1] & Chr(0)
Next
$tagFilters = "char[" & StringLen($saFilters)+3 & "]"
If $fUnicode Then $tagFilters = "w" & $tagFilters
$taFilters = DllStructCreate($tagFilters)
DllStructSetData($taFilters, 1, $saFilters)
Local $tagFileBuffer = "char[32768]", $iFileBufferSize = 32767
If $fUnicode Then $tagFileBuffer = "w" & $tagFileBuffer
$tFile = DllStructCreate($tagFileBuffer) ;Win2000/XP: should be 32k for ansi, unlimited for unicode
If $sDefaultName <> "" Then DllStructSetData($tFile, 1, $sDefaultName)
$tOFN = DllStructCreate('dword lStructSize;hwnd hwndOwner;hwnd hInstance;' & _
'ptr lpstrFilter;ptr lpstrCustomFilter;dword nMaxCustFilter;dword nFilterIndex;' & _
'ptr lpstrFile;dword nMaxFile;ptr lpstrFileTitle;dword nMaxFileTitle;ptr lpstrInitialDir;ptr lpstrTitle;' & _
'dword Flags;short nFileOffset;short nFileExtension;ptr lpstrDefExt;dword lCustData;ptr lpfnHook;ptr lpTemplateName;' & _
'dword Reserved[2];dword FlagsEx')
DllStructSetData($tOFN, 'lStructSize', DllStructGetSize($tOFN))
If IsHWnd($hParent) Then DllStructSetData($tOFN, 'hwndOwner', $hParent)
DllStructSetData($tOFN, 'lpstrFilter', DllStructGetPtr($taFilters))
DllStructSetData($tOFN, 'nFilterIndex', 1)
DllStructSetData($tOFN, 'lpstrFile', DllStructGetPtr($tFile))
DllStructSetData($tOFN, 'nMaxFile', $iFileBufferSize)
DllStructSetData($tOFN, 'FlagsEx', $iFlagsEx)
If $hTemplate <> 0 Then
If $sTemplateName <> "" Then
$iOptions = BitOr($iOptions, $OFN_ENABLETEMPLATE)
DllStructSetData($tOFN, 'hInstance', $hTemplate)
Local $tTemplateName = DllStructCreate($tagBuffer);'char[256]')
DllStructSetData($tTemplateName, 1, $sTemplateName)
DllStructSetData($tOFN, 'lpTemplateName', DllStructGetPtr($tTemplateName))
Else
$iOptions = BitOr($iOptions, $OFN_ENABLETEMPLATEHANDLE)
DllStructSetData($tOFN, 'hInstance', $hTemplate)
EndIf
EndIf
If $sHookProc <> "" Then
$iOptions = BitOr($iOptions, $OFN_ENABLEHOOK, $OFN_ENABLEINCLUDENOTIFY)
$_OFN_HookProc = DllCallbackRegister($sHookProc, "int", "hwnd;uint;wparam;lparam")
DllStructSetData($tOFN, 'lpfnHook', DllCallbackGetPtr($_OFN_HookProc))
EndIf
If $sTitle <> "" Then
Local $tTitle = DllStructCreate($tagBuffer)
DllStructSetData($tTitle, 1, String($sTitle))
DllStructSetData($tOFN, "lpstrTitle", DllStructGetPtr($tTitle))
EndIf
If $sInitDir <> "" Then
Local $tInitDir = DllStructCreate($tagBuffer)
DllStructSetData($tInitDir, 1, String($sInitDir))
DllStructSetData($tOFN, "lpstrInitialDir", DllStructGetPtr($tInitDir))
EndIf
DllStructSetData($tOFN, 'Flags', $iOptions)
If $fUnicode Then $sFunction &= 'W'
Local $aRet = DllCall('comdlg32.dll','int',$sFunction, 'ptr',DllStructGetPtr($tOFN)), $iError = @error
If $_OFN_HookProc <> 0 Then DllCallbackFree($_OFN_HookProc)
If $iError Then
Return SetError(2,$iError,"")
ElseIf $aRet[0] Then
Local $iChar = 1
While $iChar < $iFileBufferSize+1
If DllStructGetData($tFile, 1, $iChar) = "" Then
If DllStructGetData($tFile, 1, $iChar+1) = "" Then ExitLoop
DllStructSetData($tFile, 1, "|", $iChar)
EndIf
$iChar += 1
WEnd
Return SetError(0,0,DllStructGetData($tFile, 1))
Else
Return SetError(1,0,"")
EndIf
EndFunc