AutoHotkey Community

It is currently May 27th, 2012, 3:29 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 646 posts ]  Go to page Previous  1 ... 38, 39, 40, 41, 42, 43, 44  Next
Author Message
 Post subject:
PostPosted: June 18th, 2010, 1:21 am 
Offline

Joined: December 29th, 2009, 12:48 am
Posts: 43
So, how I can get the active controls value in IE? :?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2010, 3:56 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
what presicely is an active controls value ???? i seem to iliterate to understand
:shock:

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2010, 1:57 pm 
Offline

Joined: December 29th, 2009, 12:48 am
Posts: 43
tank wrote:
what presicely is an active controls value ???? i seem to iliterate to understand
:shock:

:D :D Apologies for being rough.
Well.. Explanatory picture:
Image
I just want my script get the value like iWebBrowser2 Learner does. :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2010, 3:28 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
There are several tutorials in the forum covering this, not to mention one outdated tutorial by tank covering almost this exact example. Start here.

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2010, 4:39 pm 
Offline

Joined: December 29th, 2009, 12:48 am
Posts: 43
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 25th, 2010, 6:09 pm 
Offline

Joined: September 28th, 2007, 3:56 am
Posts: 279
Location: New York
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 25th, 2010, 6:13 pm 
Offline
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
@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
Highly recommended: AutoHotkey_L (see why) (all my code snippets require it)
Formal request to polyethene - I support the unity of the AutoHotkey community
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 25th, 2010, 6:26 pm 
Offline

Joined: September 28th, 2007, 3:56 am
Posts: 279
Location: New York
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 22nd, 2010, 3:29 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 23rd, 2010, 12:52 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 23rd, 2010, 2:39 pm 
Offline

Joined: July 18th, 2006, 12:18 pm
Posts: 403
Can someone show example to call function from the following OCX.

http://www.freedownloadscenter.com/Prog ... Crypt.html


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 23rd, 2010, 6:28 pm 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 24th, 2010, 3:08 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 24th, 2010, 3:22 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 24th, 2010, 9:58 am 
Offline

Joined: October 13th, 2009, 10:09 pm
Posts: 1389
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 646 posts ]  Go to page Previous  1 ... 38, 39, 40, 41, 42, 43, 44  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Stigg, xXDarknessXx and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group