Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/16/2012 in all areas

  1. removing the quotes on VAR fixed it!! thanks!!
    1 point
  2. BrewManNH

    Excel trouble

    Set the cell's contents as '002233454, the leading ' designates the contents as text and won't format it as a number, which strips leading 0's.
    1 point
  3. You might look at Inkscape. It's a nice vector drawing program that can output in a variety of formats (like SVG) and you can view the output drawing as a text file and possibly get the coordinates from there.
    1 point
  4. UserAutoIt, You need to check inside the handler which ListView has sent the message: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> #include <StructureConstants.au3> $hGUI = GUICreate("Test", 500, 500) $hListView_1 = _GUICtrlListView_Create($hGUI, "LV 1 ", 10, 10, 230, 200) $hListView_2 = _GUICtrlListView_Create($hGUI, "LV 2 ", 260, 10, 230, 200) For $i = 1 To 30 _GUICtrlListView_AddItem($hListView_1, "LV 1 Item " & $i) _GUICtrlListView_AddItem($hListView_2, "LV 2 Item " & $i) Next GUISetState() GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $tStruct = DllStructCreate($tagNMHDR, $lParam) ; struct;hwnd hWndFrom;uint_ptr IDFrom;int Code;endstruct If @error Then Return Switch DllStructGetData($tStruct, "Code") ; Look for the message code Case $NM_DBLCLK Switch DllStructGetData($tStruct, "hWndFrom") ; Now look for the control that sent it Case $hListView_1 ConsoleWrite("You clicked LV 1" & @CRLF) Case $hListView_2 ConsoleWrite("You clicked LV 2" & @CRLF) EndSwitch EndSwitch EndFunc ;==>_WM_NOTIFY Does that answer the question? Please ask again if not. M23
    1 point
  5. Danger111, It looks to me as if your TreeView already holds the file path within it - each time you find a folder you start a new branch. So you should be able to get the path by using _GUICtrlTreeView_GetTree - no need for a file at all. Try running this: #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> Global $aHandles[100] = [0] $sPath = "C:" ; Amend this as you wish $hGUI = GUICreate("Test", 500, 500) $TreeView1 = _GUICtrlTreeView_Create($hGUI, 10, 10, 480, 380, BitOr($TVS_CHECKBOXES, $TVS_HASLINES) ) _GUICtrlTreeView_BeginUpdate($TreeView1) $DriveCreate = _GUICtrlTreeView_Add($TreeView1, 0, $sPath, 8, 8) ListFiles_ToTreeView("M:MusicMP3", $DriveCreate) _GUICtrlTreeView_EndUpdate($TreeView1) _GUICtrlTreeView_Expand($TreeView1) ReDim $aHandles[$aHandles[0] + 1] $hButton = GUICtrlCreateButton("Read selected", 10, 450, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton For $i = 0 To $aHandles[0] If _GUICtrlTreeView_GetChecked($TreeView1, $aHandles[$i]) = True Then MsgBox(0, "Path", _GUICtrlTreeView_GetTree($TreeView1, $aHandles[$i])) EndIf Next EndSwitch WEnd Func ListFiles_ToTreeView($sSourceFolder, $hItem) Local $sFile ; Force a trailing If StringRight($sSourceFolder, 1) <> "" Then $sSourceFolder &= "" ; Start the search Local $hSearch = FileFindFirstFile($sSourceFolder & "*.*") ; If no files found then return If $hSearch = -1 Then Return ; This is where we break the recursive loop <<<<<<<<<<<<<<<<<<<<<<<<<< ; Now run through the contents of the folder While 1 ; Get next match $sFile = FileFindNextFile($hSearch) ; If no more files then close search handle and return If @error Then ExitLoop ; This is where we break the recursive loop <<<<<<<<<<<<<<<<<<<<<<<<<< ; Check if a folder If @extended Then ; If so then call the function recursively $aHandles[0] += 1 If UBound($aHandles) <= $aHandles[0] Then ReDim $aHandles[UBound($aHandles) * 2] $aHandles[$aHandles[0]] = _GUICtrlTreeView_AddChild($TreeView1, $hItem, $sFile, 3, 3) ListFiles_ToTreeView($sSourceFolder & $sFile, $aHandles[$aHandles[0]]) Else ; If a file than write path and name If StringRight(String($sFile), 3) = "mp3" Then $IconNumber = 168 ElseIf StringRight(String($sFile), 3) = "txt" Then $IconNumber = 70 ElseIf StringRight(String($sFile), 3) = "jpg" Then $IconNumber = 141 ElseIf StringRight(String($sFile), 3) = "avi" Then $IconNumber = 165 Else $IconNumber = 0 EndIf $aHandles[0] += 1 If UBound($aHandles) <= $aHandles[0] Then ReDim $aHandles[UBound($aHandles) * 2] $aHandles[$aHandles[0]] = _GUICtrlTreeView_AddChild($TreeView1, $hItem, $sFile, $IconNumber, $IconNumber) EndIf WEnd EndFuncYou can see I use the trick I showed in the Recursion tutorial to size the array. I hope it works for you - it does for me. M23
    1 point
  6. Danger111, No need for you to code the "is it a folder check", as FileFindNextFile does it for you by setting @extended to 1 if the returned filename is a directory. As to looking in folders within folder, I suggest you start by reading the Recursion tutorial in the Wiki. Recursion is very powerful but you must be very careful when you use it. Finally, you might want to look at the ChooseFileFolder UDF in my sig in which I produce a TreeView of a given path. Feel free to copy any of the code that you might think useful. M23
    1 point
  7. Try this code #include <Crypt.au3> Ini_Write("Password","Filename.ini","Section","Key","Value") $Value = Ini_Read("Password","Filename.ini","Section","Key") if Not @error Then _ MsgBox(0,"MSG",$Value) Func Ini_Write($Password,$Filename,$Section,$Key,$Value) _Crypt_Startup() if @error Then Return SetError(1,@error,False) $hKey =_Crypt_DeriveKey($Password,$CALG_RC4) if @error Then Return SetError(2,@error,False) $ByteStruct = DllStructCreate("BYTE[" & StringLen($Value) & "]") DllStructSetData($ByteStruct,1,$Value) $StrByte = String(DllStructGetData($ByteStruct,1)) $EncryptedValue = _Crypt_EncryptData($StrByte,$hKey,$CALG_USERKEY) if @error Then Return SetError(3,@error,False) IniWrite($Filename,$Section,$Key,$EncryptedValue) if @error Then Return SetError(4,@error,False) _Crypt_DestroyKey($hKey) _Crypt_Shutdown() Return SetError(0,0,True) EndFunc Func Ini_Read($Password,$Filename,$Section,$Key,$Default = "NotFound") $EncryptedValue = IniRead($Filename,$Section,$Key,$Default) if $EncryptedValue == $Default Then Return SetError(1,0,$Default) _Crypt_Startup() if @error Then Return SetError(2,@error,$Default) $hKey =_Crypt_DeriveKey($Password,$CALG_RC4) if @error Then Return SetError(3,@error,$Default) $Binary = _Crypt_DecryptData($EncryptedValue,$hKey,$CALG_USERKEY) if @error Then Return SetError(4,@error,$Default) $StrByte = BinaryToString($Binary) if @error Then Return SetError(5,@error,$Default) $ByteStruct = DllStructCreate("BYTE[" & BinaryLen($StrByte) & "]") DllStructSetData($ByteStruct,1,$StrByte) $CharStruct = _ DllStructCreate("CHAR[" & DllStructGetSize($ByteStruct) & "]",DllStructGetPtr($ByteStruct)) _Crypt_DestroyKey($hKey) _Crypt_Shutdown() Return SetError(0,0,DllStructGetData($CharStruct,1)) EndFunc
    1 point
×
×
  • Create New...