AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[module] CmnDlg FileSelectFile with Multi Filter and more...

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
DerRaphael



Joined: 23 Nov 2007
Posts: 387
Location: Heidelberg, Germany

PostPosted: Mon Dec 03, 2007 1:48 pm    Post subject: [module] CmnDlg FileSelectFile with Multi Filter and more... Reply with quote

Hi All,

after doing a bit of research and torturing my brain, i finally managed to include the CommonFileOpen and Save dialogue with multiple Filter Criteria

So now, it's possible to call the FileOpen dialogue and passing multiple filter criteria to show. It supports custom dialogue title as well as autoappending an extension to the filename, when none is given and a default preset for initially shown Filter (1st, 2nd ...). Below is also a demonstration of how to use multiple file selection

USING FLAGS:
Using flags for this dialogue supposed to be as easy as possible. Look up whatever flags you want to use and simply include 'em in a list. The format including the case is rather not important as long as its a string with which you call the function. So, let's say you want to use the OFN_FILEMUSTEXIST, OFN_EXPLORER, and OFN_HIDEREADONLY flags. You might type:
Code:

 flags := "FILEMUSTEXIST EXPLORER HIDEREADONLY ALLOWMULTISELECT"

or
Code:

 flags := "OFN_FILEMUSTEXIST OFN_EXPLORER OFN_HIDEREADONLY OFN_ALLOWMULTISELECT"

or
Code:

 flags := "FILEMUSTEXIST OFN_Explorer hidereadonly OFN_ALLOWMULTISELECT"

... you also might use a Comma or a Pipe or Space or even a Tab as delimitor. So your code could look like this:
Code:

 flags := "FILEMUSTEXIST,OFN_EXPLORER   0x4|OFN_ALLOWMULTISELECT"


This 'll work as long as the flag-Descriptor is know by interpreter script part. Actually these are all OFN_* Flags and their corresponding Integer Value. When its misspelled it wont be recognized

Known Limitations: Right now, i don't have an idea of how UTF will be handled



This example consists of two parts:
1st one is the File to include
Code:

; FileOpen / FileSave dialogue functions
; This File is relased under the zlib/libpng License
; ( c ) 2007 Raphael Friedel
;
; http://www.opensource.org/licenses/zlib-license.php
;
; For a List of possible Flags have a look at EOF

;----------------------------------------------------------------------------------------------
; Function:  FileOpen
;            Display standard OpenSaveDialogue
;
; Parameters:
;            HWND            - Parent's Handle
;            Filter          - Specify Filter as with FileSelectFile
;                              for use of multiple Filter seperate them with |
;            defaultFilter   - Selects default Filter from above List
;            IniDir          - Specify Initialisation Directory
;                              chosen Directory will be set as WorkingDir in
;                              A_WorkingDir
;            DialogTitle     - Dialogue Title
;            defaulltExt     - Extension to append when none given
;            flags           - Flags for Dialogue
;                              when no supplied 
;                               OFN_FILEMUSTEXIST - OFN_HIDEREADONLY  - OFN_ENABLEXPLORER
;                              are used as default
;
;  Returns:
;            Selected FileName or Emtpy when cancelled
;
;  Remarks:
;            When OFN_ALLOWMULTISELECT flag is set, be sure to set OFN_ENABLEXPLORER flag,
;            too. Without it the Old-Style FileOpen Dialogue appears and handling multiple
;            fileNames might be different and wont work as expected
;            See http://msdn2.microsoft.com/en-us/library/ms646839.aspx for details
;
DLG_FileOpen( ByRef HWND=0
            , ByRef Filter="Text Files (*.txt)|All Files (*.*)"
            , ByRef defaultFilter=1
            , ByRef IniDir=""
            , ByRef DialogTitle="Select file to open"
            , ByRef defaulExt="txt"
            , ByRef flags="" )
{

   VarSetCapacity( FileTitle,0xffff,0 )    ; OutName - w/o Dir
   VarSetCapacity( fT,0xffff,0 )           ; OutName - w/ Dir
   VarSetCapacity( lpstrFilter,0xffff,0 )  ; fILTERtEXT
   VarSetCapacity( cF,0xff,0 )             ; cUSTOMfILTER
   VarSetCapacity( OFName,90,0 )           ; OPENFILENAME

   ; Contruct FilterText seperate by \0
   fI          := 0                        ; Used by Loop as Offset
   
   loop, Parse, Filter, |               
   {
      OB       := InStr( A_LoopField,"(" ) + 1         ; Find Open Bracket
      Ext       := SubStr( A_LoopField, OB,-1 )
      Loop, Parse, A_LoopField
      {
         NumPut( asc( A_LoopField ),lpstrFilter,fI,"UChar" )
         fI++
      }
      NumPut( 0,lpstrFilter,fI,"UChar" )
      fI++
      Loop, Parse, Ext
      {
         NumPut( asc( A_LoopField ),lpstrFilter,fI,"UChar" )
         fI++
      }
      NumPut( 0,lpstrFilter,fI,"UChar" )
      fI++
   }
   NumPut( 0,lpstrFilter,fI,"UChar" )                   ; Double Zero Termination

   ; SetDefaultFlags

   If ( flags="" ) {
      hFlags := __helperFileOpenSaveFlags( "0x1000|0x4|0x80000" )
   } else {
      hFlags := __helperFileOpenSaveFlags( flags )
   }


   ; Contruct OPENFILENAME Structure
   
   NumPut( 76,            OFName, 0,  "UInt" )    ; Length of Structure
   NumPut( HWND,          OFName, 4,  "UInt" )    ; HWND
   NumPut( &lpstrFilter,  OFName, 12, "UInt" )    ; Pointer to FilterStruc
   NumPut( &cF,           OFName, 16, "UInt" )    ; Pointer to CustomFilter
   NumPut( 255,           OFName, 20, "UInt" )    ; MaxChars for CustomFilter
   NumPut( defaultFilter, OFName, 24, "UInt" )    ; DefaultFilter Pair
   NumPut( &fT,           OFName, 28, "UInt" )    ; lpstrFile / InitialisationFileName
   NumPut( 0xffff,        OFName, 32, "UInt" )    ; MaxFile / lpstrFile length
   NumPut( &FileTitle,    OFName, 36, "UInt" )    ; lpstrFileTitle
   NumPut( 0xffff,        OFName, 40, "UInt" )    ; maxFileTitle
   NumPut( &IniDir,       OFName, 44, "UInt" )    ; IniDir
   NumPut( &DialogTitle,  OFName, 48, "UInt" )    ; DlgTitle
   NumPut( hFlags,        OFName, 52, "UInt" )    ; Flags
   NumPut( &defaultExt,   OFName, 60, "UInt" )    ; DefaultExt

   DllCall("comdlg32\GetOpenFileNameA", "Uint", &OFName  )
   
   fDirAndName  := ""
   fZeroHit     := 0
   fNameCount   := 0
   
   Loop, 0xffff
   {
      char := NumGet( fT, A_Index-1, "UChar" )
      if ( char=0 ) {
         fDirAndName .= "|"                    ; Set Delimiter as there might be more than
         fNameCount++                          ; one File selected
         fZeroHit++                            ; increment ZeroCount
      } else {
         fDirAndName .= chr( char )            ; Append to FileName
         fZeroHit := 0                         ; reset FileTerminationCount
      }
      if fZeroHit = 2
         break
   }
   
   if ( fNameCount-fZeroHit>0 )                  ; This is the multiple File Selection
   {
      fDirName    := SubStr( fDirAndName, 1, InStr( fDirAndName, "|" )-1 )
      fNames      := SubStr( fDirAndName, StrLen( fDirName )+2, -2 )
      fDirAndName := ""
      Loop, Parse, fNames, |
      {
         fDirAndName .= fDirName . "\" . A_LoopField . "|"
      }
      StringTrimRight, fDirAndName, fDirAndName, 1         ; remove last delimiter
   } else {
      StringTrimRight, fDirAndName, fDirAndName, %fZeroHit%   ; remove last two delimiters
   }
   
   return %fDirAndName%
}

;----------------------------------------------------------------------------------------------
; Function:  FileSave
;            Display standard OpenSaveDialogue
;
; Parameters:
;            HWND            - Parent's Handle
;            Filter          - Specify Filter as with FileSelectFile
;                              for use of multiple Filter seperate them with |
;            defaultFilter   - Selects default Filter from above List
;            IniDir          - Specify Initialisation Directory
;                              chosen Directory will be set as WorkingDir in
;                              A_WorkingDir
;            DialogTitle     - Dialogue Title
;            defaulltExt     - Extension to append when none given
;            flags           - Flags for Dialogue
;                              when no supplied 
;                               OFN_EXTENSIONDIFFERENT - OFN_OVERWRITEPROMPT
;                              are used as default
;
;  Returns:
;            Selected FileName or Emtpy when cancelled
;
DLG_FileSave( ByRef HWND=0
            , ByRef Filter="Text Files (*.txt)|All Files (*.*)"
            , ByRef defaultFilter=1
            , ByRef IniDir=""
            , ByRef DialogTitle="Select file to Save"
            , ByRef defaulExt="txt"
            , ByRef flags="" )
{

   VarSetCapacity( FileTitle,0xffff,0 )    ; OutName - w/o Dir
   VarSetCapacity( fT,0xffff,0 )           ; OutName - w/ Dir
   VarSetCapacity( lpstrFilter,0xffff,0 )  ; fILTERtEXT
   VarSetCapacity( cF,0xff,0 )             ; cUSTOMfILTER
   VarSetCapacity( OFName,90,0 )           ; OPENFILENAME

   ; Contruct FilterText seperate by \0
   fI          := 0                        ; Used by Loop as Offset
   
   loop, Parse, Filter, |               
   {
      OB       := InStr( A_LoopField,"(" ) + 1         ; Find Open Bracket
      Ext       := SubStr( A_LoopField, OB,-1 )
      Loop, Parse, A_LoopField
      {
         NumPut( asc( A_LoopField ),lpstrFilter,fI,"UChar" )
         fI++
      }
      NumPut( 0,lpstrFilter,fI,"UChar" )
      fI++
      Loop, Parse, Ext
      {
         NumPut( asc( A_LoopField ),lpstrFilter,fI,"UChar" )
         fI++
      }
      NumPut( 0,lpstrFilter,fI,"UChar" )
      fI++
   }
   NumPut( 0,lpstrFilter,fI,"UChar" )                   ; Double Zero Termination
   
   ; SetDefaultFlags

   If ( flags="" ) {
      hFlags := __helperFileOpenSaveFlags( "EXTENSIONDIFFERENT OVERWRITEPROMPT" )
   } else {
      hFlags := __helperFileOpenSaveFlags( flags )
   }

   ; Contruct OPENFILENAME Structure
   
   NumPut( 76,            OFName, 0,  "UInt" )    ; Length of Structure
   NumPut( HWND,          OFName, 4,  "UInt" )    ; HWND
   NumPut( &lpstrFilter,  OFName, 12, "UInt" )    ; Pointer to FilterStruc
   NumPut( &cF,           OFName, 16, "UInt" )    ; Pointer to CustomFilter
   NumPut( 255,           OFName, 20, "UInt" )    ; MaxChars for CustomFilter
   NumPut( defaultFilter, OFName, 24, "UInt" )    ; DefaultFilter Pair
   NumPut( &fT,           OFName, 28, "UInt" )    ; lpstrFile / InitialisationFileName
   NumPut( 0xffff,        OFName, 32, "UInt" )    ; MaxFile / lpstrFile length
   NumPut( &FileTitle,    OFName, 36, "UInt" )    ; lpstrFileTitle
   NumPut( 0xffff,        OFName, 40, "UInt" )    ; maxFileTitle
   NumPut( &IniDir,       OFName, 44, "UInt" )    ; IniDir
   NumPut( &DialogTitle,  OFName, 48, "UInt" )    ; DlgTitle
   NumPut( hFlags,        OFName, 52, "UInt" )    ; Flags
   NumPut( &defaultExt,   OFName, 60, "UInt" )    ; DefaultExt

   DllCall("comdlg32\GetSaveFileNameA", "Uint", &OFName  )
   
   fDirAndName  := ""
   
   Loop, 0xffff
   {
      char := NumGet( fT, A_Index-1, "UChar" )
      if char=0
         break
      fDirAndName .= chr( char )
      
   }
   
   return %fDirAndName%
}


__helperFileOpenSaveFlags( flags )
{

    flagNames = OFN_SHAREWARN, OFN_SHARENOWARN, OFN_SHAREFALLTHROUGH, OFN_READONLY
              , OFN_OVERWRITEPROMPT, OFN_HIDEREADONLY, OFN_NOCHANGEDIR, OFN_SHOWHELP
              , OFN_ENABLEHOOK, OFN_ENABLETEMPLATE, OFN_ENABLETEMPLATEHANDLE
              , OFN_NOVALIDATE, OFN_ALLOWMULTISELECT, OFN_EXTENSIONDIFFERENT
              , OFN_PATHMUSTEXIST, OFN_FILEMUSTEXIST, OFN_CREATEPROMPT, OFN_SHAREAWARE
              , OFN_NOREADONLYRETURN, OFN_NOTESTFILECREATE, OFN_NONETWORKBUTTON
              , OFN_NOLONGNAMES, OFN_EXPLORER, OFN_NODEREFERENCELINKS, OFN_LONGNAMES
              , OFN_ENABLEINCLUDENOTIFY, OFN_ENABLESIZING, OFN_DONTADDTORECENT
              , OFN_FORCESHOWHIDDEN

    flagValue = 0, 1, 2, 0x1, 0x2, 0x4,0x8,0x10,0x20,0x40,0x80
              , 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000
              , 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000
              , 0x400000, 0x800000, 0x2000000, 0x10000000

   rFlag     := 0
   empty     := ""

   StringSplit, flagV, flagValue, `,

   StringUpper, flags, flags
   
   if ( InStr( flags, "OFN_" )!=0 ) {
      StringReplace, flags, flags, OFN_, %empty%, All
   }

   flags     := RegExReplace( flags, "\|+", "," )  ; Replace all Pipe Chars with Comma
   flags     := RegExReplace( flags, "\s+", "," )  ; Replace all WhiteSpace with Comma
   flags     := RegExReplace( flags, ",+", "," )   ; Replace all multifolowing Comma with one
   flags     := RegExReplace( flags, "(^,|,$)" )   ; Remove any leading or trailing Comma

   flagNames := RegExReplace( flagNames, "\s+" )   ; Remove all WhiteSpace
   flagValue := RegExReplace( flagValue, "\s+" )   ; Remove all WhiteSpace

   Loop, Parse, flags, `,
   {
      flag := A_LoopField
      if A_LoopField is Integer                   ; Check: Is Integer
      {
         if A_LoopField in %flagValue%           ; Pass only if allowed ( from List given )
         {
            rFlag |= A_LoopField            ; add to flags
         }
      }
      else {
         Loop, Parse, flagNames, `,              ; Must be Name
         {
            if ( SubStr( A_LoopField, 5 ) = flag ) {      ; Known Name?
               rFlag |= flagV%A_Index%         ; Grab its Value and add to return flags
            }
         }
      }
   }
   
   return, rFlag
   
}



; Possible FLAGS for FileOpen/FileSave Dlg
; Refer to http://msdn2.microsoft.com/en-us/library/ms646839.aspx

;    OFN_ALLOWMULTISELECT     := 0x200
;    OFN_CREATEPROMPT         := 0x2000
;    OFN_DONTADDTORECENT      := 0x2000000
;    OFN_ENABLEHOOK           := 0x20
;    OFN_ENABLEINCLUDENOTIFY  := 0x400000
;    OFN_ENABLESIZING         := 0x800000
;    OFN_ENABLETEMPLATE       := 0x40
;    OFN_ENABLETEMPLATEHANDLE := 0x80
;    OFN_EXPLORER             := 0x80000
;    OFN_EXTENSIONDIFFERENT   := 0x400
;    OFN_FILEMUSTEXIST        := 0x1000
;    OFN_FORCESHOWHIDDEN      := 0x10000000
;    OFN_HIDEREADONLY         := 0x4
;    OFN_NOCHANGEDIR          := 0x8
;    OFN_NODEREFERENCELINKS   := 0x100000
;    OFN_NOVALIDATE           := 0x100
;    OFN_OVERWRITEPROMPT      := 0x2
;    OFN_PATHMUSTEXIST        := 0x800
;    OFN_READONLY             := 0x1
;    OFN_SHAREAWARE           := 0x4000
;    OFN_SHAREFALLTHROUGH     := 2
;    OFN_SHARENOWARN          := 1
;    OFN_SHAREWARN            := 0
;    OFN_SHOWHELP             := 0x10
;    OFN_NONETWORKBUTTON      := 0x20000
;    OFN_NOREADONLYRETURN     := 0x8000
;    OFN_NOTESTFILECREATE     := 0x10000
;    OFN_LONGNAMES            := 0x200000
;    OFN_NOLONGNAMES          := 0x40000
   
;    ; Not used here: FlagEx - not supported by OpenFileName Structure
;    OFN_EX_NOPLACESBAR       := 0x1


Download: http://www.autohotkey.net/~DerRaphael/DLG_FileOpenSave.ahk

2nd is a simple usage example
Code:

;
; DemoAHK Scriplet for DLG_FileOpen & DLG_FileSave
;

Gui, Add, Button, w300 gOpenFileDlg_Single,Show Open Single File Dialog
Gui, Add, Button, w300 gOpenFileDlg_Multi,Show Open Multiple Files Dialog
Gui, Add, Button, w300 gSaveFileDlg,Show Save File Dialog
Gui, Show,, File Open and Save Demo
return

OpenFileDlg_Multi:
   HWND          := WinExist(A)

   Filter        := "Text Files (*.txt;*.doc)"
    Filter        .= "|Autohotkey Files (*.ahk)"
    Filter        .= "|AutoIT v3 Files (*.au3)"
    Filter        .= "|VisualBasic Script Files (*.vbs)"
    Filter        .= "|All Files (*.*)"

   defaultFilter := 2
   IniDir        := A_WorkingDir
   DialogTitle   := "AHK-Demonstration: Choose multiple files to OPEN or press Cancel"
   defaultExt    := "txt"
   flags         := "FILEMUSTEXIST EXPLORER HIDEREADONLY ALLOWMULTISELECT"

                  ; These are default flags - these are set, when no flags are specified
                  ;     0x1000  -> OFN_FILEMUSTEXIST
                  ;     0x80000 -> OFN_EXPLORER
                  ;     0x4     -> OFN_HIDEREADONLY
                  ;
                  ; This Flag allows multiple Files to be selected
                  ;     0x200   -> OFN_ALLOWMULTISELECT
                     

    FileName := DLG_FileOpen( HWND
                            , Filter
                            , defaultFilter
                            , InitilisationDir
                            , DialogTitle
                            , defaultExt
                            , flags )
   If !( FileName )
      MsgBox The dialog was cancelled or no Filename chosen
   else {
      ; Filenames are Pipedelimited when more than one is selected
      ; path\tp\file1.ext|path\to\file2.ext ...
      ; This just replaces Pipe with CR
      
      StringReplace, FileName, FileName, |, `n, All, UseErrorLevel
      FilesTotal := ErrorLevel + 1
      s := ""
      if FilesTotal>1
         s := "s"
      MsgBox You selected a total of %FilesTotal% file%s%. The selection was:`n`n%FileName%
   }
return

OpenFileDlg_Single:
   HWND          := WinExist(A)

   Filter        := "Text Files (*.txt;*.doc)"
    Filter        .= "|Autohotkey Files (*.ahk)"
    Filter        .= "|AutoIT v3 Files (*.au3)"
    Filter        .= "|VisualBasic Script Files (*.vbs)"
    Filter        .= "|All Files (*.*)"

   defaultFilter := 2
   IniDir        := A_WorkingDir
   DialogTitle   := "AHK-Demonstration: Choose your file to OPEN or press Cancel"
   defaultExt    := "txt"

    FileName := DLG_FileOpen( HWND
                            , Filter
                            , defaultFilter
                            , InitilisationDir
                            , DialogTitle
                            , defaultExt )
   If !( FileName )
      MsgBox The dialog was cancelled or no Filename chosen
   else
      MsgBox The FileName you selected is:`n%FileName%
return

SaveFileDlg:

   HWND          := WinExist(A)

   Filter        := "Text Files (*.txt;*.doc)"
    Filter        .= "|Autohotkey Files (*.ahk)"
    Filter        .= "|AutoIT v3 Files (*.au3)"
    Filter        .= "|VisualBasic Script Files (*.vbs)"
    Filter        .= "|All Files (*.*)"

   defaultFilter := 2
   IniDir        := A_WorkingDir
   DialogTitle   := "AHK-Demonstration: Choose your file to OPEN or press Cancel"
   defaultExt    := "txt"

    FileName := DLG_FileSave( HWND
                            , Filter
                            , defaultFilter
                            , InitilisationDir
                            , DialogTitle
                            , defaultExt )
   If !( FileName )
      MsgBox The dialog was cancelled or no Filename chosen
   else
      MsgBox The FileName you selected is:`n%FileName%
return


#Include DLG_FileOpenSave.ahk


Download: http://www.autohotkey.net/~DerRaphael/fileOpenSaveDemo.ahk

Comments, critic, or improvements are welcome Smile
Have Fun!

DerRaphael


    Post-EDIT-History:
    031207 - Added Picture
    031207 - Fixed some minor Typos - included a FlagList and Set Default Flags, Fixed a little bug when working with Umlauts due to Char - is now UChar and works as expected with Umlauts
    031207 - Modified the text a lil' - added flag list
    031207 - Removed a MsgBox - Leftover from Testing
    041207 - Modified Include File and Demo for selecting Multiple Files at once added download
    041207 - Modded Include File, so that flags can now have nearly any format


Last edited by DerRaphael on Tue Dec 04, 2007 2:36 pm; edited 9 times in total
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 3615
Location: Belgrade

PostPosted: Mon Dec 03, 2007 2:26 pm    Post subject: Reply with quote

If you make it compatibile in interface and documentation with CmnDlg, I can add them there, for the sake of complitenes. Then you can add it to lib and have all the system dialogs available, and properly documented. I will eventualy do Print dialog, so all will be covered.

One of the the missing features about integrated dialogs is their position, they always pop from 0,0, and that is pretty awful to solve (u must create timer just for that....). This doesn't happen with your code as it sets correctly hwnd param.
_________________
Back to top
View user's profile Send private message MSN Messenger
DerRaphael



Joined: 23 Nov 2007
Posts: 387
Location: Heidelberg, Germany

PostPosted: Mon Dec 03, 2007 2:30 pm    Post subject: Reply with quote

Thank you for your fast answer Smile

btw, congrats to your 3000th post!

I'll check your lib and make mine fit in there.

Greets,

DerRaphael
Back to top
View user's profile Send private message
DerRaphael



Joined: 23 Nov 2007
Posts: 387
Location: Heidelberg, Germany

PostPosted: Tue Dec 04, 2007 9:31 am    Post subject: Reply with quote

updated my scripts. now its working with multiple fileselections, too.
the example file also shows how to use those funktions. especially the multiselect feat. also try just providing a name withhout extension. its nice Smile
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 3615
Location: Belgrade

PostPosted: Tue Dec 04, 2007 9:54 am    Post subject: Reply with quote

Thx for making proper documentation. It would be also good to take care of the flags. All the flags should be listed (like you did at the end) and you should let user to write string instead some unknown numbers.

I do it this way:

Code:
func(.... flags="EXTENSIONDIFFERENT OVERWRITEPROMPT" .... )
static OFN_EXTENSIONDIFFERENT=1, OFN_OVERWRITEPROMPT=2 ...... ;all flags defined here

   hFlags := 0
   loop, parse, %flags%, %A_TAB%%A_SPACE%, %A_TAB%%A_SPACE%,
      hFlags |= OFN_%A_LoopField%   

  ;then u use hFlags


This leads to functions that are more in AHK spirit and much easier to use.
I can do this for you or u can do it.

I will add those 2 dialogs in CmnDlg if you are finished with features you wanted to add.

Thx, its great to have them all as a module.
Now only Print dialog remains.

Quote:
btw, congrats to your 3000th post!

YEY, I didn't even notice Smile Smile
_________________
Back to top
View user's profile Send private message MSN Messenger
DerRaphael



Joined: 23 Nov 2007
Posts: 387
Location: Heidelberg, Germany

PostPosted: Tue Dec 04, 2007 12:12 pm    Post subject: Reply with quote

thanks, majkinetor for the inspiring feature for passing flags Smile

well, now i think until fixes might be needed for UTF thingy, i think im done.
just updated the include file to have a parser for Attributes. works

what else should i say?

Have Fun

DerRaphael
Back to top
View user's profile Send private message
DerRaphael



Joined: 23 Nov 2007
Posts: 387
Location: Heidelberg, Germany

PostPosted: Tue Dec 04, 2007 3:16 pm    Post subject: Reply with quote

138+ views .. counting and no one, who writes anything .... Crying or Very sad

seems like this aint interesting no one.
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 3615
Location: Belgrade

PostPosted: Tue Dec 04, 2007 3:28 pm    Post subject: Reply with quote

Quote:
seems like this aint interesting no one.

You should learn that this is low-feedback community, in most of the things except gigantic.

As Open dialog is already integrated in AHK (although implementation sucks) you shouldn't expect much interest.

Hell, even the ppl that are interested, usualy don't comment anything, just use.

So, you should get used to that Smile
_________________
Back to top
View user's profile Send private message MSN Messenger
DerRaphael



Joined: 23 Nov 2007
Posts: 387
Location: Heidelberg, Germany

PostPosted: Tue Dec 04, 2007 4:37 pm    Post subject: Reply with quote

majkinetor wrote:
Hell, even the ppl that are interested, usualy don't comment anything, just use.


    Arrow yeah, i know - escpecially when i observer my very own usage profile - but still, you know written just something, AND being sorta new to all this it simply interests me, what other ppl think 'bout this.
    Idea 'd be nice, to have a possibility as thread creator, no only to get a viewed statistic, but also a downloaded one. like some lil counter watching autohotkey.net and enables you to see how often your app/module whatsoever was downloaded.
    Exclamation this 'd be easily created with php for example. even no sql access 'd be needed, since all this could be realized with a .htaccess dir to store the data in, and a caller which reference by plainname and stores in a simple ascii file how many times it was requested. this ascii file 'd be viewed from user.

    Question is it possible to upload php and get it executed on autohotkey server? like index.php or similar?
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5026
Location: imaginationland

PostPosted: Tue Dec 04, 2007 6:02 pm    Post subject: Reply with quote

DerRaphael wrote:
... counter watching autohotkey.net and enables you to see how often your app/module whatsoever was downloaded.
That seems feasible to implement and would be beneficial to many users, so I have noted your request.

majkinetor wrote:
is it possible to upload php and get it executed on autohotkey server? like index.php or similar?
No - for reasons explained in the AutoHotkey.net sticky.

Back on topic... It's very helpful to have small independent functions like this which are not part of huge libraries that take a while getting used to. I have already found use for it, thanks!
_________________

RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2")
Back to top
View user's profile Send private message Visit poster's website
freakkk



Joined: 29 Jul 2005
Posts: 128

PostPosted: Tue Dec 04, 2007 6:33 pm    Post subject: Reply with quote

@DerRaphael
Very useful indeed; very clean interface too. Thanks for sharing!!
Perhaps this is how it should be natively implemented... Very Happy

@Titan
Titan wrote:
majkinetor wrote:
is it possible to upload php and get it executed on autohotkey server? like index.php or similar?
No - for reasons explained in the AutoHotkey.net sticky.

Wrong dude. Rolling Eyes

Titan wrote:
It's very helpful to have small independent functions like this which are not part of huge libraries that take a while getting used to.
I feel quite differently in that department; I am under the impression that the point of a code 'library' is to minimize the learning curve of using a particular api. You get used to calling one dialog.. you can easily understand how to call any of them. I would have thought you were an advocate. Shocked
_________________
.o0[ corey ]0o.
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 3959
Location: Pittsburgh

PostPosted: Tue Dec 04, 2007 7:58 pm    Post subject: Reply with quote

Very nice! I update my backup script with your code, to make it look professional.
DerRaphael wrote:
Seems like this ain’t interesting [to] no one.
Hey, only one day passed. I don’t check the Forum that often, but it got about 200 views, which shows large interest.
Back to top
View user's profile Send private message
DerRaphael



Joined: 23 Nov 2007
Posts: 387
Location: Heidelberg, Germany

PostPosted: Wed Dec 05, 2007 9:36 am    Post subject: Reply with quote

@Laszlo, @freakkk, @Titan, @majkinetor
    Thank you guys for your interest Smile It makes me happy that this lil' function gets at least some attention


btw: i still have a question of how this will work with Unicode. i don't have a clue on how to test this - so if someone willing to test may report or at least give some hints, it'd be really helpful.

Thanks again
derRaphael
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 3959
Location: Pittsburgh

PostPosted: Wed Dec 05, 2007 4:28 pm    Post subject: Reply with quote

To test Unicode:

Save a simple file from Notepad
In Explorer rename it. In the new name field enter ALT-0336 (with the numpad keys), to get a file named Ő, a Unicode char.
In your file select dialog choose it.
The message box of the test program shows the file name as “O”, not “Ő”, that is, Unicode is converted to ANSI.

To handle Unicode:

Filenames should be handled as binary (passed as ByRef).
No processing with AHK’s string functions, but with NumPut, NumGet
Use Shimanov’s Unicode print function (PhilHo adapted it, too) to show the result.
Back to top
View user's profile Send private message
DerRaphael



Joined: 23 Nov 2007
Posts: 387
Location: Heidelberg, Germany

PostPosted: Wed Dec 05, 2007 6:21 pm    Post subject: Reply with quote

@laszlo
    big thanks, dude
    I'll check my script to upgrade the function as soon as my time'll allow it

Very Happy knowledge is king

greetings
derRaphael
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group