Jump to content

tengwer

Active Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by tengwer

  1. I found another solution. As I read the help file on the embedding commands I was using it said that IE embedded loses some properties, one of the being status text. I thought I researched this thoroughly before posting. Sorry. I am now embedding the whole program in a window using the winapi setparent command and it works perfectly. I also found a script online to get rid of the title bar so it looks like part of the parent window. THanks to all of you out there who have great scripting ideas for those who want to look for them!
  2. Here is that script properly edited I hope (not sure how to get it to show in the forum like it does in Scite). #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> _IEErrorHandlerRegister () $oIE = _IECreateEmbedded () GUICreate("Embedded Web control Test", 640, 580, _ (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360) $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30) $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30) $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30) $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30) GUISetState() ;Show GUI _IENavigate ($oIE, "www.google.com") ; Waiting for user to close the window While 1 $msg = GUIGetMsg() $var = _IEPropertyGet($oIE, "statustext") If @error Then Exit ToolTip ($var, 0, 0) Sleep (100) Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Button_Home _IENavigate ($oIE, "http://www.autoitscript.com") Case $msg = $GUI_Button_Back _IEAction ($oIE, "back") Case $msg = $GUI_Button_Forward _IEAction ($oIE, "forward") Case $msg = $GUI_Button_Stop _IEAction ($oIE, "stop") EndSelect WEnd GUIDelete() Exit
  3. Thanks for the reply. I have that working now but I need to be able to do the same thing with IE embedded. Here is my example script modified from the help file. Can you make the statustext show in a tooltip in this example? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> _IEErrorHandlerRegister () $oIE = _IECreateEmbedded () GUICreate("Embedded Web control Test", 640, 580, _ (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _ $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360) $GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30) $GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30) $GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30) $GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30) GUISetState() ;Show GUI _IENavigate ($oIE, "www.google.com") ; Waiting for user to close the window While 1 $msg = GUIGetMsg() $var = _IEPropertyGet($oIE, "statustext") If @error Then Exit ToolTip ($var, 0, 0) Sleep (100) Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Button_Home _IENavigate ($oIE, "http://www.autoitscript.com") Case $msg = $GUI_Button_Back _IEAction ($oIE, "back") Case $msg = $GUI_Button_Forward _IEAction ($oIE, "forward") Case $msg = $GUI_Button_Stop _IEAction ($oIE, "stop") EndSelect WEnd GUIDelete() Exit
  4. I came across this post and it does exactly what I want but I also need to get the hyperlink info while hovering over links in html documents. The above example works great for a web page on the internet. Just hover over a hyperlink and a tooltip pops up showing the link info. Is there any way to do the same thing for an html document?
  5. FYI I already tried the parameter $MOUSE_PRIMARYDBLCLK_EVENT and it did not work at all.
  6. I've tried everything I can think of to create a simple script that will call a function when the left mouse button is doubleclicked. But I have run into every problem from the script working but I'm not able to click an drag anymore with it running to it only working once and then not at all. This is the script I currently have: #include <MouseSetOnEvent_UDF.au3> $x = 0 _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT , "Click") Sleep(100) _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT) ;Enable mouse button back. While 1 $x += 1 sleep(100) WEnd Func Click() If $x < 3 Then DoubleClick() $x = 0 ;MsgBox(4096,"","Click",2) EndFunc Func DoubleClick() MsgBox(4096,"","DoubleClick",2) $x = 0 EndFunc It only works on the first double click and then doen't do anything. Can anyone help?
  7. The two keys I set in the variables above are the ctrl and printscreen key. From 1 to 3 keys can be used as you can see.
  8. #include <Misc.au3> Global $Key1 = "2C" Global $Key2 = "11" Global $Key3 = "" $dll = DllOpen("user32.dll") While 1 If $Key1 <> "" AND $Key2 = "" AND $Key3 = "" Then If _IsPressed($Key1, $dll) Then $ButtonState = "Pressed" Pressed() EndIf EndIf If $Key1 <> "" AND $Key2 <> "" AND $Key3 = "" Then If _IsPressed($Key1, $dll) AND _IsPressed($Key2, $dll) Then $ButtonState = "Pressed" Pressed() EndIf EndIf If $Key1 <> "" AND $Key2 <> "" AND $Key3 <> "" Then If _IsPressed($Key1, $dll) AND _IsPressed($Key2, $dll) AND _IsPressed($Key3, $dll) Then $ButtonState = "Pressed" Pressed() EndIf EndIf WEnd Func Pressed() ;MsgBox(0,"","") Sleep(600) If $Key1 <> "" AND $Key2 = "" AND $Key3 = "" Then If _IsPressed($Key1, $dll) Then $ButtonState = "Held" EndIf EndIf If $Key1 <> "" AND $Key2 <> "" AND $Key3 = "" Then If _IsPressed($Key1, $dll) AND _IsPressed($Key2, $dll) Then $ButtonState = "Held" EndIf EndIf If $Key1 <> "" AND $Key2 <> "" AND $Key3 <> "" Then If _IsPressed($Key1, $dll) AND _IsPressed($Key2, $dll) AND _IsPressed($Key3, $dll) Then $ButtonState = "Held" EndIf EndIf If $ButtonState = "Pressed" Then MsgBox(0,"_IsPressed", "Pressed") If $ButtonState = "Held" Then MsgBox(0,"_IsPressed", "Held") EndFunc DllClose($dll)The UDF you mentioned may be the one I saw a while ago so thanks for the tip but since then I have created something that meets my needs even better. It is a script that can call a function based on wether a key or combination of keys is either pressed or pressed and held. The script is as follows. Let me know what you think.
  9. No. If you do a search for _hotkeyset you'll see where this is used but I can't find where you can download it.
  10. I remember seeing a UDF called _HotkeySet which was pretty cool. I've looked all over and can see where it's been used in the forum but can't find where to download it. Could someone direct me? Is there one place I can go to find all the current UDFs and help file for them? Thanks for your help!
  11. The problem I have is that the script using IEHeadInsertScript does not overide some of the scripts. FOr instance, if the web page already has the Reference Tagger script in it then it takes precidence over my own Reference Tagger script. I have found that if I use Firebug in Firefox and maunally replace pieces of the script with "" then this effectively breaks the script and then when I insert my script it works. I'm looking for a way to do this search and replace on a live web site using a script. The Reference tagger script is as follows:<!-- RefTagger from Logos. Visit http://www.logos.com/reftagger. This code should appear directly before the </body> tag. --> <script src="http://bible.logos.com/jsapi/referencetagging.js" type="text/javascript"></script> <script type="text/javascript"> Logos.ReferenceTagging.lbsBibleVersion = "ESV"; Logos.ReferenceTagging.lbsLinksOpenNewWindow = true; Logos.ReferenceTagging.lbsLibronixLinkIcon = "dark"; Logos.ReferenceTagging.lbsNoSearchTagNames = [ "h1", "h2", "h3" ]; Logos.ReferenceTagging.tag(); </script> This script is inserted into certain web sites and it varies dependcing on what the web designer wants it to do. Sometimes it is designed to not have a link to open my bible study prgram and sometimes it is designed with this link. If it is not designed to allow me to link to my program then when I use your script to as it to do so the internal script of the web site takes precidence and mine does nothing. The script you designed works great when there is no already existing Reference Tagger codee in the web page. What I did was manually replace the "logos.referencetagging" of the web page with "". This broke that script and then allowed mine to work. Can you demonstrate a way to add this search and replace functionality to the script you originally gave me?
  12. I was given a script to use a while ago that inserts code into a web page. The script was from Dale as follows: #include <IE.au3> Global $oIE, $sScriptSrc $oIE = _IECreate("http://www.netbiblestudy.net/new_page_9.htm") ObjEvent($oIE, "evtWin_", "DWebBrowserEvents2") _IEAction($oIE, "refresh") ; Only needed for initial page to trigger downloadcomplete processing While True Sleep(1000) WEnd Exit ;------------------------------------------ ; Functions ;------------------------------------------ Func evtWin_onquit() ; Browser run down, exit Exit EndFunc ;==>evtWin_onquit Func evtWin_downloadcomplete() Local $s_script If $sScriptSrc = "" Then Local $o_XHR = ObjCreate("MSXML2.XMLHTTP") ; Init the Ajax object $o_XHR.open("GET", "http://bible.logos.com/jsapi/referencetagging.js", False) $o_XHR.Send() $sScriptSrc = $o_XHR.responseText EndIf IEHeadInsertScript($oIE, $sScriptSrc) $s_script = 'Logos.ReferenceTagging.lbsBibleVersion = "ESV";' $s_script &= 'Logos.ReferenceTagging.lbsLinksOpenNewWindow = true;' $s_script &= 'Logos.ReferenceTagging.lbsAddLibronixDLSLink = true;' $s_script &= 'Logos.ReferenceTagging.lbsLibronixBibleVersion = "NIV";' $s_script &= 'Logos.ReferenceTagging.lbsLibronixLinkIcon = "dark";' $s_script &= 'Logos.ReferenceTagging.lbsNoSearchTagNames = [ ];' $s_script &= 'Logos.ReferenceTagging.tag();' IEEval($oIE, $s_script) EndFunc ;==>evtWin_downloadcomplete Func IEEval($o_object, $s_eval) Return $o_object.document.parentwindow.eval($s_eval) EndFunc ;==>IEEval Func IEHeadInsertScript($o_object, $s_script) Local $o_head, $o_element $o_head = _IETagNameGetCollection($o_object, "head", 0) $o_element = $o_object.document.createElement('script') $o_element.type = 'text/javascript' $o_element.text = $s_script $o_head.appendChild($o_element) Return 1 EndFunc ;==>IEHeadInsertScript This is a wonderful script and works well for many web pages. By inserting the html within to the web page (namely the $s_script code) I am able to link to my bible study software from the web page. Once in a while, however, I find there is another script within the web page that overides mine. Is there a way to add some code to the above example to do the opposite- that is to remove some html from the page as oppossed to adding it? In many cases I can find out what html needs to be removed from the page in order for the script above to have the priority. A search and replace for html in the web page could even do the trick. Anyone have any ideas?
  13. I'll keep that in mind for the future.
  14. Thanks for the reply. I read the warning but don't know what it means (Please wait at least 24 hours before bumping your thread -- Consider yourself warned.) Could you explain please? Tim
  15. I want to be able to click on a word in a document and have an event fired when I release the left mouse button but only when pressing ctrl-shift along with it. I tried this but it doesn't work: _MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT, "Click") Sleep(5000) _MouseSetOnEvent($MOUSE_PRIMARYUP_EVENT) ;Enable mouse button back. Func Click() ;MsgBox(0,"","") If _IsPressed(11, $dll) Then Sleep(200) If _IsPressed(10, $dll) Then MsgBox(0,"","") EndIf EndIf EndFunc Func Close() Exit EndFunc While 1 Sleep(250) WEnd I used the msgbox just to see if it works. In reality I would call another function at this point. FYI I am looking to call that function after the mouse button is released while pressing ctrl-shift and not when it is pressed.
  16. As I mentioned I already do that but I don't want the client size as this includes the toolbar area. I need to get just the viewing area such as where you type in Word or view a web page.
  17. I wrote a script that allows you to indirectly change the color of the viewing area background in apps such as internet explorer, Word, notepad etc. It works by making the app semitransparent and then putting a colored gui screen behind it that is the size of the area that is viewed (area where you type or view web page). I determined the viewing area size by starting with the client area size and then adjusting it to account for the scroll bar and toolbar area at top. two questions: 1) Is there a way to determine more directly the size and position of the viewable area? 2) Even better is there a way to directly change the color of the background of various apps without having to resort to the method above? The script I have is as follows: #include <Misc.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Opt("WinTitleMatchMode", 2) HotKeySet("^+b", "Refresh") HotKeySet("{Esc}", "Close") Global $Color GUIDelete() Run('"C:\Utilitys\AutoIt3\AutoIt3.exe" "C:\Reference\Logos4\Color Picker On Top.au3"') $Color = _ChooseColor(2, $Color, 2) ;Exit Send("!{Tab}") Sleep(1000) Global $WinTitle = WinGetTitle("[Active]") Sleep(1000) WinSetTrans($WinTitle, "", 220) WinSetOnTop($WinTitle, "", 1) ;MsgBox(0,"",""&$WinTitle&"") $ScrollBarWidth = 19 $ToolBarHeight = 113 $Pos = WinGetPos($WinTitle) $GUI = GUICreate("", $Pos[2] - $ScrollBarWidth, $Pos[3] - $ToolBarHeight , $Pos[0], $Pos[1] + $ToolBarHeight, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST + $WS_EX_TRANSPARENT) GUISetBkColor($Color) GUISetState() WinActivate($WinTitle) Func Refresh() GUIDelete() Run(""&@AutoItExe&" """&@ScriptDir&"\Color Picker On Top.au3""") $Color = _ChooseColor(2, $Color, 2) Global $WinTitle = WinGetTitle("[Active]") Sleep(1000) WinSetTrans($WinTitle, "", 220) ;MsgBox(0,"",""&$WinTitle&"") $ScrollBarWidth = 19 $ToolBarHeight = 113 $Pos = WinGetPos($WinTitle) $GUI = GUICreate("", $Pos[2] - $ScrollBarWidth, $Pos[3] - $ToolBarHeight , $Pos[0], $Pos[1] + $ToolBarHeight, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST + $WS_EX_TRANSPARENT) GUISetBkColor($Color) GUISetState() WinActivate($WinTitle) EndFunc ;==>Refresh Func Close() GUIDelete() WinActivate($WinTitle) WinWaitActive($WinTitle) WinSetTrans($WinTitle, "", 255) WinSetOnTop($WinTitle, "", 0) Exit EndFunc ;==>Close While 1 $State = WinGetState("Windows Internet Explorer") If BitAND($State, 16) Then GUISetState(@SW_HIDE) If Not BitAND($State, 16) Then GUISetState(@SW_SHOW) WinActivate($WinTitle) EndIf Sleep(1000) WEnd
  18. Thanks for your help. I'll take a look at the script and see what I can do. I guess there's a lot more to this than I thought but I will perservere!
  19. I'm still running into the problem of this only working on notepad (I altered the script so it would work on any active window to test this). It does scroll now in notepad though (although the scroll bar doesn't move). What I'm looking for is a way to scroll ANY window from within a script. The scrolling should ideally not just include the contents of the window but the scroll button as well. Is there any way to do this with Autoit? Thanks for your help!
  20. It took me a while to get to this. Sorry! It seems that the text itself does not actually scroll but only the scroll bar moves. Can this be modified so that the text scrolls just as if you were manually moving the scroll bar? You'll see what I mean if you use the following code, execute it, and then open a text file in notepad (have it ready to go as you can see I left just 5 seconds to test). Also I noticed that in other places such as the Autoit help file the scroll bar doesn't move at all. #include <GUIScrollBars.au3> #include <ScrollBarConstants.au3> Sleep(5000); have a text file in notepad ready to switch to after running script Dim $tSBI $hEdit = ControlGetHandle('[Active]', '', 'Edit1') $tSBI = DllStructCreate($tagSCROLLINFO) DllStructSetData($tSBI, 'cbSize', DllStructGetSize($tSBI)) DllStructSetData($tSBI, 'fMask', $SIF_ALL) If _GUIScrollBars_GetScrollInfo($hEdit, $SB_VERT, $tSBI) Then Local $iMax = DllStructGetData($tSBI, 'nMax') DllStructSetData($tSBI, 'nPos', Round($iMax*0.2)) _GUIScrollBars_SetScrollInfo($hEdit, $SB_VERT, $tSBI) Else ConsoleWrite('Error' & @LF) EndIf $tSBI = 0
  21. Thank you for your help! It turns out the problem wasn't with the quotes but the c:\ was missing from the path. But at least I know now how to use quotes with a variable.
  22. I don't know why but i always seem to have trouble with quotes and variables. I have a variable $CurrentCursor which contains the path to the current mouse cursor being used. Rather than the script reading this variable as windows\cursors\mycursor.cur I need it to be read as "windows\cursors\mycursor.cur". I've tried doubling up quotes around the variable but this doesn't work. The part of the script is as follows: $Cursor = DllCall("user32.dll", "int", "LoadCursorFromFile", "str", $CurrentCursor) Can anyone help?
  23. It is for normal windows. I need to be able to scroll any window from within an autoit script.
  24. I'm sure this is easy but I can't seem to find anything that I can understand in the forum on this. Simply put I need a function that will scroll a window up and down or sideways. The function needs to allow me to tell it how much to scroll and in which direction. If there were a simple command such as: ScrollWindow("up",2) where up is the direction I want to scroll and 2 is the distance in pixels I want the scroll bar to move Unfortunately it seems I can't find a simple command like this but this is what I need. Can anyone help?
  25. I did take a little break. I tried your script and it works great. Is there a way to get it to work when you add a new tab to the browser? I did find, however, that getting this to work in IE does not make it work within my Libronix program as the window that is created is an object within Libronix and shows a web page. The script I use to open a browser window within Libronix is: $LDLS = ObjGet("","LibronixDLS.LbxApplication") $URL = $LDLS.CommandBars.Item("Browser Bar").Controls.Item(10).Text $LDLS.RecentWindows.Item(0).View.document.URL = "http://www."&$URL&".com" $URL0 = $LDLS.RecentWindows.Item(0).View.document.URL Dim $URL1 For $i = 1 to 8 Step 1 $URL1 = $LDLS.RecentWindows.Item(0).View.document.URL If $URL0 <> $URL1 Then $LDLS.RecentWindows.Item(0).Caption = $URL1 If $URL0 <> $URL1 Then ExitLoop Sleep(1000) Next I use other scripts to open a .org page or a .net page etc. by just altering the end of line 3. Of course when I click on links within these pages the browser navigates to those links as usual. My goal is to have the java script added to the pages automatically as I navigate so that I can click on bible references and have Libronix open the Bible reference showing in the Libronix web window within the bible window within Libronix so that I do not have to switch back and forth between the Libronix program and IE. I would like to do it al within Libronix. Based on the code above do you have enough object information to adapt a script to work within Libronix? I know this is asking a lot with only a little info but I'll give it a try. Thank you very much for your help!!! Tim
×
×
  • Create New...