Jump to content

Is It Possible


Guest unabatedshagie
 Share

Recommended Posts

Guest unabatedshagie

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

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

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

Guest unabatedshagie

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.

:ph34r: 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 far

run(@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 by unabatedshagie
Link to comment
Share on other sites

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

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
EndFunc

This 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 by Bartokv
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...