Jump to content

OOo/LibO Calc UDF


GMK
 Share

Recommended Posts

14 hours ago, mLipok said:

Constants:

Global Enum _ ; @Extended Status Types
        $0CALC_EXT_DEFAULT, _
        $0CALC_EXT_PARAM1, _
        $0CALC_EXT_PARAM2, _
        $0CALC_EXT_PARAM3, _
        $0CALC_EXT_PARAM4, _
        $0CALC_EXT_PARAM5, _
        $0CALC_EXT_COUNTER

Since some functions have more than five parameters, I'm choosing not to use that method.

Link to comment
Share on other sites

This is yours UDF and yours choice, I only give you some proposals.

.... of course you can add more $OCALC_EXT_PARAM# .... ;)

 

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

16 minutes ago, mLipok said:

This is yours UDF and yours choice, I only give you some proposals.

.... of course you can add more $OCALC_EXT_PARAM# .... ;)

The largest is 14 parameters, which I think is a bit excessive for constants. ;-)

Thanks for your other suggestions, though!

Edited by GMK
Clarification
Link to comment
Share on other sites

When you are passing obj to function in most cases it should be passed as ByRef

_OOoCalc_WriteFromArray(ByRef $oObj

Of course in all cases when you want work on the same object and do not want to "replicate" this object.
In some cases this is also a "speed / memory" usage issue EDIT: I mean issue can happen when you not use ByRef.

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

This two functions do not work:

_OOoCalc_SheetDelete($oCalc, "Sheet2")
    _OOoCalc_SheetDelete($oCalc, "Sheet3")

As sheet name are named in local language for example:

Quote

Row|Col 0
[0]|3
[1]|Arkusz1
[2]|Arkusz2
[3]|Arkusz3
 

this is a result of this:

Local $aSheets = _OOoCalc_SheetList($oCalc)
    _ArrayDisplay($aSheets, "Sheet List")
    Global $sSheet1 = $aSheets[1]
    Global $sSheet2 = $aSheets[2]
    Global $sSheet3 = $aSheets[3]

How you can see I store this sheet names and use it later (look in my proposal for demo: OOoCalc_Demo.au3 )

EDIT:
In my proposed Demo This line should be commented:

;~  Local $sSheet1 = $aSheets[1]

Because is not used :

Quote

"C:\.......\OOoCalc_Demo.au3"(27,30) : warning: $sSheet1: declared, but not used in func.
    Local $sSheet1 = $aSheets[1]
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
 

 

EDIT 2:
Look also for other changes in Demo , like:
 

If $iAnswer2 = $IDYES Then

and 

_Example()
Func _Example()

and removed Global declaration

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

there is no need to add date in header:

; Modified ......: 2016/02/12 by GMK; 2016/11/15 by mLipok

You are doing this all in:

Quote

#cs #CHANGES ====================================================================================================================
 

btw. Whether this should be called "History of changes" ? 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • 1 month later...

I have modified the SaveAs function to SaveAs as TXT file with TAB separated. 
Maybe it is useful for somebody.

Func _OOoCalc_BookSaveAsTxtWithTab(ByRef $oObj, $sFilePath)
    Local $oOOoCalc_COM_ErrorHandler = ObjEvent("AutoIt.Error", __OOoCalc_ComErrorHandler_InternalFunction)
    #forceref $oOOoCalc_COM_ErrorHandler
    If Not IsObj($oObj) Then Return SetError($_OOoCalcStatus_InvalidDataType, 1, 0)
    If Not IsString($sFilePath) Then Return SetError($_OOoCalcStatus_InvalidDataType, 2, 0)
    ; If Not IsString($sFilterName) Then Return SetError($_OOoCalcStatus_InvalidDataType, 3, 0)
    ; If Not IsBool($bOverwrite) Then Return SetError($_OOoCalcStatus_InvalidDataType, 4, 0)
    $sFilePath = __OOoCalc_FileToURL($sFilePath)
    Local $avOptions[3] = [__OOoCalc_SetPropertyValue('FilterName', 'Text - txt - csv (StarCalc)'), __OOoCalc_SetPropertyValue('Overwrite', 'TRUE'), __OOoCalc_SetPropertyValue('FilterOptions', '9,34,0,1,1')] ; 9 = horizontal Tab
    $oObj.storeToURL($sFilePath, $avOptions)
    If @error Then Return SetError($_OOoCalcStatus_ComError, 0, 0)
    Return SetError($_OOoCalcStatus_Success, 0, 1)
EndFunc

The code for the FilterOptions can be found here: http://www.ascii-code.com/

Regards,
-HeiWoMa-

Edited by HeiWoMa
Link to comment
Share on other sites

  • 1 month later...

Hello everybody, i've made a script using this UDF and it's working perfectly, but when i tried to change the sheet to LANDSCAPE mode or format the page (1 page /1 page)  there was nothing to do it, so is it possible to add something like this at this great UDF, it would be nice.

 

Thanks.

Link to comment
Share on other sites

  • 2 weeks later...

Would second the wish for Landscape for a book - I've switched from Excel to LO-Calc and miss this :(

Edit: One thing I noticed: I can't overwrite with the SaveAs Function (despite setting Overwrite to True)

Edited by AIstarter
Link to comment
Share on other sites

  • 1 month later...

Hi all - am a noobie so please bear with me :) 

at one point in my script I am reading a URL from a browser (copy to clipboard and using clipget into a local variable $NewURL) and want to input it into a cell (N1, N2 etc) - but it doesnt work - it works ok if $NewURL is a simple text string but not a URL - any idea if I need a different write command for a URL?

I use _OOoCalc_WriteCell($oCalc, $NewURL, "N" & $m)

Edited by mmoalem
Link to comment
Share on other sites

On 4/24/2017 at 3:49 PM, mmoalem said:

but it doesnt work - it works ok if $NewURL is a simple text string but not a URL - any idea if I need a different write command for a URL?

I use _OOoCalc_WriteCell($oCalc, $NewURL, "N" & $m)

What is the raw string of $NewURL and we can work from there.

 

Hey I'm back after a long while again. I'm about to test the auto sort fix....

 

Link to comment
Share on other sites

13 minutes ago, keafter said:

What is the raw string of $NewURL and we can work from there.

 

Hey I'm back after a long while again. I'm about to test the auto sort fix....

 

Its a URL like this one https://soundcloud.com/memimo-media/sets/always-up-always-onwards copied straight from browser address bar to clipboard and than using ClipGet to the variable $NewURL - the function complete without an error but the cell stays empty (one point: when  i try to close calc straight after it asks if i want to save the changes so maybe the command does alter something in the sheet...)

Link to comment
Share on other sites

Try specifying the sheet name you want to edit:

 _OOoCalc_WriteCell($oCalc, $NewURL, "N" & $m, "Sheet 1") 

 

Side note,

It would appear that there is some code out of place. Either that or I'm not understanding the _OOoCalc_BookAttach($sFileName) function properly.

In the  _OOoCalc_BookAttach function around line 230ish I commented out

If Not FileExists($sFileName) Then Return SetError($_OOoCalcStatus_NoMatch, 1, 0)

$sFileName = "2017 Notary.ods" which will always fail in FileExists() because it's not the entire file path. However If I give it the full file path it will fail a few lines further down at:

If StringInStr($sWinTitle, $sFileName) <> 1 Then Return SetError($_OOoCalcStatus_NoMatch, 0, 0)

Because $sWinTitle = "2017 Notary.ods - Open Office Calc" and the entire filepath is not contained within that. So it seems like with BookAttach the file is already open, it is looking for the window title and therefore never the path. That's my thought process anyway. I could very easily be looking at it the wrong way though, lemme know. Back to testing the sort function.

Edited by keafter
Link to comment
Share on other sites

27 minutes ago, keafter said:

Try specifying the sheet name you want to edit:

 _OOoCalc_WriteCell($oCalc, $NewURL, "N" & $m, "Sheet 1") 

will try BUT it works as it is if the value of $NewURL is a 'standard' text string (for example when the value is this string: 'always up' it pastes it into the cell correctly...

Link to comment
Share on other sites

Ok cool! Sort works just fine. Here's how I got it to work:

_OOoCalc_RangeSort($OoCalcWindowJobSpreadsheet,"Sheet1","A6:P90",1)

It goes: Workbook Object, Sheet Name, Range To Sort, Column to sort by (in this instance sort by column A).

 

25 minutes ago, mmoalem said:

will try BUT it works as it is if the value of $NewURL is a 'standard' text string (for example when the value is this string: 'always up' it pastes it into the cell correctly...

Hmm If the suggestion I made doesn't work, it might be helpful to have the code to test with. In my experience with autoit to open office, I've had troubles getting dates to be properly input. Luckily there was an easy fix by  using _OOoCalc_NumberFormat. Hmm, what happens if you pull the $NewURL with the url into a msgbox. Does it display the url correctly? I'm just wondering if somehow the structure of the url is being broken up or something. Yeah hmm. Code to look at would be good.

Edited by keafter
Link to comment
Share on other sites

41 minutes ago, GMK said:

@mmoalem: I believe you're looking for _OOoCalc_HyperlinkInsert

Hi and thanks  - got stuck with another project and put this one on hold for couple of weeks but thanks for the suggestion - will let you all know if it worked

Link to comment
Share on other sites

  • 2 weeks later...
On 2017-4-26 at 11:45 PM, keafter said:

 

Hmm If the suggestion I made doesn't work, it might be helpful to have the code to test with. In my experience with autoit to open office, I've had troubles getting dates to be properly input. Luckily there was an easy fix by  using _OOoCalc_NumberFormat. Hmm, what happens if you pull the $NewURL with the url into a msgbox. Does it display the url correctly? I'm just wondering if somehow the structure of the url is being broken up or something. Yeah hmm. Code to look at would be good.

Hi unfortunately your suggestions did not work... BUT msgbox does not return anything either (unless i dones something wrong)

On 2017-5-3 at 8:46 PM, GMK said:

@mmoalem: I believe you're looking for _OOoCalc_HyperlinkInsert

this too didnt make a difference

EDIT - i think my problem is that clipget does not work... the clipboard is populated correctly but:

Local $NewURL = ClipGet()

does not seems to populate $NewURL with anything - msgbox returns an exclamation mark 

 

here is the whole code in case it helps

#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <OOoCalc.au3>

Opt("WinTitleMatchMode", 2)

;_OOoCalc_ComErrorHandler_UserFunction(_ErrFunc)

Global $sTitle = "Calc Demo"
$sFileName = "C:\Users\admin\Desktop\Autoit\Linkstest.xls"

MsgBox($MB_ICONINFORMATION + $MB_TOPMOST, $sTitle, $sFileName)
Global $oCalc = _OOoCalc_BookOpen($sFileName)
If @error Then Exit MsgBox($MB_TOPMOST, "Calc Test", "Unable to create new Book.")

WinWait("Calc")
WinSetState("Calc", "", @SW_MAXIMIZE)
WinActivate("Calc", "")

Global $URL = _OOoCalc_ReadSheetToArray($oCalc, "M1:M162") ;URLs
Global $Name = _OOoCalc_ReadSheetToArray($oCalc, "I1:I162") ;playlist name


For $i = 0 to UBound( $URL, 1) - 1
    For $j = 0 to UBound($URL, 2) - 1

        ClipPut($Name[$i][$j]);copy playlist name from sheet
        RUN('"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 18" -new ' & $URL[$i][$j] )
        Sleep (1000)
        WinSetState("mydailypick", "", @SW_MAXIMIZE)
        Sleep (45000);wait for ad to finish
MouseClick ( "",1161,831, 1)
Sleep (2000)
MouseClick ( "",997,202, 1)
Sleep (2000)
Send ("^v");paste playlist name
Sleep (2000)
Send("{Enter}");eneter playlist name
Sleep (2000)
MouseClick ( "",1155,285, 1);go to playlist
Sleep (2000)
send ("!d");select URL in browser
send ("^c");copy selected URL
Local $NewURL = ClipGet()
MouseClick ( "",1891,12, 1);close chrome
Local $m=$i+1
WinActivate("Calc", "")
Sleep (2000)
;_OOoCalc_HyperlinkInsert($oCalc, $NewURL, "N" & $m)
_OOoCalc_WriteCell($oCalc, $NewURL, "N" & $m, "Sheet8")
Sleep (2000)
        _ArrayDisplay($URL, "M1:M162") ;use to break
    Next


Next

 

Edited by mmoalem
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...