superstylink Posted July 8, 2004 Share Posted July 8, 2004 Hi I'm a php programmer first time playng with autoit , I think it's coll but I've some problem trying to strat an excel file with a macro insed I've customized the one in the help file buit it doens't work , the ese I creted is in the same dir of excel file ... any help thanx in advance this is the code , $file = FileOpen("events.xls", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileClose($file) Link to comment Share on other sites More sharing options...
Developers Jos Posted July 8, 2004 Developers Share Posted July 8, 2004 (edited) Hi I'm a php programmer first time playng with autoit , I think it's coll but I've some problem trying to strat an excel file with a macro insed I've customized the one in the help file buit it doens't work , the ese I creted is in the same dir of excel file ... any help thanx in advance this is the code , $file = FileOpen("events.xls", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileClose($file)Think you want to open the file with Excel .... right ? try running the file with start or run Excel.exe .... Edited July 8, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
emmanuel Posted July 8, 2004 Share Posted July 8, 2004 yeah, to add to what jdeb said, FileOpen is just for opening text files for AutoIt to proccess... run("c:\prg files\office\excel.exe c:\mydocs\file.xls") should open the file... "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
superstylink Posted July 8, 2004 Author Share Posted July 8, 2004 ciao JdeB and thanx for your fast answer yes I like to run the events.xls file but the macro I created in it run it in hide way and create a csv in a different directory , is it possible use this snippet to run excel file as the txt file in the example Link to comment Share on other sites More sharing options...
Developers Jos Posted July 8, 2004 Developers Share Posted July 8, 2004 ciao JdeB and thanx for your fast answeryes I like to run the events.xls file but the macro I created in it run it in hide way and create a csv in a different directory , is it possible use this snippet to run excel file as the txt file in the exampleprego...but i am somewhat puzzled what it is you want to accomplish here.could you explain again which steps you want to do in the script ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
superstylink Posted July 8, 2004 Author Share Posted July 8, 2004 very easy I created a macro in vb insiede an excel file it does a webquery and save in a different directory a csv file well my macro end s here all the job its done in hidden window command now with autoit I like to do an exe that call this macro inside result.xls file that's all I used the cose snippet openfile function but it doesn't work Link to comment Share on other sites More sharing options...
Developers Jos Posted July 8, 2004 Developers Share Posted July 8, 2004 when you run excel like emmanuel suggest, won't that work ? In other words, does your macro automatically start up when events.xls is openend, and close the Excel file when finished ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
emmanuel Posted July 8, 2004 Share Posted July 8, 2004 if the macro doesn't autostart, you could set a hotkey for it (in excel)and then send that hotkey from autoit... "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
superstylink Posted July 8, 2004 Author Share Posted July 8, 2004 yes I try what emmanuel suggested but I 've this error error: unable to execute the external program but before it fired up excel application so the problem is the singlòe file not the application Link to comment Share on other sites More sharing options...
emmanuel Posted July 8, 2004 Share Posted July 8, 2004 (edited) can you show the code that failed? these failures are most often caused by syntax problems... Edited July 8, 2004 by emmanuel "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
superstylink Posted July 8, 2004 Author Share Posted July 8, 2004 yes emanuel my macro has Auto_Open() function and hidden window command and my excel is setted to run macro in auto Link to comment Share on other sites More sharing options...
superstylink Posted July 8, 2004 Author Share Posted July 8, 2004 run("C:\Programmi\Microsoft Office\OFFICE11\EXCEL.EXE C:\Programmi\Q2 Tuner\data\results.xls") Link to comment Share on other sites More sharing options...
emmanuel Posted July 8, 2004 Share Posted July 8, 2004 This might help, I bet the Run command isn't liking the spaces, so we use some creative double quotesrun('"C:\Programmi\Microsoft Office\OFFICE11\EXCEL.EXE" "C:\Programmi\Q2 Tuner\data\results.xls"') The single quotes on the outside make it all one run command for autoit to send, and the double quotes inside help windows figure out what you're doing... "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
superstylink Posted July 9, 2004 Author Share Posted July 9, 2004 thanx a lot guys now it works perfect ;-) , maybe it was a escape like problem as u u told me . I 'd like to to read some advanced tuts coud u tell me where I can find some snippet or tutorial about autoit programming ciao Link to comment Share on other sites More sharing options...
emmanuel Posted July 9, 2004 Share Posted July 9, 2004 browse the scripts and scraps section, the autoit install includes an examples folder and the includes are good for more advanced examples... "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
RocTx Posted July 9, 2004 Share Posted July 9, 2004 Emmanuel.. your explanation of the use of 'quotes' and "double quotes" is the best I have seen to explain their use. Now it all makes sense.. the light just came on. Thanks. Link to comment Share on other sites More sharing options...
emmanuel Posted July 9, 2004 Share Posted July 9, 2004 Emmanuel.. your explanation of the use of 'quotes' and "double quotes" is the best I have seen to explain their use. Now it all makes sense.. the light just came on. Thanks.glad to have helped! "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
superstylink Posted July 10, 2004 Author Share Posted July 10, 2004 HI guys I'm implementing another piece of code on my little utility as I told u my prog create 2 csv file in a backup directory weel this task is ok now as I told , now I'm trying to implement a progress bar window that stops when the 2 file are created this is my meta code ------------------------ $firstcsv=namefirstcsv.csv $secondcsv=namesecondcsv.csv while // loop ($firstcsv !=0 $seconcsv !=0) { ProgressOn("my progress window", "creating csv files ", "0 percent") ProgressOff()} ----------------------- any suggestion on how to do it in autoit coding syntax? TIA 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