OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How to get my computer IP Address in Macro

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
metro123
Newbie
Newbie


Joined: 01 May 2006
Posts: 4

PostPosted: Tue May 02, 2006 12:03 am    Post subject: How to get my computer IP Address in Macro Reply with quote

Hi,all
I find some information in
http://api.openoffice.org/docs/DevelopersGuide/OfficeDev/OfficeDev.xhtml#1_2_7_1_Path_Settings
I try to use Starbasic to get my IP address, but I don't know how to do.

use Environment Values?

thanks.
Back to top
View user's profile Send private message
probe1
Moderator
Moderator


Joined: 18 Aug 2004
Posts: 2465
Location: Chonburi Thailand Asia

PostPosted: Tue May 02, 2006 5:47 am    Post subject: Reply with quote

Which OS?

If your IP is represented in an environment variable, you can get it with this
Code:

myIP = Environ("IPADDRESS")


Does this help?
_________________
Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs
Back to top
View user's profile Send private message Visit poster's website
metro123
Newbie
Newbie


Joined: 01 May 2006
Posts: 4

PostPosted: Tue May 09, 2006 10:06 pm    Post subject: Reply with quote

probe1 wrote:
Which OS?

If your IP is represented in an environment variable, you can get it with this
Code:

myIP = Environ("IPADDRESS")


Does this help?


it helps me a lot.

My OS is WinXP
can i use command like ipconfig in macro to get my IP address?

I want to write a macro to show a dialog like that when you open a document which save with password , you have to type the password to see the content.

I use a database and check IP address (or computername) to replace the password.
But i have no idea when you open the document,
how to make the document stop at the IP check dialog and the context is invisible?

any help??
thanks.
Back to top
View user's profile Send private message
probe1
Moderator
Moderator


Joined: 18 Aug 2004
Posts: 2465
Location: Chonburi Thailand Asia

PostPosted: Wed May 10, 2006 12:35 am    Post subject: Reply with quote

What's your utlimate goal?

You can save documents with passwords and are prompted for them if opening,
so you don't have to write your own routines for psw check.

If you would like to store a given password it externally, you have to intercept saving and opening.


You can run programs or scripts (batch.dos) with basic runtime command
Code:
Shell( myProgram.exe )
(see F1)
which enables you to write a batch to run ipconfig (or whatever) and set variables (export them) or redirect output.
_________________
Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs
Back to top
View user's profile Send private message Visit poster's website
Teme
General User
General User


Joined: 03 May 2006
Posts: 8
Location: Finland

PostPosted: Wed May 10, 2006 12:46 am    Post subject: Reply with quote

As soon as you call external program you lose possibility to move the macro somewhere else. Is using beanshell out of questions? With Java you can get ip-address really easily.

Teme
Back to top
View user's profile Send private message Visit poster's website
ms777
Super User
Super User


Joined: 07 Feb 2004
Posts: 1355

PostPosted: Wed May 10, 2006 12:05 pm    Post subject: Reply with quote

as a java laymen: How do you get your IP in Java ?
Back to top
View user's profile Send private message
Teme
General User
General User


Joined: 03 May 2006
Posts: 8
Location: Finland

PostPosted: Wed May 10, 2006 5:25 pm    Post subject: Reply with quote

I posted how to get IP address from Beanshell to code snippets. So here it is: http://www.oooforum.org/forum/viewtopic.phtml?p=145508

Some Java links:
The java tutorial mandatory reading to all Java coders
Java api documentation always open when coding
BeanShell manual

Teme
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group