I have installed ImageMagick with the COM option in the installer (the checkbox about VBS something, don't remember exactly). I can run the ImageMagickObject .vbs test script that comes with ImageMagick. But I can't get it to work in AHK. The sample script generated "Invalid class string" error on this line

I have installed ImageMagick with the COM option in the installer (the checkbox about VBS something, don't remember exactly). I can run the ImageMagickObject .vbs test script that comes with ImageMagick. But I can't get it to work in AHK. The sample script generated "Invalid class string" error on this line[code]oI := ComObjCreate("ImageMagickObject.MagickImage.1")[/code]

Joetazz wrote:Any idea what the maximum size that can be stored in this? I read through some of the documentation however I was playing around and was storing a lot more characters than what I saw in the documentation.

I reached a max of 524,285 charchters on my 64 bit version of Windows 7

[quote="Joetazz"]Any idea what the maximum size that can be stored in this? I read through some of the documentation however I was playing around and was storing a lot more characters than what I saw in the documentation.[/quote]

I reached a max of 524,285 charchters on my 64 bit version of Windows 7

Any idea what the maximum size that can be stored in this? I read through some of the documentation however I was playing around and was storing a lot more characters than what I saw in the documentation.

Any idea what the maximum size that can be stored in this? I read through some of the documentation however I was playing around and was storing a lot more characters than what I saw in the documentation.

req :=ComObjCreate("Msxml2.XMLHTTP"); Open a request with async enabled.req.open("GET","https://autohotkey.com/download/1.1/version.txt",true); Set our callback function (v1.1.17+).req.onreadystatechange :=Func("Ready"); Send the request.req.send()/*; If you're going to wait, there's no need for onreadystatechange.; Setting async=true and waiting like this allows the script to remain; responsive while the download is taking place, whereas async=false; will make the script unresponsive.while req.readyState != 4 sleep 100*/#Persistent

I started looking into this because using WinHttpRequest in synchronous mode causes the script to hang until the request completes, but it turns out you can get around that by opening the request in asynchronous mode and calling WinHttpRequest.WaitForResponse(). The advantages of XMLHTTP are that the API is well known to many web developers, and the events (like onreadystatechange) are compatible with AutoHotkey.

[b]COM Object:[/b] [c]Msxml2.XMLHTTP[/c], a.k.a. XmlHttpRequest object.[b]Purpose:[/b] Making HTTP requests. Unlike UrlDownloadToFile, it doesn't require managing a temporary file. Unlike WinHttpRequest, it can notify us when the request is complete.[b]System Requirements:[/b] IE7+ and AutoHotkey v1.1.17+ to use onreadystatechange.[b]Documentation Link:[/b] [url=http://msdn.microsoft.com/en-us/library/ie/ms535874]XMLHttpRequest object[/url][b]Basic Code Example: [/b][code=autohotkey]req := ComObjCreate("Msxml2.XMLHTTP"); Open a request with async enabled.req.open("GET", "https://autohotkey.com/download/1.1/version.txt", true); Set our callback function (v1.1.17+).req.onreadystatechange := Func("Ready"); Send the request.req.send()/*; If you're going to wait, there's no need for onreadystatechange.; Setting async=true and waiting like this allows the script to remain; responsive while the download is taking place, whereas async=false; will make the script unresponsive.while req.readyState != 4 sleep 100*/#Persistent

Ready() { global req if (req.readyState != 4) ; Not done yet. return if (req.status == 200 || req.status == 304) ; OK. MsgBox % "Latest AutoHotkey version: " req.responseText else MsgBox 16,, % "Status " req.status ExitApp}[/code]I started looking into this because using WinHttpRequest in synchronous mode causes the script to hang until the request completes, but it turns out you can get around that by opening the request in asynchronous mode and calling [c]WinHttpRequest.WaitForResponse()[/c]. The advantages of XMLHTTP are that the API is well known to many web developers, and the events (like onreadystatechange) are compatible with AutoHotkey.

COM Object: Publisher.ApplicationPurpose: Microsoft Publisher is an entry-level desktop publishing application from Microsoft, differing from Microsoft Word in that the emphasis is placed on page layout and design rather than text composition and proofing.System Requirements: Microsoft Office PublisherDocumentation Link:Object model reference (Publisher 2013 developer reference)Other Links:Save the active document as .jpgBasic Code Example: This example will open Publisher, create a new document, draw a curve and a line, add some text, and SaveAs with two different formats (.jpg and .pub).

pbApp :=ComObjCreate("Publisher.Application"); Create a Publisher application object and store a reference to it in the pbApp variablepbApp.ActiveWindow.Visible :=true; Make the window visible

; Application.NewDocument Method (Publisher); http://msdn.microsoft.com/en-us/library/office/ff940013%28v=office.15%29.aspxpbDoc := pbApp.NewDocument(); Create a new document and store a reference to the object in the pbDoc variable

; Shapes Methods (Publisher); http://msdn.microsoft.com/en-us/library/office/dn338310%28v=office.15%29.aspxpbDoc.Pages(1).Shapes.AddLine(100,150,500,550); Draw a line from the point (100, 150) to point (500, 550)

; Shapes.AddCurve Method (Publisher); http://msdn.microsoft.com/en-us/library/office/ff939838%28v=office.15%29.aspxarrPoints :=ComObjArray(VT_R4,4,2)arrPoints[0,0]:=100arrPoints[0,1]:=150arrPoints[1,0]:=240arrPoints[1,1]:=600arrPoints[2,0]:=370arrPoints[2,1]:=100arrPoints[3,0]:=500arrPoints[3,1]:=550pbDoc.Pages(1).Shapes.AddCurve(arrPoints); Draw a curve using the points specified by the array

; Page.SaveAsPicture Method (Publisher); http://msdn.microsoft.com/en-us/library/office/ff939984%28v=office.15%29.aspxSavePath :=A_ScriptDir"\MyTestFile.jpg"; Save the picture to the same directory as this scriptpbDoc.Pages(1).SaveAsPicture(SavePath, pbPictureResolutionCommercialPrint_300dpi)

; Document.SaveAs Method (Publisher); http://msdn.microsoft.com/en-us/library/office/ff940221%28v=office.15%29.aspxSavePath :=A_ScriptDir"\MyTestDocument.pub"; Save the document to the same directory as this scriptpbDoc.SaveAs(SavePath)return

[b]COM Object[/b]: Publisher.Application[b]Purpose:[/b] Microsoft Publisher is an entry-level desktop publishing application from Microsoft, differing from Microsoft Word in that the emphasis is placed on page layout and design rather than text composition and proofing.[b]System Requirements:[/b] Microsoft Office Publisher[b]Documentation Link:[/b] [url=http://msdn.microsoft.com/en-us/library/office/ff939040%28v=office.15%29.aspx]Object model reference (Publisher 2013 developer reference)[/url][b]Other Links:[/b] [url=http://ahkscript.org/boards/viewtopic.php?f=5&t=5077&p=29781#p29781]Save the active document as .jpg[/url][b]Basic Code Example:[/b] This example will open Publisher, create a new document, draw a curve and a line, add some text, and SaveAs with two different formats (.jpg and .pub).

pbApp := ComObjCreate("Publisher.Application") ; Create a Publisher application object and store a reference to it in the pbApp variablepbApp.ActiveWindow.Visible := true ; Make the window visible

; Application.NewDocument Method (Publisher); http://msdn.microsoft.com/en-us/library/office/ff940013%28v=office.15%29.aspxpbDoc := pbApp.NewDocument() ; Create a new document and store a reference to the object in the pbDoc variable

; Shapes Methods (Publisher); http://msdn.microsoft.com/en-us/library/office/dn338310%28v=office.15%29.aspxpbDoc.Pages(1).Shapes.AddLine(100, 150, 500, 550) ; Draw a line from the point (100, 150) to point (500, 550)

A remake of the index.[spoiler2=Index][b]COM Object List[/b][list][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77&start=20#p631]ActiveX Data Objects (ADODB.Connection and Others)[/url][indent=2]Work with a variety of databases, such as CSV, Excel xls, and Access mdb.[/indent][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77#p398]HTML File[/url][indent=2]Represents an HTML document. Can be used to read, write, and interact with HTML.[/indent][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77#p484]InternetExplorer Application[/url][indent=2]Explore websites.[/indent][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77#p488]MSXML2 DOMDocument 6.0[/url][indent=2]XML parser. (v6.0 requires XP SP3 or newer. [url=http://www.autohotkey.com/forum/viewtopic.php?p=387524#p387524]See here[/url] for compatibility with older XP.)[/indent][list][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77&start=20#p633]Format XML Output[/url][/list][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77&p=34247#p34247]Msxml2.XMLHTTP[/url][indent=2]Makes HTTP requests. Unlike UrlDownloadToFile, it doesn't require managing a temporary file. Unlike WinHttpRequest, it can notify us when the request is complete.[/indent][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77#p474]ScriptControl[/url][indent=2]Dynamically execute VBScript or JScript.[/indent][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77#p396]Scripting Dictionary[/url][indent=2]Object that stores data key-item pairs.[/indent][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77&start=20#p509]Scripting FileSystemObject[/url][indent=2]Access files and folders.[/indent][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77#p485]Shell Application[/url][indent=2]Access Explorer and IE windows and tabs. Open and manipulate windows.[/indent][list][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77#p500]Get File Properties[/url][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77#p395]Get the Path of a Selected File[/url][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77&start=20#p599]Rename Files/Folders[/url][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77&start=20#p625]Unzip a Zip File[/url][/list][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77&start=20#p601]Shell Explorer[/url][indent=2]Embed an Explorer/browser control in a Gui. (Internet Explorer - Trident Browser)[/indent][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77#p489]Speech API: SpVoice[/url][indent=2]Text to speech. (TTS)[/indent][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77&start=20#p636]VBScript RegExp[/url][indent=2]VBS regular expressions, including global match.[/indent][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77&start=20#p603]Windows Media Player[/url][indent=2]Play media files and embed a WMPlayer control in a GUI.[/indent][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77#p397]WinHttpRequest[/url][indent=2]Provides simple HTTP client functionality, allowing much more control than UrlDownloadToFile.[/indent][*]Winmgmt[indent=2]Get system information and manage windows services.[/indent][list][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77#p504]Get File Properties[/url][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77&start=20#p591]Manipulating Services[/url][/list][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77&start=20#p593]WScript Shell[/url][indent=2]Various administration tasks including many native to AHK.[/indent][list][*][url=http://ahkscript.org/boards/viewtopic.php?f=6&t=77&start=20#p594]Set Volatile Env Variable[/url][/list][/list]

;[========];[ Load ];[========];-- Note: XML data from fincs. The data has been edited to remove all formatting.xmldata=(ltrim join<compactdiscs><compactdisc><artist type="individual">Frank Sinatra</artist><title numberoftracks="4">In The Wee Small Hours</title><tracks><track>In The Wee Small Hours</track><track>Mood Indigo</track><track>Glad To Be Unhappy</track><track>I Get Along Without You Very Well</track></tracks><price>$12.99</price></compactdisc><compactdisc><artist type="band">The Offspring</artist><title numberoftracks="5">Americana</title><tracks><track>Welcome</track><track>Have You Ever</track><track>Staring At The Sun</track><track>Pretty Fly (For A White Guy)</track></tracks><price>$12.99</price></compactdisc></compactdiscs>)

;-- Set properties on the XML writer.; Note: Some of the property assignments have been commented out so that the; default values will be used. Uncomment and set to another value if desired.

xmlWriter.byteOrderMark:=True;-- Determines whether to write the Byte Order Mark (BOM). The; byteOrderMark property has no effect for BSTR or DOM output.

xmlWriter.disableOutputEscaping:=False;-- Matches the disable-output-escaping attribute of the <xsl:text> and; <xsl:value-of> elements. When set to True, special symbols such as; "&" are passed through literally.

;;;;;xmlWriter.encoding:="UTF-8";;;;; ;-- Sets and gets encoding for the output. Observation: For some;;;;; ; reason, encoding is not displayed in the processing instructions;;;;; ; node if this property is set to "UTF-8".

xmlWriter.omitXMLDeclaration:=False;-- Forces the IMXWriter to skip the XML declaration. Useful for; creating document fragments. Observation: For some reason (bug?),; this property is assumed to be TRUE if the "output" property is a; DOM object.

xmlWriter.indent:=True;-- Sets whether to indent output. There is no real need for the; xmlWriter without this feature

;;;;;xmlWriter.standAlone:=True;;;;; ;-- Sets the value of the standalone attribute in the XML declaration to;;;;; ; "yes" or "no".

;;;;;xmlWriter.version:="1.0";;;;; ;-- Specifies the version to include in XML declarations.

;;;;;xmlWriter.output:="";;;;; ;-- Sets the destination and the type of output for IMXWriter.;;;;; ; Observation: If set, this property should (must?) be set last.

;-- Set the XML writer to the SAX content handlerxmlReader.contentHandler :=xmlWriterxmlReader.dtdHandler :=xmlWriterxmlReader.errorHandler :=xmlWriterxmlReader.putProperty("http://xml.org/sax/properties/lexical-handler",xmlWriter)xmlReader.putProperty("http://xml.org/sax/properties/declaration-handler",xmlWriter)

;-- Set properties on the XML writer.; Note: Some of the property assignments have been commented out so that the; default values will be used. Uncomment and set to another value if desired.

xmlWriter.byteOrderMark:=True ;-- Determines whether to write the Byte Order Mark (BOM). The ; byteOrderMark property has no effect for BSTR or DOM output.

xmlWriter.disableOutputEscaping:=False ;-- Matches the disable-output-escaping attribute of the <xsl:text> and ; <xsl:value-of> elements. When set to True, special symbols such as ; "&" are passed through literally.

;;;;;xmlWriter.encoding:="UTF-8";;;;; ;-- Sets and gets encoding for the output. Observation: For some;;;;; ; reason, encoding is not displayed in the processing instructions;;;;; ; node if this property is set to "UTF-8".

xmlWriter.omitXMLDeclaration:=False ;-- Forces the IMXWriter to skip the XML declaration. Useful for ; creating document fragments. Observation: For some reason (bug?), ; this property is assumed to be TRUE if the "output" property is a ; DOM object.

xmlWriter.indent:=True ;-- Sets whether to indent output. There is no real need for the ; xmlWriter without this feature

;;;;;xmlWriter.standAlone:=True;;;;; ;-- Sets the value of the standalone attribute in the XML declaration to;;;;; ; "yes" or "no".

;;;;;xmlWriter.version:="1.0";;;;; ;-- Specifies the version to include in XML declarations.

;;;;;xmlWriter.output:="";;;;; ;-- Sets the destination and the type of output for IMXWriter.;;;;; ; Observation: If set, this property should (must?) be set last.

;-- Set the XML writer to the SAX content handlerxmlReader.contentHandler :=xmlWriterxmlReader.dtdHandler :=xmlWriterxmlReader.errorHandler :=xmlWriterxmlReader.putProperty("http://xml.org/sax/properties/lexical-handler",xmlWriter)xmlReader.putProperty("http://xml.org/sax/properties/declaration-handler",xmlWriter)

;// Save WorkBookMsgBox, 4, , The Workbook will close once the object is released - would you like to save it to the scirpt directory?IfMsgBox, Yes XLBook.SaveAs(A_ScriptDir "\Excel.Sheet Example.xls")[/code]

[b]Note [/b]- the [i]Excel.Sheet[/i] object will open in the Active Excel Process (accessed by ComObjActive) - or will create a new Excel Process - and it will close when the pointer is released.

[b]COM Object:[/b] Outlook.Application[b]Purpose:[/b] Create various new items in Outlook[b]System Requirements:[/b] Windows 2000 or higher[b]Documentation Link:[/b] [url=http://msdn.microsoft.com/en-us/library/aa271384][b]Outlook 2003 Visual Basic Reference[/b][/url][b]Other Links:[/b] [url=http://msdn.microsoft.com/en-us/library/aa220082.aspx][b]CreateItem Method[/b][/url], [url=http://msdn.microsoft.com/en-us/library/aa212040.aspx][b]GetInspector Property[/b][/url], [url=http://msdn.microsoft.com/en-us/library/aa831907][b]OlItemType constants[/b][/url][b]Basic Code Example:[/b] The entire process of creating a new Outlook item can be executed in a single line using one of the [i]OlItemType[/i] constants shown in the below code (and in the above link) with the [i]CreateItem[/i] method. This method is valuable if you have problems opening new items using the [url=http://office.microsoft.com/en-us/outlook-help/command-line-switches-HP001003110.aspx][b]command line switches[/b][/url].