Re: How can I read my code in a module in the Basic IDE with Basic code?
Johnny Rosenberg <[email protected]> Sun, 14 Aug 2011 20:06:13 +0200
| Newsgroups | gmane.comp.openoffice.devel.api |
|---|---|
| Message-ID | <CADo7T4dO89qA0imsVCLF+2UVCW22ioEcQhhHnQdGck4N_t+KrA@mail.gmail.com> |
2011/8/14 Johnny Rosenberg <[email protected]>: > 2011/8/14 Johnny Rosenberg <[email protected]>: >> 2011/8/14 Oliver Brinzing <[email protected]>: >>> Hi Johnny, >>> >>>> If I only can read all the text in one module at once, that would do >>>> it just fine. If there is a simple one-liner that reads just one >>>> function or subroutine, that's a bonus, and if I can read a dialogue >>>> that's even better=E2=80=A6 >>> >>> Have you tried: >>> >>> Sub Test() >>> >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim oLibs as Object >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim oLib as Object >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim sLib as String >>> >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim mTmp() >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim i as Integer >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim s as String >>> >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0sLib =3D "Standard" >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0oLibs =3D GlobalScope.BasicLibraries >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0If Not oLibs.hasByName(sLib) Then >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0MsgBox "Error re= ading " & sLib >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0EndIf >>> >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0oLib =3D oLibs.getByName(sLib) >>> >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0mTmp() =3D oLib.getElementNames() >>> >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0For i =3D 0 To uBound(mTmp()) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0s =3D s + mTmp(i= ) & Chr(13) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0Next i >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0MsgBox s >>> >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0MsgBox oLib.getByName(mTmp(0)) >>> >>> End Sub >> >> No, I didn't, but it seems to work for my global macros. I guess I >> need to change the =E2=80=9DoLibs =3D GlobalScope.BasicLibraries=E2=80= =9D line for local >> code (macros for the current document only), but to what? >> >> >> Regards >> >> Johnny Rosenberg >> =E3=82=B8=E3=83=A7=E3=83=8B=E3=83=BC=E3=83=BB=E3=83=AD=E3=83=BC=E3=82=BC= =E3=83=B3=E3=83=90=E3=83=BC=E3=82=B0 >> >>> Regards >>> Oliver >> > > Experimented a bit: > Sub Main > =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim A As String > > ' =C2=A0 =C2=A0 =C2=A0 Getting code from the tab =E2=80=9DSpel=E2=80=9D i= n the current document: > =C2=A0 =C2=A0 =C2=A0 =C2=A0A=3DThisComponent.BasicLibraries.getByName("St= andard").getByName("Spel") > =C2=A0 =C2=A0 =C2=A0 =C2=A0MsgBox A > End Sub > > Thanks for your hint! > > > Kind regards > > Johnny Rosenberg > =E3=82=B8=E3=83=A7=E3=83=8B=E3=83=BC=E3=83=BB=E3=83=AD=E3=83=BC=E3=82=BC= =E3=83=B3=E3=83=90=E3=83=BC=E3=82=B0 > Also tried with Dialogues, but (in my case, as an example) ThisComponent.DialogLibraries.getByName("Standard").getByName("Namndialog"), which is a simple dialogue, seems to be an object of some kind and it's not very obvious how to get the information I need from it (like labels names of buttons and other objects, which macro they call and so on). I guess I have to study it a bit closer, but all shortcuts (like if someone would like to provide an example of some kind or something) are welcome=E2=80=A6 After having studied it only for maybe a minute or so, it seems like I need to know what I'm looking for to look for it=E2=80=A6 But studying it m= ore might give me another impression of the whole thing, I don't know. Kind regards Johnny Rosenberg =E3=82=B8=E3=83=A7=E3=83=8B=E3=83=BC=E3=83=BB=E3=83=AD=E3=83=BC=E3=82=BC=E3= =83=B3=E3=83=90=E3=83=BC=E3=82=B0 --=20 ----------------------------------------------------------------- To unsubscribe send email to [email protected] For additional commands send email to [email protected] with Subject: help