Guest unabatedshagie Posted August 13, 2004 Share Posted August 13, 2004 Topic says it all, is it possible to open an hta file from an autoit script? If it's not can anyone think of a way round it. Link to comment Share on other sites More sharing options...
Bartokv Posted August 13, 2004 Share Posted August 13, 2004 If it is a local copy, you should be able to open the file via FileRead.As far as an online copy goes, it depends on the server's settings. You could try using the URLDownloadToFile command to see if you can pull a copy of the source. Link to comment Share on other sites More sharing options...
emmanuel Posted August 13, 2004 Share Posted August 13, 2004 Topic says it all, is it possible to open an hta file from an autoit script? If it's not can anyone think of a way round it. <{POST_SNAPBACK}>you just want it to open on the client machine, like in the default browser? run(@comspec & ' /c start "" "x:\file.hta"' you'll want to look at the start command (start /? from cmd prompt) for your OS to determine if you want that first "" in there or not, in win2k/xp it needs to be there to define the window title. "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
Guest unabatedshagie Posted August 13, 2004 Share Posted August 13, 2004 (edited) The file is on my machine,I use opera and gmail doesn't work with it. I found someone who had made an hta document which opens the gmail page.So I was looking to make a script to open the gmail.hta file and insert my username and password, I just couldn't get the script to open the hta file.I had already tried the run(@comspec & ' /c start "" "x:\file.hta"'but I may have had the syntax wrong because it wouldn't work.I'll give the fileread command a shot and see if it works. You can probably guess I have never used autoit before. I have tried both the methods mentioned here but I still can't get it to work.Here's what I have so farrun(@comspec & ' /c start "GMAIL" "C:\Documents and Settings\USER\Application Data\Opera\Opera\profile\Extras\gmail.hta"' WinActivate("GMAIL") sleep (1000) send ("username") send ("{TAB}") send ("password") send ("{ENTER}")I know from WinActivate down works because I tried it when the hta file was open, I just can't seem to get the opening of the file to work. Edited August 13, 2004 by unabatedshagie Link to comment Share on other sites More sharing options...
Bartokv Posted August 13, 2004 Share Posted August 13, 2004 Ah, it may be a browser limitation or the file type may not be properly registered. First of all, I would recommend that you try right-clicking on the hta file and opening it with Opera. Also, forget trying to use FileRead... I misunderstood what you were wanting when I mentioned it. If Opera knows how to handle hta files, you can try the following snippet: $Browser = "rundll32 url.dll,FileProtocolHandler" $Opera_Path = EnvGet("AppData") & "\Opera\Opera\profile\Extras\" $File = $Opera_Path & "gmail.hta" $Launch = "START /MIN " & $Browser & " " & $File Run(@ComSpec & " /c " & Chr(34) & $Launch & Chr(34), "", @SW_HIDE) WinWaitActive("GMAIL", "", 10) = 0 Then ShowError() Sleep(1000) Send("username{TAB}password{ENTER}") Exit Func ShowError() MsgBox(48, "GMAIL Login", "Warning: Unable to launch browser.") Exit EndFunc I haven't tested this because I don't have Opera, nor the hta file - but it should work. Link to comment Share on other sites More sharing options...
Guest unabatedshagie Posted August 13, 2004 Share Posted August 13, 2004 Well it's one step closer, the hta file opens, now I just get this error message. Link to comment Share on other sites More sharing options...
Bartokv Posted August 13, 2004 Share Posted August 13, 2004 (edited) Oops, forgot the If statement on the WinWaitActive line:$Browser = "rundll32 url.dll,FileProtocolHandler" $Opera_Path = EnvGet("AppData") & "\Opera\Opera\profile\Extras\" $File = $Opera_Path & "gmail.hta" $Launch = "START /MIN " & $Browser & " " & $File Run(@ComSpec & " /c " & Chr(34) & $Launch & Chr(34), "", @SW_HIDE) If WinWaitActive("GMAIL", "", 10) = 0 Then ShowError() Sleep(1000) Send("username{TAB}password{ENTER}") Exit Func ShowError() MsgBox(48, "GMAIL Login", "Warning: Unable to launch browser.") Exit EndFuncThis one should work.Edit: You may need to change the "GMAIL" on the WinWaitActive line to whatever the window title is for the hta file. I'm assuming that it starts with GMAIL. Edited August 13, 2004 by Bartokv Link to comment Share on other sites More sharing options...
Guest unabatedshagie Posted August 13, 2004 Share Posted August 13, 2004 Cool thanks alot 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