nguyenbason Posted June 19, 2009 Share Posted June 19, 2009 (edited) I have following code: expandcollapse popup#include <File.au3> #Include <Array.au3> Opt("GUIoneventmode",1) HotKeySet("{ESC}","_exit") ;Check startup param for default action If $CmdLine[$CmdLine[0]] <> "0" Then $GetEXT = StringSplit($CmdLine[$CmdLine[0]],"\") $Ext = StringSplit($GetEXT[$GetEXT[0]],".") If $Ext[$Ext[0]] = "txt"Then _Open($CmdLine[$CmdLine[0]]) EndIf EndIf #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Test fuction", 153, 73, -1, -1) $Button = GUICtrlCreateButton("Open File", 20, 24, 113, 25) GUICtrlSetOnEvent(-1,"_Read") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func _Read() $File = FileOpenDialog("Open a file",@MyDocumentsDir,"Text file only (*.txt)") _Open($File) EndFunc Func _Open($FileName) Dim $aArray _FileReadToArray($FileName,$aArray) _ArrayDisplay($aArray) EndFunc Func _Exit() Exit EndFunc But if i click on a text file and choose "Open with" with my program then how can i set it default action is _Open()? Thanks, Edited June 20, 2009 by nguyenbason UnderWorldVN- Just play the way you like it Link to comment Share on other sites More sharing options...
nguyenbason Posted June 19, 2009 Author Share Posted June 19, 2009 Still looking for the help UnderWorldVN- Just play the way you like it Link to comment Share on other sites More sharing options...
November Posted June 19, 2009 Share Posted June 19, 2009 Code please Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
nguyenbason Posted June 20, 2009 Author Share Posted June 20, 2009 Code pleaseEdited on the first post. Check it out please. Hope you are all understanding my question. Thanks UnderWorldVN- Just play the way you like it Link to comment Share on other sites More sharing options...
nguyenbason Posted June 20, 2009 Author Share Posted June 20, 2009 (edited) Resolved by adding following code at the nearly top of the code (Edited to first post) to check command line param: If $CmdLine[$CmdLine[0]] <> "0" Then $GetEXT = StringSplit($CmdLine[$CmdLine[0]],"\") $Ext = StringSplit($GetEXT[$GetEXT[0]],".") If $Ext[$Ext[0]] = "txt"Then _Open($CmdLine[$CmdLine[0]]) EndIf EndIf Thanks for your attention Edited June 20, 2009 by nguyenbason UnderWorldVN- Just play the way you like it 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