Jump to content

Trying To Save A Website When Its Minimized


Recommended Posts

ive looked at other posts and in the help file about sending text to minimized notepad windows and what not, but im trying to open a website (local html file on HD) then send a save as command to save it as a MHT file, all while the document would be minimized... i didn't see any posts about this, i have seen other kinds of hidden doc sending but not somthing with dialog boxes.... can anyone offer assisstance?

i was trying stuff like this

_rundos("start iexplore "&$path&$filename)
$title = wingettitle("")
winsetstate($title,"" , @SW_hide)
controlsend($title,"","","{altdown}f{altup}a"&$filename&"{ENTER}",0)

thats not all th code but the stuff i was trying to send to hidden

thanks

Link to comment
Share on other sites

Could you not use something like this?

FileCopy ( "c:\test.html", "c:\test.mht")
i don't believe so, im trying to open a web site that will have pictures in it, and then save it as a mht so the pictures are attached to the page, saving a html as a mht doesn't do this
Link to comment
Share on other sites

  • Moderators

I've got it this far, now maybe Dale can help you from here.

Here is the SaveAs command, but I have no idea on how to add the string for the path.

#include <IE.au3>
$oIE = _IECreate()
_IENavigate ($oIE, "http://google.com")
_IEAction2($oIE, "SaveAs")

 Func _IEAction2($o_object, $s_action)
    If IsObj($o_object) Then
        $s_action = StringLower($s_action)
        Select        
           Case $s_action = "saveas"
                $o_object.document.execCommand ("SaveAs")
                SetError(0)
                Return 1
        EndSelect
    Else
        SetError(1)
        Return 0
    EndIf
EndFunc ;==>_IEAction2
Edited by big_daddy
Link to comment
Share on other sites

ive looked at other posts and in the help file about sending text to minimized notepad windows and what not, but im trying to open a website (local html file on HD) then send a save as command to save it as a MHT file, all while the document would be minimized... i didn't see any posts about this, i have seen other kinds of hidden doc sending but not somthing with dialog boxes.... can anyone offer assisstance?

i was trying stuff like this

_rundos("start iexplore "&$path&$filename)
$title = wingettitle("")
winsetstate($title,"" , @SW_hide)
controlsend($title,"","","{altdown}f{altup}a"&$filename&"{ENTER}",0)

thats not all th code but the stuff i was trying to send to hidden

thanks

it looks like you're trying to use controlsend without specifying a control id, classname, etc to identify the actual control to receive the text. although there was a time (8 months or so ago) when this was suggested quite profusely on the forums, when people actually tried it none were successful. i think that the method bigd suggests will actually get you a filesavedialog on screen, but that may be the easiest way to go.
Link to comment
Share on other sites

I've got it this far, now maybe Dale can help you from here.

Here is the SaveAs command, but I have no idea on how to add the string for the path.

#include <IE.au3>
$oIE = _IECreate()
_IENavigate ($oIE, "http://google.com")
_IEAction2($oIE, "SaveAs")

 Func _IEAction2($o_object, $s_action)
    If IsObj($o_object) Then
        $s_action = StringLower($s_action)
        Select        
           Case $s_action = "saveas"
                $o_object.document.execCommand ("SaveAs")
                SetError(0)
                Return 1
        EndSelect
    Else
        SetError(1)
        Return 0
    EndIf
EndFunc;==>_IEAction2
Nice try... the SaveAs actually has a MSOCMDEXECOPT_DONTPROMPTUSER parameter that can be sent along with it, but for security reasons it is a NO-OP. There is no way to do this silently I'm afraid -- you'll need to use SEND to send keystrokes to automate the SaveAs dialog. It's frustrating, but it is this way for a good reason.

I haven't looked into this, but if you are really motivated, there is a chance that this could work with an HTML Application (.hta instead of .htm) because the security model is relaxed.

Dale

(you can dig up more information about all of this by searching for ExecWB and IDM_SAVEAS)

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • Moderators

Nice try... the SaveAs actually has a MSOCMDEXECOPT_DONTPROMPTUSER parameter that can be sent along with it, but for security reasons it is a NO-OP. There is no way to do this silently I'm afraid -- you'll need to use SEND to send keystrokes to automate the SaveAs dialog. It's frustrating, but it is this way for a good reason.

I haven't looked into this, but if you are really motivated, there is a chance that this could work with an HTML Application (.hta instead of .htm) because the security model is relaxed.

Dale

(you can dig up more information about all of this by searching for ExecWB and IDM_SAVEAS)

I don't see where the SaveAs command that I provided a link to has an MSOCMDEXECOPT_DONTPROMPTUSER parameter. The IDM_SAVEAS does, but that is something totally different. I don't know much about any of this stuff yet, but I guess it just looked pretty easy to specify the path.
Link to comment
Share on other sites

I don't see where the SaveAs command that I provided a link to has an MSOCMDEXECOPT_DONTPROMPTUSER parameter. The IDM_SAVEAS does, but that is something totally different. I don't know much about any of this stuff yet, but I guess it just looked pretty easy to specify the path.

Sorry, I should have been more clear. The IE.au3 function does not have that parameter, but the low-level call behind it all does (there are multiple ways to call it as it turns out). In any case, altough it is documented, it does not work and was disabled by Microsoft for security reasons.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • Moderators

Sorry, I should have been more clear. The IE.au3 function does not have that parameter, but the low-level call behind it all does (there are multiple ways to call it as it turns out). In any case, altough it is documented, it does not work and was disabled by Microsoft for security reasons.

Dale

Thanks for clarifying.
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...