mini Posted March 11, 2011 Share Posted March 11, 2011 (edited) Hello all. Its been quite some time I don't use AutoIT. Well, only the button "Open" and "Fechar" are working, my main problem now is, I am not been able to "execute/open" a Excel file that already exists. I can select it, but can't make it to open like double clicking. Here's my code, hope that some one can help me. Thanks in advance, mini. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Excel.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Dialog", 368, 203) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore") $Procurar = GUICtrlCreateButton("&Procurar", 285, 11, 75, 25, $WS_GROUP) GUICtrlSetOnEvent(-1, "Procurar") $Adicionar = GUICtrlCreateButton("&Adicionar", 285, 44, 75, 25, $WS_GROUP) GUICtrlSetOnEvent(-1, "Adicionar") $Fechar = GUICtrlCreateButton("&Fechar", 285, 76, 75, 25, $WS_GROUP) GUICtrlSetOnEvent(-1, "Fechar") $Open = GUICtrlCreateButton("&Open", 285, 105, 75, 25, $WS_GROUP) GUICtrlSetOnEvent(-1, "_Open") $Edit1 = GUICtrlCreateEdit("", 8, 8, 273, 185) GUICtrlSetData(-1, "Edit1") GUICtrlSetOnEvent(-1, "Edit1Change") $Input1 = GUICtrlCreateInput("Modelo", 288, 136, 73, 21) GUICtrlSetOnEvent(-1, "Input1Change") $DB_Dir = GUICtrlCreateInput("", 288, 136, 1, 1) GUICtrlSetOnEvent(-1, "Input1Change") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Dim $File While 1 Sleep(100) WEnd Func Procurar() EndFunc ;==>Procurar Func Adicionar() EndFunc ;==>Adicionar Func _Open() ;~ $File = FileOpenDialog("Abrir ficheiro DB", "", "(*.xls;*.xlsx;*.xlsm)") $File = FileOpenDialog(@ScriptDir & "\", "", "(*.xls;*.xlsx;*.xlsm)") If FileExists($File) Then GUICtrlSetData($Input1, $File) Else Run(GUICtrlRead($Input1)) EndIf ;~ $File = FileOpenDialog("Abrir ficheiro DB", "", "Ficheiros Excell(*.xls;*.xlsx;*.xlsm)") ;~ If FileExists($File) Then ;~ GUICtrlSetData($Input1, $File) ;~ Sleep (5000) ;~ _Abrir() ;~ EndIf EndFunc ;==>_Open ;~ Func _Abrir() ;~ run("excel.exe") ;~ EndFunc ;==>_Abrir Func Fechar() $answer = MsgBox(36, "Aviso", "Quer mesmo sair?", 8) If $answer = 6 Then Exit EndIf EndFunc ;==>Fechar Func Edit1Change() EndFunc ;==>Edit1Change Func Form1Close() $answer = MsgBox(36, "Aviso", "Quer mesmo sair?", 8) If $answer = 6 Then Exit EndIf EndFunc ;==>Form1Close Func Form1Maximize() EndFunc ;==>Form1Maximize Func Form1Minimize() EndFunc ;==>Form1Minimize Func Form1Restore() EndFunc ;==>Form1Restore Func Input1Change() EndFunc ;==>Input1Change Edited March 12, 2011 by mini [size="4"]My first work[/size], it checks if one prograrm is running and if not it closes all necessery windows and run them again.[size="4"]My second work[/size], Script Function: It saves a Client Info and creates a INI file for all clients with all the info.[size="4"]My third work[/size], Script Function: It change some INFO on a working program, every X min configured. Link to comment Share on other sites More sharing options...
bogQ Posted March 11, 2011 Share Posted March 11, 2011 (edited) $File = FileOpenDialog(@ScriptDir & "\", "", "(*.xls;*.xlsx;*.xlsm)",1) If Not @error Then GUICtrlSetData($Input1, $File) ;~ ShellExecute(GUICtrlRead($Input1)) ShellExecute($File) EndIf Edited March 11, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
mini Posted March 12, 2011 Author Share Posted March 12, 2011 Thank you very much. [size="4"]My first work[/size], it checks if one prograrm is running and if not it closes all necessery windows and run them again.[size="4"]My second work[/size], Script Function: It saves a Client Info and creates a INI file for all clients with all the info.[size="4"]My third work[/size], Script Function: It change some INFO on a working program, every X min configured. 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