Sign in to follow this  
Followers 0
amokoura

ObjGet() starts a process

7 posts in this topic

Problem: ObjGet($document) opens a new process if the document isn't open.

How can I prevent starting a new process? Is there any way to check if the document is already open?

Share this post


Link to post
Share on other sites



Your options will depend on the Automation Object you are calling. Suggest you provide more details.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

It's an access object.

If the program is running, objget("path_to_database_file") would return the active access object.

If the program is not running, the same command starts a new access process. And that shouldn't happen in my script.

So I would need a method to find out if access is open with a specific database file. After the check I could safely get the object without spawning a new process.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I think the way you must do this is to use something like this

$oAccess = ObjGet("", "Access.application")
If isObj($oAccess) Then ConsoleWrite("Access Is Running" & @CR)

If access is running, $oAccess will be an object and then you can use its Object Model to determine if your target database is loaded. If it is not an object, then Access is not running and it is not started as a result of the ObjGet.

Dale

Edit: clarity

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

$oAccess = ObjGet("", "Access.application")
If isObj($oAccess) Then ConsoleWrite("Access Is Running" & @CR)
Thank you but there's a problem: when multiple Access applications are open, that trick can't tell whether the specific access project is open.

Share this post


Link to post
Share on other sites

Thank you but there's a problem: when multiple Access applications are open, that trick can't tell whether the specific access project is open.

Sad, but true. All you can do then is close the first one and then ObjGet the second.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Yes that's what I deduced also. Sad :)

If there was any chance of seeing the open documents, not applications.. :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0