AutoHotkey Community

It is currently May 26th, 2012, 9:40 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 296 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11 ... 20  Next

Should this be continued?
Poll ended at June 18th, 2008, 11:34 pm
Yes 93%  93%  [ 14 ]
No 7%  7%  [ 1 ]
Total votes : 15
Author Message
 Post subject:
PostPosted: August 29th, 2009, 5:31 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
Sean wrote:
I'm curious what the 6/2 version was as the announced date was 5/27.
I dont suppose its really worht the effort I was going by the file date within the zip file i then usually changed/uncomment switch out your if statement in invoke which might explain why it now has a different date. as always its entirely possible that i have been smoking crack or had a bad blood sugar and saved a previous version of COM.ahk instead of the new one. I have that zip file but i dont spose ill go back and compare against my production copy

it only matters that it works now since i have to do the equivelent of move legislation thru congress to get our company to let us upgrade AHK and i dont particularly need this functionality. I may not upgrade the companies copy of COM till such time as i get around to getting the upgrade to ahk perhaps this winter

_________________
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: September 18th, 2009, 8:12 am 
Offline

Joined: October 20th, 2007, 10:40 am
Posts: 15
Location: china,hubei
MS Word

in a existing .doc file

in this file only have one "Hello"

How To Replace Text "Hello" To "World" with COM ?

Thanks a lot !

My English is pool ^_^


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 18th, 2009, 1:52 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
It hit the current limit of 10 parameters.
Code:
COM_Invoke(objWord, "ActiveDocument.Content.Find.Execute", "Hello", "-0", "-0", "-0", "-0", "-0", "-0", "-0", "-0", "World")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 18th, 2009, 3:45 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
Sean wrote:
It hit the current limit of 10 parameters
Yet another argument for arrays :wink:

_________________
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: September 19th, 2009, 1:12 am 
Offline

Joined: October 20th, 2007, 10:40 am
Posts: 15
Location: china,hubei
My Code is Here:
Code:
FileName = %A_scriptdir%\aaa.doc
COM_Init()
objword := COM_CreateObject("Word.Application")
COM_Invoke(objword,"Visible=",True)
COM_Invoke(objword,"Activate")

Documents := com_Invoke(objWord, "Documents")
com_invoke(Documents,"Open",FileName) ; open file

COM_Invoke(objword, "ActiveDocument.Content.Find.Execute", "Hello", "-0", "-0", "-0", "-0", "-0", "-0", "-0", "-0", "World")



It Failed again

Error Message:
Code:
Function Name: "Execute"
Error:  Type mismatch        ; I translate This From Chinese To Engliseh in Google
        (0x80020005)
prog:
desc:
help:   , 0
Error2:      (0x800A173A)


Sean wrote:
It hit the current limit of 10 parameters.
Code:
COM_Invoke(objWord, "ActiveDocument.Content.Find.Execute", "Hello", "-0", "-0", "-0", "-0", "-0", "-0", "-0", "-0", "World")



Is That means right now we still can't fix this problem ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 19th, 2009, 2:50 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Be sure to have the latest COM.ahk.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 19th, 2009, 3:15 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
tank wrote:
Sean wrote:
It hit the current limit of 10 parameters
Yet another argument for arrays :wink:
Actually it's straightforward to increase the number of parameters.
Code:
sParams := "0123456789ABCDEFGHIJ"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 19th, 2009, 4:29 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
of this i am aware :wink:
however if you could pass an array of arguments you wouldnt need to bother pre defining some set number of arguments :) :wink:

_________________
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: September 19th, 2009, 5:08 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
something based on this concept
Code:
d0=3
d1=dgfsdf
d2=referb
d3=wefewf
arg("d")
ExitApp
arg(ar)
{
   Loop,% %ar%0
   {
      MsgBox   %   %ar%%A_Index%
   }
}

_________________
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: September 19th, 2009, 5:35 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
One aspect I don't like about it is that all (array) variables should be in Global scope. And, the reason why A_LoopField is used instead of simply A_Index is that A_Index is affected by SetFormat, Integer.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 19th, 2009, 2:53 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
excellent point but i was making the point that if ahk supported real arrays then that wouldnt be so. However your points are very well stated and i find i must step back on my stance here because as usuall your right :D but i do stand byt the statement that arrays and a good foreach.. proceedure would simplify the function writing and simplify the calls as well :D
PS i had never thought of setformat and a_index thanks for poiinting that out

_________________
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: September 20th, 2009, 1:21 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Yes, array will be very useful. As you may have noticed, the first job COM_Invoke carries out is indeed to convert the parameters into arrays, arrays of variants (in reverse order). However, I've never requested the support of array yet as I didn't want to detract the develop time. IMO, the most urgent missing feature in AHK is Unicode. I already noticed many times that an user moved to other apps due to the lack of support of Unicode in AHK.

BTW, the next would be 64-bit support. Currently not that many, but I reckon a lot of users will install 64-bit version at the (official) arrival of Win7.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 21st, 2009, 5:33 pm 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
here is code to convert a folder of .xls files to .csv
Code:
Com_Init()

xlCSV := 6

If !oExcel:=COM_GetActiveObject("Excel.Application") {
   _Quit := true
   If !oExcel:=COM_CreateObject("Excel.Application")
      ExitApp
   }
COM_Invoke(oExcel,"Visible=",True) ; comment thisline to make it hidden

FileSelectFolder, XLS_Path

Loop %XLS_Path%\*.xls
   {
   oWorkbooks := COM_Invoke(oExcel,"Workbooks")
   oThisWorkbook := COM_Invoke(oWorkbooks,"Open",A_LoopFileFullPath)
   ;oThisWorkbook := COM_Invoke(oExcel,"Workbooks.Open",A_LoopFileFullPath) ; Should work but doesnt
   StringReplace, OutFileName, A_LoopFileFullPath, .xls, .csv
   com_invoke(oThisWorkbook,"SaveAs", OutFileName, FileFormat := xlCSV) ; Save the file as .xls
   com_invoke(oThisWorkbook,"Close", true) ; Close the file
   com_release(oThisWorkbook) ; cleanup
   com_release(oWorkbooks) ; cleanup
   Count := A_Index
   }

if (_Quit = true)
   COM_Invoke(oExcel,"Quit")
COM_Release(oExcel)
MsgBox Complete. %Count% files converted.
Return


Bonus points if someone can tell me why the commented line does not work....well it works to open the file not returning the workbook though

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 26th, 2009, 9:53 pm 
Offline

Joined: June 16th, 2008, 12:26 pm
Posts: 82
Location: Pittsburgh, Pennsylvania, USA
I have an embeded excel worksheet in a word doc. Has anyone tried writing into an embeded worksheet?

It works like normal if you double click the object; then it "opens" the object for editing and the functions work. Can this be done without "openning" the object and allow the functions to work? Any thoughts?


Report this post
Top
 Profile  
Reply with quote  
PostPosted: September 28th, 2009, 2:10 am 
Offline

Joined: August 17th, 2009, 4:59 am
Posts: 131
What is the syntax for using a variable to specify an Excel column in a COM_Invoke(pxl, "Range[].Select") command? I can use " var " successfully as a variable for the row, but the same method fails when used as a variable for the column.

I want to paste the tab delimited file in row 1, starting with the first column after the last used column.

Test code:

Code:
#4::
ClipBoard =
FileRead, demo, C:\Users\Robert and Lisa\Desktop\demographics_test.txt
StringReplace, demo, demo, |, %A_Tab%, A
ClipBoard = %demo%

COM_Init()
pxl := GetExcel()
total_columns := COM_Invoke(pxl, "ActiveSheet.UsedRange.Columns.Count") ;
pasteStart = 1
pasteStart += %total_columns%
;MsgBox %pasteStart%
COM_Invoke(pxl, "Range[" pasteStart "1].Select") ; problem line-I can flip these and [A" pasteStart "] correctly pastes starting in A5 but I can't get it to start pasting in E1
COM_Invoke(pxl, "ActiveSheet.Paste")
COM_Release(pxl), COM_Term()
return


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 296 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11 ... 20  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: bekihito and 8 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