AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

COM Standard Library
Goto page Previous  1, 2, 3 ... 40, 41, 42, 43, 44  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
ddk



Joined: 28 Dec 2009
Posts: 43

PostPosted: Fri Jun 18, 2010 12:21 am    Post subject: Reply with quote

So, how I can get the active controls value in IE? Confused
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Fri Jun 18, 2010 2:56 am    Post subject: Reply with quote

what presicely is an active controls value ???? i seem to iliterate to understand
Shocked
_________________

We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Back to top
View user's profile Send private message
ddk



Joined: 28 Dec 2009
Posts: 43

PostPosted: Fri Jun 18, 2010 12:57 pm    Post subject: Reply with quote

tank wrote:
what presicely is an active controls value ???? i seem to iliterate to understand
Shocked

Very Happy Very Happy Apologies for being rough.
Well.. Explanatory picture:

I just want my script get the value like iWebBrowser2 Learner does. Sad
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Fri Jun 18, 2010 2:28 pm    Post subject: Reply with quote

There are several tutorials in the forum covering this, not to mention one outdated tutorial by tank covering almost this exact example. Start here.
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
ddk



Joined: 28 Dec 2009
Posts: 43

PostPosted: Fri Jun 18, 2010 3:39 pm    Post subject: Reply with quote

sinkfaze wrote:
There are several tutorials in the forum covering this, not to mention one outdated tutorial by tank covering almost this exact example. Start here.
Ive been reading that tutorial (as you can see from last page), but couldn't find it. I'll read that once again and keep looking.
Back to top
View user's profile Send private message
ribbs2521



Joined: 28 Sep 2007
Posts: 273
Location: New York

PostPosted: Fri Jun 25, 2010 5:09 pm    Post subject: Reply with quote

Not sure who's dealt with ADO using the latest AutoHotKey_COM but I seem to be running into an issue.

This Function Works fine before compiling but afterward I get an error that says the variable rs.EOF contains an illegal character.

Maybe I missed something but I'm not sure since, like I said, it works when it's not compiled. (It compiles with no errors either)
Code:
MySQL_Query_RS(connection, query)
{
  ;If it is not a SELECT statement, assume there is no need for an RS as it is a modifier
  if (SubStr(query, 1, 6) != "SELECT")
    return connection.Execute(query)
  rs := ComObjCreate("ADODB.RecordSet")
  rs.Open(query, connection)
  If (rs.EOF)
    Msgbox, No Data returned by this query`n`n%query%
  return rs

}


Here is the code to generate a connection:
Code:
CreateMySQLConnection(username, password, databaseName, hostIP)
{
  local dsn
  dsn := "DRIVER={MySQL ODBC 3.51 Driver};SERVER=" . hostIP . ";DATABASE=" . databaseName . ";USER=" . username . ";PASSWORD=" . password . ";OPTION=3;"
  connection := ComObjCreate("ADODB.Connection")
  connection.Open(dsn)
  return connection
}


There are other functions as well that are all part of a wrapper class as I have numerous programs that access my database.
Back to top
View user's profile Send private message
fincs



Joined: 05 May 2007
Posts: 1163
Location: Seville, Spain

PostPosted: Fri Jun 25, 2010 5:13 pm    Post subject: Reply with quote

@ribbs2521: Make sure you're using my custom AutoHotkey build (AHK_COM was merged into it) instead of the regular AutoHotkey.exe.
The file you want is AutoHotkey_La.exe (which is the 32-bit ANSI version).
_________________
fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]
Back to top
View user's profile Send private message
ribbs2521



Joined: 28 Sep 2007
Posts: 273
Location: New York

PostPosted: Fri Jun 25, 2010 5:26 pm    Post subject: Reply with quote

Fincs, I wasn't using that file but even after doing so I get the same thing.


Edit: Scratch that, I compiled it with Compile_AHK using Compile with options. When I just used Compile from the context menu it works fine. Any idea why that is? I would like to be able to compile with options. Sorry, when it comes to compiling and all of that stuff I have no idea what's going on. At least with writing applications I am somewhat capable.
Back to top
View user's profile Send private message
fragman



Joined: 13 Oct 2009
Posts: 1199

PostPosted: Thu Jul 22, 2010 2:29 pm    Post subject: Reply with quote

I'm using ahk_l and the latest com version, both ansi.

Using the following function in a folder with ~40 files I get about 2-3 COM errors saying this:
Quote:
Function Name: "Name"
ERROR: No COM Dispatch Object!


Code:
SelectFiles(Select,Clear=1,Deselect=0,MakeVisible=1,focus=1, hWnd=0)
{
   If   hWnd||(hWnd:=WinActive("ahk_class CabinetWClass"))||(hWnd:=WinActive("ahk_class ExploreWClass"))
   {
      sa := Com_CreateObject("Shell.Application")      
      ;Find hwnd window
      wins := sa.Windows
      loop % wins.count
      {
      window:=wins.Item(A_Index-1)
      If Not InStr( window.FullName, "steam.exe" ) ; ensure pwb isn't IE
         if(window.Hwnd=hWnd)
            break
      }
       doc:=window.Document
      value:=!Deselect
      value1:=!Deselect+focus*16+MakeVisible*8
      if(Clear)
         value1+=clear*4
         
      Loop % Select.len()
      {
         filter := Select[A_Index]
         If filter <>
         {
            If(InStr(filter, "*"))
            {
               filter := "\Q" StringReplace(filter, "*", "\E.*\Q", 1) "\E"
               filter := strTrim(filter,"\Q\E")
               Loop % doc.Folder.Items.Count
               {
                  item := doc.Folder.Items.Item(A_Index)
                  if(RegexMatch(item.Name,"i)" filter))
                  {
                     COM_Invoke(doc,"SelectItem",item,index=1 ? value1 : value) ;http://msdn.microsoft.com/en-us/library/bb774047(VS.85).aspx               
                     index++
                  }
               }
            }
            else
               COM_Invoke(doc,"SelectItem",doc.Folder.ParseName(filter),(A_Index=1 ? value1 : value)) ;http://msdn.microsoft.com/en-us/library/bb774047(VS.85).aspx               
         }
      }
   }
}


The function expects Select to be an array object from Temp01's array library: http://www.autohotkey.com/forum/topic49736.html

The values may contain * as placeholders, so you can use *.jpg etc.

Any idea why I'm seeing those errors? I've also noticed them at some other functions involving COM, but they're only happening sometimes and haven't disturbed me yet since I could just turn them off and they wouldn't disturb functionality much. I would like to get rid of them here though, since this function will not select all files in its current state.
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Thu Jul 22, 2010 11:52 pm    Post subject: Reply with quote

I'm not sure why you posted in this thread. Have you pinned down the origin of your errors? Is it a bug in COM.ahk, or a bug in Windows' shell etc, or a bug in your code or just your system? I failed to see any COM.ahk related errors in this but I could spot an error in your code. So, what are you expecting from me by only saying you got errors with your code?
Back to top
View user's profile Send private message
i3egohan



Joined: 18 Jul 2006
Posts: 403

PostPosted: Fri Jul 23, 2010 1:39 pm    Post subject: Reply with quote

Can someone show example to call function from the following OCX.

http://www.freedownloadscenter.com/Programming/Components_and_Libraries/1Crypt.html
Back to top
View user's profile Send private message
fragman



Joined: 13 Oct 2009
Posts: 1199

PostPosted: Fri Jul 23, 2010 5:28 pm    Post subject: Reply with quote

Sean, you are right, I did not realize that I needed to use zero based index for the folderitems, but this is not the cause of this error.

I noticed that if I add a sleep 10 after each SelectItem call, it works fine, so I can only suspect that there is an issue in COM or explorer shell. My knowledge of COM is not good enough to figure anything out on that level, which is why I'm asking here.

Do I need to release any resources? I was thinking that COM_Release was not needed anymore?
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Sat Jul 24, 2010 2:08 am    Post subject: Reply with quote

i3egohan wrote:
Can someone show example to call function from the following OCX.
You better consult the documentation of the app. Not many users may like to install a foreign app.
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Sat Jul 24, 2010 2:22 am    Post subject: Reply with quote

fragman wrote:
I noticed that if I add a sleep 10 after each SelectItem call,
This is understandable. Some shell operations don't wait until all needed underlying procedures are completed, probably/mainly for performance reason. It's similar to Navigate(2) in IWebBrowser2. The simplest solution to this may be to add sufficient sleep as you did. Or you could utilize the event SelectionChanged in DShellFolderVeiwEvents. Or you may call directly the function SelectItem in the interface IFolderView.

Quote:
Do I need to release any resources? I was thinking that COM_Release was not needed anymore?
It's no longer needed with COM_L/AHK_L. BTW, I strongly recommend UNICODE build over ANSI build.
Back to top
View user's profile Send private message
fragman



Joined: 13 Oct 2009
Posts: 1199

PostPosted: Sat Jul 24, 2010 8:58 am    Post subject: Reply with quote

Hmm, I'll have to try finding a good sleep ammount, sleeping after every call makes it quite slow, maybe with the method mentioned in docs for shorter sleep.

I'm planning to switch to Unicode at some point, but I'm not sure if I'm going to do it before IronAHK is ready.

Just for information, it appears that the calls to doc.Folder.Items.Item or to item.Name are causing the problems. I've separated the loop that queries the name and the loop for file selection, and SelectItem works fine without sleeps.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 40, 41, 42, 43, 44  Next
Page 41 of 44

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group