Date   
Acrobat and PDF page boxes

rocketjam@...
 

The following script returns a page box and bleed box even if the PDF it is run on does not contain said boxes.

tell application id "com.adobe.Acrobat.Pro"

try

set trimSize to get trim box of page 1 of active doc

set bleedSize to get bleed box of page 1 of active doc

end try

end tell


Is there a way to have Acrobat tell you if the page boxes are present or not in a PDF?


Thanks,

RJay

Problems accessing properties of "window" class in System Prefences

Ilya Shebalin
 

Hello,
Whenever I try to refer to properties of the class «window» of Processes Suite "System Events» raises an error despite said properties being part of the dictionary for «window» element. So, even though «visible» is there the line «return visible of window 1 of process TheProcess» (the process is active and has its windows opened) returns «error number -1728 from visible of window 1 of process TheProcess». Now getting the value of the property «properties» returns coherent results but (1) the property is not listed in the Dictionary (2) the set of values it represents doesn’t include all the properties of the class «window» as per the dictionary. What gives?


Re: Automator task working with Mail

Takaaki Naganoya
 

2019/02/06 4:09、Keith Kaiser <wa0tjt@...>のメール:

I want to select a callsign (short string) in a Mail document, right click it and have it open; https://www.qrz.com/lookup/wa0tjt
the clicked string would be the wa0tjt part.

I created a 'Run Shell Script' workflow but I can't figure out how to make use of it in Mail. Would someone please walk me through the procedure to make this work.
Welcome to AppleScript Mailing List.

You’d better to make “Service” workflow to open fixed URL (https://www.qrz.com/lookup/) and selected string (wa0tjt).
I think it is not Mail.app oriented issue.


Takaaki Naganoya

--
Takaaki Naganoya
maro@...
http://piyocast.com/as/

Automator task working with Mail

Keith Kaiser
 

I want to select a callsign (short string) in a Mail document, right click it and have it open;  https://www.qrz.com/lookup/wa0tjt
the clicked string would be the wa0tjt part.

I created a 'Run Shell Script' workflow but I can't figure out how to make use of it in Mail. Would someone please walk me through the procedure to make this work.

Re: Dynamic creation of an AppleScript via AppleScript

2551phil
 


 The goal is to have some Apple Script commands in a plain text file to be used as a template.

On top of what Chris said, you can also create and run AppleScripts as .sh files.

Just write your AppleScript with a shebang targeting osascript:

#! /usr/bin/osascript
display dialog "hello, world"


Best


Phil

Re: Dynamic creation of an AppleScript via AppleScript

Christopher Stone
 

On 09/03/2018, at 09:24, Markus Ruggiero <mailinglists@...> wrote:
I want to create an AppleScript .scpt file programmatically without using Script Editor.


Hey Markus,

Have a look at these two post on the Applescript Users List.

--
Best Regards,
Chris
use framework "Foundation"
use framework "OSAKit"

set sourceURL to current application's class "NSURL"'s fileURLWithPath:"path/to/file.applescript"
set destURL to current application's class "NSURL"'s fileURLWithPath:"path/to/file.scpt"
set theScript to current application's OSAScript's alloc()'s initWithContentsOfURL:sourceURL
set theResult to theScript's compileAndReturnError:(missing value)
if theResult as boolean then
theScript's writeToURL:destURL ofType:(current application's OSAStorageScriptType|error|:(missing value)
end if




osacompile -o <object-file> <source-file>  (see the man page)



Dynamic creation of an AppleScript via AppleScript

Markus Ruggiero
 

Hi,

I want to create an AppleScript .scpt file programmatically without using Script Editor. The goal is to have some Apple Script commands in a plain text file to be used as a template. I want to create an AppleScript that should ask the user a couple questions and then use the answers to fill in the "template" and finally save the resulting script to disk.

Simplified example:

Template.txt contains

set theApplication to XXXXX
tell application theApplication
-- many things....
end tell

My script should ask the user for the name of the application, then load the template and replace XXXXX by what the user has given. At the end the result should become a .scpt file on disk.

Thanks for any help
---markus---

Re: AppleScript script unable to respond to a script statement correctly

Shane Stanley
 

On 25 Jun 2018, at 12:48 am, Ilya Shebalin <iljashebalin2@...> wrote:

Could I kindly ask you to elaborate a bit?
Let's say in one loop itemRef contains a reference to item 3 of RecList. If the loop before called "set RecList to every record of RecList", and item 2 of RecList was not a record, then what was item 4 is now going to be item 3.

You can change the contents of items in a list while looping, but you generally shouldn't do anything that might disturb the indexing.

--
Shane Stanley <sstanley@...>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>

Re: AppleScript script unable to respond to a script statement correctly

Ilya Shebalin
 

Could I kindly ask you to elaborate a bit?
24.06.2018, в 5:19, Shane Stanley написал(а):

On 24 Jun 2018, at 12:07 pm, Ilya Shebalin <iljashebalin2@...> wrote:

Tell me please what mistake I made.
You're redefining the value, and length, of RecList within you loop. That's a recipe for chaos.

--
Shane Stanley <sstanley@...>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>




Re: AppleScript script unable to respond to a script statement correctly

Shane Stanley
 

On 24 Jun 2018, at 12:07 pm, Ilya Shebalin <iljashebalin2@...> wrote:

Tell me please what mistake I made.
You're redefining the value, and length, of RecList within you loop. That's a recipe for chaos.

--
Shane Stanley <sstanley@...>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>

AppleScript script unable to respond to a script statement correctly

Ilya Shebalin
 

Hello,
I wrote a script which re-arranges items in a continuous order. The items are records each  containing two properties: text which is a paragraph of the original text and a number which denotes the paragraph's position in the original text. The items are to be ordered by placing them according to the numbered parameter values so that I could easily reverse the order by simply applying reverse property of list class to get the items sorted in a continuous ascending order. The script is as follows:

set RecList to {{ParagraphText:"On 18 Jun 2018, at 3:28 pm, Ilya Shebalin <iljashebalin2@...> wrote:", ParagraphPosition:1}, {ParagraphText:"That's how the as \"class utf8\" compiles in ScriptDebugger:", ParagraphPosition:3}, {ParagraphText:"", ParagraphPosition:4}, {ParagraphText:"Type this into a Script Debugger window:", ParagraphPosition:5}, {ParagraphText:"", ParagraphPosition:6}, {ParagraphText:"current date", ParagraphPosition:7}, {ParagraphText:"Compile, then go to the View Menu and choose Show Raw (Chevron) Syntax, and compile again. What do you see now?", ParagraphPosition:9}, {ParagraphText:"", ParagraphPosition:2}, {ParagraphText:"", ParagraphPosition:8}}
set NewRecList to {}
repeat until RecList is {}
repeat with itemRef in RecList
if ParagraphPosition of contents of itemRef = (count RecList) then
"log (count RecList):"
log (count RecList)
"log ParagraphPosition of contents of itemRef = (count RecList):"
log (ParagraphPosition of contents of itemRef = (count RecList))
set end of NewRecList to contents of itemRef
set (contents of itemRef) to missing value --a problem here!
"log (contents of ItemRef):"
log (contents of itemRef)
set RecList to every record of RecList
"log RecList:"
log RecList
"log (count RecList):"
log (count RecList)
end if
end repeat
end repeat

return {List1:NewRecList, List2:RecList}

Notice the log statements. Despite the fact that all statements resolve to true and contains expected values NewRecList contains duplicates of some items leaving alone others whereas the logic does not seemingly imply that. It should assign missing value to an item and consider only records, but it fails for that particular items.  Tell me please what mistake I made.

Happy day, 
I.S.

Re: TextEdit won't open a plain text file after writing to it with write cmd

Shane Stanley
 

On 18 Jun 2018, at 7:00 pm, Ilya Shebalin <iljashebalin2@...> wrote:

current date compiles into «event miscued» in SD and my Mac is set to Russian as default language.
OK, so those characters you see are what you need to use in «class utf8». When I change my system and keyboard to Russian, they are option-shift-+ and option-+.

--
Shane Stanley <sstanley@...>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>

Re: TextEdit won't open a plain text file after writing to it with write cmd

Ilya Shebalin
 

actually should've been «event misccurd» (auto-correction in action stood in the way)
18.06.2018, в 8:33, Shane Stanley написал(а):

On 18 Jun 2018, at 3:28 pm, Ilya Shebalin <iljashebalin2@...> wrote:

That's how the as "class utf8" compiles in ScriptDebugger:

Type this into a Script Debugger window:

current date

Compile, then go to the View Menu and choose Show Raw (Chevron) Syntax, and compile again. What do you see now?

Also, what language is your computer set to?

--
Shane Stanley <sstanley@...>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>






Re: TextEdit won't open a plain text file after writing to it with write cmd

Ilya Shebalin
 

current date compiles into «event miscued» in SD and my Mac is set to Russian as default language.
18.06.2018, в 8:33, Shane Stanley написал(а):

On 18 Jun 2018, at 3:28 pm, Ilya Shebalin <iljashebalin2@...> wrote:

That's how the as "class utf8" compiles in ScriptDebugger:

Type this into a Script Debugger window:

current date

Compile, then go to the View Menu and choose Show Raw (Chevron) Syntax, and compile again. What do you see now?

Also, what language is your computer set to?

--
Shane Stanley <sstanley@...>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>






Re: TextEdit won't open a plain text file after writing to it with write cmd

Shane Stanley
 

On 18 Jun 2018, at 3:28 pm, Ilya Shebalin <iljashebalin2@...> wrote:

That's how the as "class utf8" compiles in ScriptDebugger:
Type this into a Script Debugger window:

current date

Compile, then go to the View Menu and choose Show Raw (Chevron) Syntax, and compile again. What do you see now?

Also, what language is your computer set to?

--
Shane Stanley <sstanley@...>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>

Re: TextEdit won't open a plain text file after writing to it with write cmd

Ilya Shebalin
 

Hello again, Shane
That's how the as "class utf8" compiles in ScriptDebugger:
«class as  »:"class utf8"

18.06.2018, в 2:50, Shane Stanley написал(а):

On 18 Jun 2018, at 2:39 am, Ilya Shebalin <iljashebalin2@...> wrote:

I just have to figure out how to make quotes into as chevrons in precompiled AS code because my default locale is not en_EN. Maybe that's the cause of the error.

Go here and download a copy of Script Debugger: <https://latenightsw.com/sd7/download/>. Open one of your working scripts, then go to the View Menu and choose Show Raw (Chevron) Syntax. That should show you what you need.


--
Shane Stanley <sstanley@...>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>






Re: drafting/prototyping code ?

Maik Waschfeld
 

HI Jean-Christophe,

I want to draft or prototype with real text mixed with code and maybe graphs to get a better idea of the flow.

I’d recommend yEd Graph Editor by yWorks <https://www.yworks.com/>.

It’s Java based and it’s free.

See the Gallery <https://www.yworks.com/products/yfiles/gallery> for examples.


With kindest regards…
…Maik Waschfeld

(sent from my MBAir11)



Re: Automator find and replace text string

Shane Stanley
 

On 18 Jun 2018, at 12:29 am, Alastair Leith <qc.student.au@...> wrote:

no escape chars either
Escaping/quoting is only required for the shell, so there's no reason for it to appear anywhere other than Terminal, bash scripts, and do shell script.

--
Shane Stanley <sstanley@...>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>

Re: TextEdit won't open a plain text file after writing to it with write cmd

Shane Stanley
 

On 18 Jun 2018, at 2:39 am, Ilya Shebalin <iljashebalin2@...> wrote:

I just have to figure out how to make quotes into as chevrons in precompiled AS code because my default locale is not en_EN. Maybe that's the cause of the error.
Go here and download a copy of Script Debugger: <https://latenightsw.com/sd7/download/>. Open one of your working scripts, then go to the View Menu and choose Show Raw (Chevron) Syntax. That should show you what you need.


--
Shane Stanley <sstanley@...>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>

Re: TextEdit won't open a plain text file after writing to it with write cmd

Ilya Shebalin
 

I see the difference. I just have to figure out how to make quotes into as chevrons in precompiled AS code because my default locale is not en_EN. Maybe that's the cause of the error. 
17.06.2018, в 9:52, Shane Stanley написал(а):

On 17 Jun 2018, at 3:55 pm, Ilya Shebalin <iljashebalin2@...> wrote:

write theText to FileID as "class utf8"

You're still using quote marks instead of chevrons -- they are not the same things.

write theText to FileID as «class utf8»

Can you see the difference?