Jump to content
  • 0

AppleScript vraagje


Peter Wagemans

Question

Posted

Ik ben een AppleScript applicatie aan het bouwen die met FileMaker babbelt en moet weten in mijn code wat de naam van het actieve venster is.

De code

tell application "FileMaker Pro Advanced"
name of front document
end tell

blijkt niet te werken, ik krijg de naam van een achterliggend venster.

Iemand een idee hoe ik dit best aanpak?

5 answers to this question

Recommended Posts

  • 0
Posted

Peter,

 

ipv document kan je window gebruiken, dan krijg je de naam van het actieve venster.

Bij document lijkt het steeds de laatst geopende bestandsnaam weer te geven... raar!

 

tell application "FileMaker Pro Advanced"

name of front window

end tell

  • 0
Posted

Hey dreeke, weer een tijdje geleden!

 

Bedankt voor de tip, hij werkt! Probleem was natuurlijk dat ik de echte documentnamen moest hebben, FileMaker Pro voorziet standaard geen "document of front window" methode. Ik stak volgende routinetje in mekaar om het toch op te kunnen vragen.

Misschien iemand die een "whose" constructie in mekaar kan steken, zodat ik niet door de documenten moet lopen?

Nogmaals bedankt André.

 

to GetFrontDocument()
tell application "FileMaker Pro Advanced"
	repeat with theDocument in (every document)
		repeat with theWindowName in (name of every window of theDocument)
			if ((theWindowName as text) is (name of front window)) then return theDocument
		end repeat
	end repeat
	return "?"
end tell
end GetFrontDocument

name of GetFrontDocument()

  • 0
Posted

Hoi Koen - jouw boodschap zie ik nu pas. Het is inderdaad nogal raar, niet?

Bovenstaand routinetje laat ook ruimte voor fouten, in het speciale gevalleke dat er 2 windows met dezelfde naam een verschillend document hebben... :?

  • 0
Posted
Bovenstaand routinetje laat ook ruimte voor fouten, in het speciale gevalleke dat er 2 windows met dezelfde naam een verschillend document hebben...

Hier vond ik een simpele oplossing voor:

to GetFrontDocument()
tell application "FileMaker Pro Advanced"
	repeat with theDocument in (every document)
		repeat with theWindowIndex in (index of every window of theDocument)
			if ((theWindowIndex as integer) is (index of front window)) then return theDocument
		end repeat
	end repeat
	return "?"
end tell
end GetFrontDocument

name of GetFrontDocument()

 

BTW, ik heb net een mailtje gekregen van de mannen van LateNight Software gekregen:

It is with great pride that we announce the release of Script Debugger 4.0!

More than three years in the making, 4.0 was substantially reworked to take

full advantage of Mac OS X technologies and to recognize changes in

AppleScript under OS X.

 

View the more than 20 new features that Script Debugger 4.0 offers at:

 

http://www.latenightsw.com/sd4/index.html

 

Try out the demo at:

 

http://www.latenightsw.com/sd4/download.html

 

If you own Script Debugger 3.0, you can upgrade to version 4.0 for US$99 at:

 

http://www.latenightsw.com/sd4/buy.html

Die demo moet je zeker eens bekijken. Ik heb niet getwijfeld om te upgraden.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...