richietheprogrammer1 0 Posted October 23, 2010 (edited) Hello, I am trying to run a program using @SW-HIDE, and I need to save from inside the program, also in the save mode. The code: run("IE.exe","",@SW_HIDE) winactivate("Internet") send("^s") When it executes send("^s") , the save as window comes up. Is there a way to save without showing the window? Any help is much apreciated thanks! Edited October 24, 2010 by richietheprogrammer1 Share this post Link to post Share on other sites
hessebou 0 Posted October 23, 2010 instead of winactivate and send use this: ControlSend ( "title", "text", controlID, "string" [, flag] ) Share this post Link to post Share on other sites
richietheprogrammer1 0 Posted October 23, 2010 (edited) instead of winactivate and send use this: ControlSend ( "title", "text", controlID, "string" [, flag] ) Thanks for the quick reply. Even if I do that, once it does control s, it shows the save as window. Edited October 23, 2010 by richietheprogrammer1 Share this post Link to post Share on other sites
richietheprogrammer1 0 Posted October 23, 2010 Thanks for the quick reply. Even if I do that, once it does control s, it shows the save as window. Im sorry I pasted my code wrong. Here is my code: run("IE.exe","",@SW_HIDE) winactivate("Internet Explorer") send("^s") Share this post Link to post Share on other sites
wolf9228 70 Posted October 24, 2010 expandcollapse popup#include <IE.au3> #Include <WinAPI.au3> $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $UserName = "UserName" $PassWord = "PassWord" $oIE = _IECreate ("http://www.autoitscript.com/forum/index.php?app=core&module=global§ion=login",0,0) $UserNameInput = GetObject($oIE,"input","username","text") $g_eventerror = 0 $PassWordInput = GetObject($oIE,"input","password","password") $g_eventerror = 0 $input_submit = GetObject($oIE,"input","","submit","Sign In") _IEFormElementSetValue ($UserNameInput,$UserName) _IEFormElementSetValue ($PassWordInput,$PassWord) $input_submit.click $hwnd = _IEPropertyGet($oIE, "hwnd") MsgBox(0,"MSG","SW_SHOW") _WinAPI_ShowWindow($hWnd,@SW_SHOW) Func GetObject($oIE,$tagName,$Name = "",$Type = "",$value = "",$Id = "") Local $BOOL1 = 1, $BOOL2 = 1 , $BOOL3 = 1 , $BOOL4 = 1 , $BOOL5 = 1 for $i = 0 To $oIE.document.all.length - 1 $BOOL1 = StringUpper($oIE.document.all($i).tagName) == StringUpper($tagName) if ($BOOL1) And $Name == "" And $Type == "" And $id == "" And $value == "" _ Then Return $oIE.document.all($i) if ($BOOL1) And $Name <> "" Then $BOOL2 = StringUpper($oIE.document.all($i).Name) == StringUpper($Name) if ($BOOL2) And $Type == "" And $Id == "" And $value == "" Then Return $oIE.document.all($i) EndIf if ($BOOL1) And $Type <> "" Then $BOOL3 = StringUpper($oIE.document.all($i).Type) == StringUpper($Type) if ($BOOL3) And $Name == "" And $Id == "" And $value == "" Then Return $oIE.document.all($i) EndIf if ($BOOL1) And $value <> "" Then $BOOL5 = StringUpper($oIE.document.all($i).value) == StringUpper($value) if ($BOOL5) And $Name == "" And $Type == "" And $Id == "" Then Return $oIE.document.all($i) EndIf if ($BOOL1) And $Id <> "" Then $BOOL4 = StringUpper($oIE.document.all($i).id) == StringUpper($Id) if ($BOOL4) And $Name == "" And $Type == "" And $value == "" Then Return $oIE.document.all($i) EndIf if $BOOL1 And $BOOL2 And $BOOL3 And $BOOL4 And $BOOL5 Then Return $oIE.document.all($i) Next Return 0 EndFunc Func MyErrFunc() Endfunc ØµØ±Ø Ø§Ù„Ø³Ù…Ø§Ø¡ كان هنا Share this post Link to post Share on other sites
richietheprogrammer1 0 Posted October 24, 2010 (edited) expandcollapse popup#include <IE.au3> #Include <WinAPI.au3> $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $UserName = "UserName" $PassWord = "PassWord" $oIE = _IECreate ("http://www.autoitscript.com/forum/index.php?app=core&module=global§ion=login",0,0) $UserNameInput = GetObject($oIE,"input","username","text") $g_eventerror = 0 $PassWordInput = GetObject($oIE,"input","password","password") $g_eventerror = 0 $input_submit = GetObject($oIE,"input","","submit","Sign In") _IEFormElementSetValue ($UserNameInput,$UserName) _IEFormElementSetValue ($PassWordInput,$PassWord) $input_submit.click $hwnd = _IEPropertyGet($oIE, "hwnd") MsgBox(0,"MSG","SW_SHOW") _WinAPI_ShowWindow($hWnd,@SW_SHOW) Func GetObject($oIE,$tagName,$Name = "",$Type = "",$value = "",$Id = "") Local $BOOL1 = 1, $BOOL2 = 1 , $BOOL3 = 1 , $BOOL4 = 1 , $BOOL5 = 1 for $i = 0 To $oIE.document.all.length - 1 $BOOL1 = StringUpper($oIE.document.all($i).tagName) == StringUpper($tagName) if ($BOOL1) And $Name == "" And $Type == "" And $id == "" And $value == "" _ Then Return $oIE.document.all($i) if ($BOOL1) And $Name <> "" Then $BOOL2 = StringUpper($oIE.document.all($i).Name) == StringUpper($Name) if ($BOOL2) And $Type == "" And $Id == "" And $value == "" Then Return $oIE.document.all($i) EndIf if ($BOOL1) And $Type <> "" Then $BOOL3 = StringUpper($oIE.document.all($i).Type) == StringUpper($Type) if ($BOOL3) And $Name == "" And $Id == "" And $value == "" Then Return $oIE.document.all($i) EndIf if ($BOOL1) And $value <> "" Then $BOOL5 = StringUpper($oIE.document.all($i).value) == StringUpper($value) if ($BOOL5) And $Name == "" And $Type == "" And $Id == "" Then Return $oIE.document.all($i) EndIf if ($BOOL1) And $Id <> "" Then $BOOL4 = StringUpper($oIE.document.all($i).id) == StringUpper($Id) if ($BOOL4) And $Name == "" And $Type == "" And $value == "" Then Return $oIE.document.all($i) EndIf if $BOOL1 And $BOOL2 And $BOOL3 And $BOOL4 And $BOOL5 Then Return $oIE.document.all($i) Next Return 0 EndFunc Func MyErrFunc() Endfunc Thanks, but I do not think this is what I need. Also, it is not an internet explorer window, it is another program. The question is how can I do things like ctrl s inside a window that is running in hidden mode. Thanks! Edited October 24, 2010 by richietheprogrammer1 Share this post Link to post Share on other sites
Richard Robertson 187 Posted October 24, 2010 You can't force the save dialog to be hidden. The OS will show it due to the function call that creates it. Share this post Link to post Share on other sites
richietheprogrammer1 0 Posted October 24, 2010 You can't force the save dialog to be hidden. The OS will show it due to the function call that creates it.Thanks for this info. Although can you explain what the difference is between the ability to hide the program itself but not the save as window or any similar windows launched in terms of the OS? Thanks again. Share this post Link to post Share on other sites
Richard Robertson 187 Posted October 24, 2010 The save dialog is a new window. It is created for the user to input the file to save to. There is no reason this window would ever be created hidden. Share this post Link to post Share on other sites
somdcomputerguy 103 Posted October 24, 2010 It would be useless to create a hidden, or to hide a, 'save as' dialog window, as that window expects user input.. Why not go with 'Save', instead of 'Save As'? - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change. Share this post Link to post Share on other sites
richietheprogrammer1 0 Posted October 24, 2010 It would be useless to create a hidden, or to hide a, 'save as' dialog window, as that window expects user input.. Why not go with 'Save', instead of 'Save As'?Here is why: let's say you have a program that reads data from somewhere once you open it, and you want to save the data and send it to somebody. I want to script the process. So I want to make the program run, save the data automatically, with nothing showing. So far I was able to launch that program silently (hidden). When you hit ctr s, you have to choose the path. So there is no way I can automatically call it "test.txt" or whatever and save it without showing the save as window? I find that strange. Share this post Link to post Share on other sites
somdcomputerguy 103 Posted October 24, 2010 I see. With a new file, a 'save' dialog is not available since the file sortof doesn't really exist yet. - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change. Share this post Link to post Share on other sites
richietheprogrammer1 0 Posted October 24, 2010 I see. With a new file, a 'save' dialog is not available since the file sortof doesn't really exist yet.Exactly, It is kind of like opening notepad, writing something , hitting ctr s, it will open the save as window . What are my options here? Thanks for your help so far Share this post Link to post Share on other sites
Richard Robertson 187 Posted October 24, 2010 The point remains there's no way to prevent it from showing. Just Send("test.txt{ENTER}") or something when the window appears. Share this post Link to post Share on other sites
richietheprogrammer1 0 Posted October 24, 2010 The point remains there's no way to prevent it from showing. Just Send("test.txt{ENTER}") or something when the window appears.That is what I am doing now. I was just thinking about this, and I wonder: There has to be a way to make the save as window act like it is a seperate program. Or maybe create a program that acts the same way as that save as window, and hide it. Any thoughts about that? Share this post Link to post Share on other sites
wolf9228 70 Posted October 25, 2010 (edited) Thanks, but I do not think this is what I need. Also, it is not an internet explorer window, it is another program. The question is how can I do things like ctrl s inside a window that is running in hidden mode. Thanks! #Include <WinAPI.au3> #include <WindowsConstants.au3> $PID = run("Example.exe","",@SW_HIDE) Dim $BOOL = False , $hWnd $begin = TimerInit() While 1 $var = WinList() For $i = 1 To $var[0][0] $iPID = WinGetProcess($var[$i][1]) if $PID = $iPID Then $hWnd = $var[$i][1] $BOOL = True ExitLoop EndIf Next if $BOOL = True Or TimerDiff($begin) > 60000 Then ExitLoop WEnd MsgBox(0,"MSG","SW_SHOW") _WinAPI_ShowWindow($hWnd,@SW_SHOW) or expandcollapse popup#include <IE.au3> #Include <WinAPI.au3> #include <WindowsConstants.au3> $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $UserName = "UserName" $PassWord = "PassWord" $PID = run("C:\Program Files\Internet Explorer\iexplore.exe","",@SW_HIDE) $BOOL = False $begin = TimerInit() While 1 $var = WinList() For $i = 1 To $var[0][0] $iPID = WinGetProcess($var[$i][1]) if $PID = $iPID Then $oIE = _IEAttach ($var[$i][1],"HWND") if IsObj($oIE) Then _IELoadWait ($oIE) $BOOL = True ExitLoop EndIf EndIf Next if $BOOL = True Or TimerDiff($begin) > 60000 Then ExitLoop WEnd if $BOOL = True Then _IENavigate ($oIE,"http://www.autoitscript.com/forum/index.php?app=core&module=global§ion=login") $UserNameInput = GetObject($oIE,"input","username","text") $PassWordInput = GetObject($oIE,"input","password","password") $input_submit = GetObject($oIE,"input","","submit","Sign In") if IsObj($UserNameInput) Then $UserNameInput.Value = $UserName if IsObj($PassWordInput) Then $PassWordInput.Value = $PassWord ;if IsObj($input_submit) Then $input_submit.click MsgBox(0,"MSG","SW_SHOW") _WinAPI_ShowWindow($var[$i][1],@SW_SHOW) EndIf Func GetObject($oIE,$tagName,$Name = "",$Type = "",$value = "",$Id = "") Local $BOOL1 = 1, $BOOL2 = 1 , $BOOL3 = 1 , $BOOL4 = 1 , $BOOL5 = 1 for $i = 0 To $oIE.document.all.length - 1 $BOOL1 = StringUpper($oIE.document.all($i).tagName) == StringUpper($tagName) if ($BOOL1) And $Name == "" And $Type == "" And $id == "" And $value == "" _ Then Return $oIE.document.all($i) if ($BOOL1) And $Name <> "" Then $BOOL2 = StringUpper($oIE.document.all($i).Name) == StringUpper($Name) if ($BOOL2) And $Type == "" And $Id == "" And $value == "" Then Return $oIE.document.all($i) EndIf if ($BOOL1) And $Type <> "" Then $BOOL3 = StringUpper($oIE.document.all($i).Type) == StringUpper($Type) if ($BOOL3) And $Name == "" And $Id == "" And $value == "" Then Return $oIE.document.all($i) EndIf if ($BOOL1) And $value <> "" Then $BOOL5 = StringUpper($oIE.document.all($i).value) == StringUpper($value) if ($BOOL5) And $Name == "" And $Type == "" And $Id == "" Then Return $oIE.document.all($i) EndIf if ($BOOL1) And $Id <> "" Then $BOOL4 = StringUpper($oIE.document.all($i).id) == StringUpper($Id) if ($BOOL4) And $Name == "" And $Type == "" And $value == "" Then Return $oIE.document.all($i) EndIf if $BOOL1 And $BOOL2 And $BOOL3 And $BOOL4 And $BOOL5 Then Return $oIE.document.all($i) Next Return 0 EndFunc Func MyErrFunc() Endfunc Edited October 25, 2010 by wolf9228 ØµØ±Ø Ø§Ù„Ø³Ù…Ø§Ø¡ كان هنا Share this post Link to post Share on other sites
richietheprogrammer1 0 Posted October 25, 2010 #Include <WinAPI.au3> #include <WindowsConstants.au3> $PID = run("Example.exe","",@SW_HIDE) Dim $BOOL = False , $hWnd $begin = TimerInit() While 1 $var = WinList() For $i = 1 To $var[0][0] $iPID = WinGetProcess($var[$i][1]) if $PID = $iPID Then $hWnd = $var[$i][1] $BOOL = True ExitLoop EndIf Next if $BOOL = True Or TimerDiff($begin) > 60000 Then ExitLoop WEnd MsgBox(0,"MSG","SW_SHOW") _WinAPI_ShowWindow($hWnd,@SW_SHOW) or expandcollapse popup#include <IE.au3> #Include <WinAPI.au3> #include <WindowsConstants.au3> $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $UserName = "UserName" $PassWord = "PassWord" $PID = run("C:\Program Files\Internet Explorer\iexplore.exe","",@SW_HIDE) $BOOL = False $begin = TimerInit() While 1 $var = WinList() For $i = 1 To $var[0][0] $iPID = WinGetProcess($var[$i][1]) if $PID = $iPID Then $oIE = _IEAttach ($var[$i][1],"HWND") if IsObj($oIE) Then _IELoadWait ($oIE) $BOOL = True ExitLoop EndIf EndIf Next if $BOOL = True Or TimerDiff($begin) > 60000 Then ExitLoop WEnd if $BOOL = True Then _IENavigate ($oIE,"http://www.autoitscript.com/forum/index.php?app=core&module=global§ion=login") $UserNameInput = GetObject($oIE,"input","username","text") $PassWordInput = GetObject($oIE,"input","password","password") $input_submit = GetObject($oIE,"input","","submit","Sign In") if IsObj($UserNameInput) Then $UserNameInput.Value = $UserName if IsObj($PassWordInput) Then $PassWordInput.Value = $PassWord ;if IsObj($input_submit) Then $input_submit.click MsgBox(0,"MSG","SW_SHOW") _WinAPI_ShowWindow($var[$i][1],@SW_SHOW) EndIf Func GetObject($oIE,$tagName,$Name = "",$Type = "",$value = "",$Id = "") Local $BOOL1 = 1, $BOOL2 = 1 , $BOOL3 = 1 , $BOOL4 = 1 , $BOOL5 = 1 for $i = 0 To $oIE.document.all.length - 1 $BOOL1 = StringUpper($oIE.document.all($i).tagName) == StringUpper($tagName) if ($BOOL1) And $Name == "" And $Type == "" And $id == "" And $value == "" _ Then Return $oIE.document.all($i) if ($BOOL1) And $Name <> "" Then $BOOL2 = StringUpper($oIE.document.all($i).Name) == StringUpper($Name) if ($BOOL2) And $Type == "" And $Id == "" And $value == "" Then Return $oIE.document.all($i) EndIf if ($BOOL1) And $Type <> "" Then $BOOL3 = StringUpper($oIE.document.all($i).Type) == StringUpper($Type) if ($BOOL3) And $Name == "" And $Id == "" And $value == "" Then Return $oIE.document.all($i) EndIf if ($BOOL1) And $value <> "" Then $BOOL5 = StringUpper($oIE.document.all($i).value) == StringUpper($value) if ($BOOL5) And $Name == "" And $Type == "" And $Id == "" Then Return $oIE.document.all($i) EndIf if ($BOOL1) And $Id <> "" Then $BOOL4 = StringUpper($oIE.document.all($i).id) == StringUpper($Id) if ($BOOL4) And $Name == "" And $Type == "" And $value == "" Then Return $oIE.document.all($i) EndIf if $BOOL1 And $BOOL2 And $BOOL3 And $BOOL4 And $BOOL5 Then Return $oIE.document.all($i) Next Return 0 EndFunc Func MyErrFunc() Endfunc Both of these scripts just show the program that I ran, they do not save using a hidden way.. Share this post Link to post Share on other sites
somdcomputerguy 103 Posted October 25, 2010 What kind of file needs saving? Can it be done with AutoIt? If it can, that would certainly help this matter.. - Bruce /*somdcomputerguy */Â If you change the way you look at things, the things you look at change. Share this post Link to post Share on other sites
richietheprogrammer1 0 Posted October 25, 2010 What kind of file needs saving? Can it be done with AutoIt? If it can, that would certainly help this matter.. Ok so here is the answer to your question: I am trying to export the IE browsing history, using this program http://www.nirsoft.net/utils/iehv.htmlPlease note I must use that specific program. Once I run that exe, I need to do a save as. Again, I am able to run the actual program in hidden mode, but once it executes "ctr s", the save as window pops up. Thoughts? Thanks a lot Share this post Link to post Share on other sites
GEOSoft 68 Posted October 25, 2010 (edited) If you read to the bottom of the page you posted you would see that there are Commandline Parameters for that app. iehv /shtml "c:\temp\urls.html" iehv /stext "c:\temp\urls.txt" Etc. Edited October 25, 2010 by GEOSoft GeorgeQuestion about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else."Old age and treachery will always overcome youth and skill!" Share this post Link to post Share on other sites