Sign in to follow this  
Followers 0
Guest hhravn

Open with OS default action

7 posts in this topic

Is there a way to open a file with the OS default action? I have a list of mixed dirs and files, and would like to open them with the correct app on doubleclick. Right now i use

Run ('explorer ' & $ret)

Another thing: How do i react on doubleclick on listitems instead of normal click/select. The list displays some search results, and right now the files are executed on select :S

Share this post


Link to post
Share on other sites



This works on XP, not sure how far back the start command goes:

Run(@ComSpec & " /c start c:\temp\test.txt","",@SW_HIDE)

Don't know about the other thing...


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Autoit unfortunately doesnt seperate the click and double click actions... Whatever does with single click will do with double click too... Search for any UDF's that might be using external DLL's to achieve that...I dont have any in mind but search....

Share this post


Link to post
Share on other sites

From CyberSlug:

#include <GUIConstants.au3>

GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF); will change background color

$listview = GUICtrlCreateListView ("col1  |col2|col3  ",10,10,200,150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton ("Value?",75,170,70,20)
$item1=GUICtrlCreateListViewItem("item2|col22|col23",$listview)
$item2=GUICtrlCreateListViewItem("item1|col12|col13",$listview)
$item3=GUICtrlCreateListViewItem("item3|col32|col33",$listview)
$input1=GUICtrlCreateInput("",20,200, 150)
GUICtrlSetState(-1,$GUI_ACCEPTFILES); to allow drag and dropping
GUISetState()
GUICtrlSetData($item2,"ITEM1",)
GUICtrlSetData($item3,"||COL33",)
GUICtrlDelete($item1)

$THRESHOLD = Number( RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "DoubleClickSpeed") )
Dim $TIMER = 0

Do
  $msg = GUIGetMsg ()
      
   Select
      Case $msg = $button
         MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)
      Case $msg = $listview
         MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview),2)
     EndSelect
    
    If $msg = $GUI_EVENT_PRIMARYDOWN Then
        If $TIMER = 0 Then
            $TIMER = TimerInit()
        ElseIf TimerDiff($TIMER) <= $THRESHOLD Then
            MsgBox(4096,"", "DoubleClick Detected")
        Else
            $TIMER = 0
        EndIf
    EndIf
Until $msg = $GUI_EVENT_CLOSE

It's a little rusty... You'll notice how it catches a double click anywhere on the gui, not just the list... And sometimes you have to click 2 times really fast, and 1 slow... But it's the best I've seen yet...


FootbaG

Share this post


Link to post
Share on other sites

Is there a way to open a file with the OS default action? I have a list of mixed dirs and files, and would like to open them with the correct app on doubleclick. Right now i use

Run ('explorer ' & $ret)

Another thing: How do i react on doubleclick on listitems instead of normal click/select. The list displays some search results, and right now the files are executed on select :S

Bit late but just read this thread. Using Rundll32.exe and url.dll call FileProtocolHandler. Note: only one space between Rundll32.exe Url,FileProtocolHandler and path\file.

Run (C:\Windows\System32\Rundll32.exe Url,FileProtocolHandler C:\a_textfile.txt)

FileProtocolHandler will not load .msc files, use mmc.exe instead

Run(C:\Windows\system32\mmc.exe C:\windows\system32\services.msc /s)

Hope this helps

Share this post


Link to post
Share on other sites

in theory _InetBrowse (see the sig) should be able

to run evrything on option 0-2-3

Nice. I have yet to play with ShellExecute, will take a look at it.

So far Rundll32.exe Url,FileProtocolHandler has met my needs but you never know.

Thanks

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0