anhchangtk Posted March 15, 2009 Share Posted March 15, 2009 (edited) Me had used code FileOpenDiaLog: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Problem Patch with FileOpenDiaLog", 317, 46, 192, 124) $Label1 = GUICtrlCreateLabel("File name:", 10, 13, 52, 17) $patch = GUICtrlCreateLabel("................................................", 72, 13, 148, 17) $browse = GUICtrlCreateButton("Browse", 232, 8, 75, 25, 0) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() if $browse = $msg Then $message = "Chose a file" $var = FileOpenDialog($message, @MyDocumentsDir & "\", "Images (*.jpg;*.bmp)", 1 + 1 ) If @error Then MsgBox(4096,"","No File(s) chosen") Else guictrlsetdata($patch,$var) EndIf endif if $msg = $GUI_EVENT_CLOSE then exit WEnd With with long patch then $patch don't show full patch in 1 line Now i'm want show Patch C:\MyDocuments and Setting\User\My Documents\exam.jpg then show C:\MyDocuments an...\exam.jpg As for file exam.jpg in E:\Pic\Exam\exam.jpg then show full patch is E:\Pic\Exam\exam.jpg Show patch = width size of $patch Please you help me ( Because i'm making project then very need Thanks you !!! Edited March 15, 2009 by anhchangtk Link to comment Share on other sites More sharing options...
Authenticity Posted March 15, 2009 Share Posted March 15, 2009 You can use FileGetShortName($var) but I don't think it's a good idea to use a static control. Use GuiCtrlCreateInput with $ES_READONLY (#include <EditConstants.as3>) instead. Link to comment Share on other sites More sharing options...
anhchangtk Posted March 16, 2009 Author Share Posted March 16, 2009 Thanks You But patch show is: C:\DOCUME~1\User\MYDOCU~1\ak081012.jpg Now i'm want patch show is: C:\DOCUME~1\...\...\ak081012.jpg Cause the $patch don't show full Link to comment Share on other sites More sharing options...
Authenticity Posted March 16, 2009 Share Posted March 16, 2009 Like this? #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Problem Patch with FileOpenDiaLog", 397, 46, 192, 124) $Label1 = GUICtrlCreateLabel("File name:", 10, 13, 52, 17) $patch = GUICtrlCreateLabel("........................................................", 72, 13, 228, 17) $browse = GUICtrlCreateButton("Browse", 312, 8, 75, 25, 0) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() If $browse = $Msg Then $message = "Chose a file" $var = FileOpenDialog($message, @MyDocumentsDir & "\", "Images (*.jpg;*.bmp)", 1 + 1) If @error Then MsgBox(4096, "", "No File(s) chosen") Else $var = FileGetShortName($var) $tmp = StringTrimLeft($var, 3) $tmp = StringRegExpReplace($tmp, '(?<=\\).*?(?=\\)', '...') $tmp = StringLeft($var, 3) & $tmp GUICtrlSetData($patch, $tmp) EndIf EndIf If $Msg = $GUI_EVENT_CLOSE Then Exit WEnd Link to comment Share on other sites More sharing options...
anhchangtk Posted March 16, 2009 Author Share Posted March 16, 2009 (edited) Now i'm use script of you Me edit line $var = FileGetShortName($var) to $var1 = FileGetShortName($var) And me use code: $f=GUICtrlRead($var) $f=FileReadLine($f, 1) AutoIt don't know :-s it been error Please you help me Edited March 16, 2009 by anhchangtk Link to comment Share on other sites More sharing options...
Authenticity Posted March 16, 2009 Share Posted March 16, 2009 Hmm? $Var is holding a non existing path after all this makeup. Store the file path (if the user chose one) on a global variable. Also, this is not the way to open a handle to file. Read about FileOpen in the help file. Link to comment Share on other sites More sharing options...
ResNullius Posted March 17, 2009 Share Posted March 17, 2009 @anhchangtk,Does this help? #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global Const $SS_PATHELLIPSIS = 0x008000 $Form1 = GUICreate("Problem Patch with FileOpenDiaLog", 350, 46, 192, 124) $Label1 = GUICtrlCreateLabel("File name:", 10, 13, 52, 17) $patch = GUICtrlCreateLabel("................................................", 72, 13, 180, 17, $SS_PATHELLIPSIS) $browse = GUICtrlCreateButton("Browse", 265, 8, 75, 25, 0) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() if $browse = $msg Then $message = "Chose a file" $var = FileOpenDialog($message, @MyDocumentsDir & "\", "Images (*.jpg;*.bmp)", 1 + 1 ) If @error Then MsgBox(4096,"","No File(s) chosen") Else guictrlsetdata($patch,$var) guiCtrlSetTip($Patch,$Var) EndIf endif if $msg = $GUI_EVENT_CLOSE then exit WEndCredit to Smoke_N and martin: http://www.autoitscript.com/forum/index.ph...st&p=605551 Link to comment Share on other sites More sharing options...
anhchangtk Posted March 17, 2009 Author Share Posted March 17, 2009 @Authenticity: thanks you me had sucess @ResNullius: ok thanks you but over Set Global $SS_PATHELLIPSIS = 0x008000 and $SS_WORDELLIPSIS = 0x00C000 Can set $SS_PATHELLIPSIS = order ? Ahh now me use the code #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global Const $SS_PATHELLIPSIS = 0x008000 $Form1 = GUICreate("Problem Patch with FileOpenDiaLog", 350, 46, 192, 124) $Label1 = GUICtrlCreateLabel("File name:", 10, 13, 52, 17) $patch = GUICtrlCreateLabel("................................................", 72, 13, 180, 17, $SS_PATHELLIPSIS) $browse = GUICtrlCreateButton("Browse", 265, 8, 75, 25, 0) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() if $browse = $msg Then $message = "Chose a file" $var = FileOpenDialog($message, @MyDocumentsDir & "\", "Images (*.jpg;*.bmp)", 1 + 1 ) If @error Then MsgBox(4096,"","No File(s) chosen") Else $var = FileGetShortName($var) [b]; me had add code :) => result very good :)[/b] guictrlsetdata($patch,$var) guiCtrlSetTip($Patch,$Var) EndIf endif if $msg = $GUI_EVENT_CLOSE then exit WEnd But me want app to FileSaveDiaLog with script #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global Const $SS_PATHELLIPSIS = 0x008000 $Form1 = GUICreate("Problem Patch with FileOpenDiaLog", 350, 46, 192, 124) $Label1 = GUICtrlCreateLabel("File name:", 10, 13, 52, 17) $patch = GUICtrlCreateLabel("................................................", 72, 13, 180, 17, $SS_PATHELLIPSIS) $browse = GUICtrlCreateButton("Browse", 265, 8, 75, 25, 0) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() if $browse = $msg Then $message = "Chose a file" $var = FileSaveDialog($message, @MyDocumentsDir & "\", "Images (*.jpg;*.bmp)", 1 + 16 ) If @error Then MsgBox(4096,"","No File(s) chosen") Else $var = FileGetShortName($var) guictrlsetdata($patch,$var) guiCtrlSetTip($Patch,$Var) EndIf endif if $msg = $GUI_EVENT_CLOSE then exit WEnd The script don't show as like It's show is patch is: C:\Documents and Settings\...\test.jpg The script FileGetShortName () don't run 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