Date   

Best way to orderly display dialogs etc.

Jean-Christophe Helary <jean.christophe.helary@...>
 

I'm finding that depending on the tell block in which it is launched, a "display dialog" will request the user to turn to that app to be reacted too.

What is the best way to have "application neutral" dialogs that don't require moving back to the tell application ?

I think Yvan mentioned a while ago that he used System Events to do that, but I'm not sure...


Jean-Christophe Helary
-----------------------------------------------
@brandelune http://mac4translators.blogspot.com


How do I use variable with 'using terms from'

Brian Christmas
 

G’day scripters.

I hope this is the last missing piece in my app.

With using GraphicConverter, I need to use ‘using terms from’, but the code is ‘locked’ into using the text 'GraphicConverter 10'.

If at all possible, I need versatile code that will use ANY version of GC.

However, all my efforts have been in vain, that handler just wont accept any variable.

As the old GC was just ‘GraphicsConverter;, and the new ones will be ‘GraphicConverter 11’ etc, I really, really need that variable method.

Any advice or guidance, please?

Regards

Santa

on printGraphicConverter()
try
tell application "Finder" to set theApps to (name of (every item of folder (path to applications folder))) as list
repeat with theApp2 in theApps
if theApp2 contains "GraphicConverter" then
set theUserApp to application theApp2
exit repeat
end if
end repeat
tell application "System Events"
set theApp to (bundle identifier of (info for (path to theUserApp))) as text
end tell
tell application "Finder" to set theProcesses to (name of processes) as list
repeat with theApp2 in theProcesses
if theApp2 contains "GraphicConverter" then
set theUserProcess to theApp2 as text
exit repeat
end if
end repeat
end try
#set temp to a reference to application "GraphicConverter 10"  
  using terms from theUserApp
tell application id theApp
launch
do shell script ("sleep 0.2")
try
close every window saving no
end try
end tell
  end using terms from
 end printGraphicConverter


Re: What is "system events" ?

Jean-Christophe Helary <jean.christophe.helary@...>
 

On Oct 20, 2017, at 17:40, Jean-Christophe Helary <jean.christophe.helary@gmail.com> wrote:

Is there a place that describes what System Events is, how it works, why it is necessary for some sorts of scripting, etc.?

Jean-Christophe
Thanks everybody for all the replies. I've made a summary of everything I gathered here:

https://mac4translators.blogspot.jp/2017/10/what-is-system-events.html

It's my beginner's take on the question so there really is nothing technical there. If you have comments or suggestions though, don't hesitate.

Jean-Christophe


Re: What is "system events" ?

 

Hey guys,

Here is a great, short video showing how to use SD6 to explore System Events, and then to drag/drop to create a big tell block:

Best Regards,

Jim Underwood
aka JMichaelTX


From: AppleScript-Users <applescript-users-bounces+jmichael=apoemail.us@...> on behalf of 2551phil <2551phil@...>
Date: Friday, October 20, 2017 at 4:21 PM
To: "AppleScript Sub-Group groups.io" <applescript@apple-dev.groups.io>, "ASUL (AppleScript)" <applescript-users@...>
Subject: Re: [applescript] What is "system events" ?

Note that you can do the same trick with any other app, too, not just System Events; i.e., see a live view of whatever app’s properties, classes, etc. 

The live inspector view, along with the variables view and SD’s dictionary viewer, are really what make SD worthwhile for me. I rarely have need to actually step into the debugger itself thanks to these.


Best


Phil
@sqwarq


On 21 Oct 2017, at 03:58, JMichaelTX <JMichael@...> wrote:

Phil,

Thanks for posting this.  This is a huge tip!
For those that don't have SD6, or, like me, not sure what Phil is referring to, here's a screen shot of the lower Inspector Panel of SD6, after I have entered the simple script below:


Re: Advice required with cURL, please! NOTE, another question!!

Brian Christmas
 

G’day all

Thanks to all of you who responded. Very useful information to be stored in my old brain.

I bit the bullet and rang Digital Pacific, my web hosts.

Apparently, cURL can only address files embedded inside websites, according to their technician.

My folder and txt file are in the same Server home folder as my two websites, but not embedded in one of them.

As my intention is to try and keep count of how many times each app has been installed under any given email address, on different machines (still to be worked out), I don’t want to update from the .txt file on my website to my website project on my iMac, every time I update the website itself.

However, if I use ftp, I CAN read and write to that darn home/folder/.txt file.




In order to use ftp, I will need to use my site login credentials. My App is execute-only, but I’ve read that execute-only code can be opened with a text editor, and read. I’ve taken steps to make life difficult for anyone trying this, with other data, but a question, please.




Is it true that ASObjC execute-only code can be read using a text editor?

If so, is there any way of preventing this (ATM I’m encrypting data).

Regards

 Santa

On 24 Oct 2017, at 2:14 am, Doug McNutt <douglist@...> wrote:


The list called:
  curl-users@...
is active and might have a better source of answers.

There is another curl list directed to folks willing to work on curl itself. Methinks you don't want that.

The contents of a file as a variable is probably quite dependent on things called "standard". Dot-txt is not enough unless you have some way of controlling what you ask for.

Is it too hard to receive the data as a file and just read it into a variable?

On Oct 22, 2017, at 20:53:06, Brian Christmas <ozsanta@...> wrote:

G’day scripters

I want to read a remote .txt file using cURL, and save the result to a variable, NOT a file.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (applescript-users@...)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/applescript-users/ozsanta%40gmail.com
Archives: http://lists.apple.com/archives/applescript-users

This email sent to ozsanta@...


Re: Applescript reference for MS Office ?

 

On Mon, Oct 23, 2017 at 03:18 pm, Jean-Christophe Helary wrote:
I'm looking for the PDFs that Microsoft published about scripting the MS Office suite.
I don't think you'll find any.  Google is your best bet.

You might look here:


Re: Applescript reference for MS Office ?

Jean-Christophe Helary <jean.christophe.helary@...>
 

I'm looking for the PDFs that Microsoft published about scripting the MS Office suite.
I do have access to the dictionaries.

The only PDFs I have (here, on my machine) are old Word 2004 references. I'm looking for the most recent ones.

Jean-Christophe 

On Oct 23, 2017, at 23:51, JMichaelTX <JMichael@...> wrote:

JC, I'm not sure what you're looking for?
The SDEF is installed when MSO is installed.
I'm sure you know, but in Script Editor, just open the Dictionary viewer, and select Microsoft Word/Excel/Outlook as needed.

Or, are you looking for something else?
A google search on "AppleScript Microsoft Office" (or the specific app) should yield a number of hits.

Best Regards,

Jim Underwood
aka JMichaelTX


From: "AppleScript Sub-Group groups.io" <applescript@apple-dev.groups.io> on behalf of Jean-Christophe Helary <jean.christophe.helary@...>
Reply-To: "AppleScript Sub-Group groups.io" <applescript@apple-dev.groups.io>
Date: Monday, October 23, 2017 at 8:29 AM
To: "AppleScript Sub-Group groups.io" <applescript@apple-dev.groups.io>
Subject: [applescript] Applescript reference for MS Office ?

I'm not finding the scripting references for MSO on MS site.

Would anybody have links?

Jean-Christophe


Re: Please Contribute to the AppleScript Wiki #wiki

 

OK, Chris, all of the links should now be fixed, and the Wiki viewable without logging in. Works for me in Safari and Chrome. Please test and confirm.


Re: Please Contribute to the AppleScript Wiki #wiki

 

Chris,

Thanks for notifying me.  I see the same thing in Safari.
I think it is due to my use of graphics from the JXA subgroup.  Jens has just now made me a moderator of the AppleScript subgroup, and I have changed the settings for all of the sections to allow member upload/edits.

So, I will be moving the graphics to the AppleScript subgroup shortly.  That should (I hope) fix the issue.

Best Regards,

Jim Underwood
aka JMichaelTX


From: "AppleScript Sub-Group groups.io" <applescript@apple-dev.groups.io> on behalf of Chris Stone <listmeister@...>
Reply-To: "AppleScript Sub-Group groups.io" <applescript@apple-dev.groups.io>
Date: Sunday, October 22, 2017 at 8:53 AM
To: "AppleScript Sub-Group groups.io" <applescript@apple-dev.groups.io>
Subject: Re: [applescript] Please Contribute to the AppleScript Wiki #wiki

On 10/21/2017, at 18:55, JMichaelTX <JMichael@...> wrote:
We have drafted the first rough draft of the AppleScript Wiki , a great feature provided by groups.io.


Hey Jim,

The Wiki shows broken graphics in Safari.

--
Best Regards,
Chris



Re: Please Contribute to the AppleScript Wiki #wiki

Christopher Stone
 

On 10/21/2017, at 18:55, JMichaelTX <JMichael@...> wrote:
We have drafted the first rough draft of the AppleScript Wiki , a great feature provided by groups.io.


Hey Jim,

The Wiki shows broken graphics in Safari.

--
Best Regards,
Chris



Re: Applescript reference for MS Office ?

 

JC, I'm not sure what you're looking for?
The SDEF is installed when MSO is installed.
I'm sure you know, but in Script Editor, just open the Dictionary viewer, and select Microsoft Word/Excel/Outlook as needed.

Or, are you looking for something else?
A google search on "AppleScript Microsoft Office" (or the specific app) should yield a number of hits.

Best Regards,

Jim Underwood
aka JMichaelTX


From: "AppleScript Sub-Group groups.io" <applescript@apple-dev.groups.io> on behalf of Jean-Christophe Helary <jean.christophe.helary@...>
Reply-To: "AppleScript Sub-Group groups.io" <applescript@apple-dev.groups.io>
Date: Monday, October 23, 2017 at 8:29 AM
To: "AppleScript Sub-Group groups.io" <applescript@apple-dev.groups.io>
Subject: [applescript] Applescript reference for MS Office ?

I'm not finding the scripting references for MSO on MS site.

Would anybody have links?

Jean-Christophe


Applescript reference for MS Office ?

Jean-Christophe Helary <jean.christophe.helary@...>
 

I'm not finding the scripting references for MSO on MS site.

Would anybody have links?

Jean-Christophe


Re: Advice required with cURL, please!

2551phil
 


On 23 Oct 2017, at 12:18, Brian Christmas <ozsanta@...> wrote:

And, Phil, using System Events is a habit, as I often write and text ASCObjC code in Script Editor, or Script Debugger, and just copy and paste when it’s working. Use the same variables. Also why I used the ‘my ‘. I’ve just found it a good habit to get into.

Display Dialog has absolutely nothing to do with System Events. It’s defined in Standard Additions. While a single invocation like this probably doesn’t do any harm other than introduce an unnecessary delay, it could well cause you problems if you’re doing that repeatedly or excessively in your 10000+ line scripts.

‘my’ is a synonym of the ‘me’ keyword. Unless you enjoy bugs, you shouldn’t be using it habitually like some magic voodoo, but only when it’s required. For correct use, see the AppleScript Language Guide under the section ‘The it and me keywords’.


Best


Phil
@sqwarq




Re: Advice required with cURL, please!

Brian Christmas
 

Thank you Phil & Steve.

There seems to be some sort of underlying problem.

To start, I’ll make sure you know what I’m trying to do.

On my home folder of my website I have two websites…


I have created a folder at the same level, ‘Email List’

In this I have created a txt file, 'Used Emails.txt', using the file creator of Rapid Weaver.

I want to read that txt file, check there is no more than 2 given copies of a particular email address in it, and if not, add the email address and the company name at the end of the text file, as a list.

I’ve tried following your advice, and also tried to open the page, and the folder, and the txt file, using Safari.

However, I’m getting a double colon in the Safari error message, and simply don’t know why! (/http/::)


I’ve also ensured I have full stop where every name on the site lists as a space.

And, Phil, using System Events is a habit, as I often write and text ASCObjC code in Script Editor, or Script Debugger, and just copy and paste when it’s working. Use the same variables. Also why I used the ‘my ‘. I’ve just found it a good habit to get into.
 

property EmailAddress : "ozsanta@..."
property businessName : “meSelfSoftWare.com"





 

tell application "Safari"
open theCheckPath
end tell

try
# set (my theEmailList) to do shell script "curl " & theCheckPath
# set (my theEmailList) to do shell script "curl file_get_contents " & theCheckPath
do shell script "curl  file_get_contents " & theCheckPath & " echo " & (my theEmailList)
set theEmailList to do shell script "curl " & theCheckPath
on error
say 0.1
set theEmailList to {}
end try
try
if kind of theEmailList is not list then set theEmailList to {}
on error errmsg number errnum
if errnum = -1728 then set theEmailList to {}
end try
try
set end of theEmailList to {{EmailAddress}, {businessName}}
on error errmsg
set end of theEmailList to {{EmailAddress}, {businessName}}
tell application "System Events" to display dialog errmsg
end try
say 2
try
do shell script "curl -T -d " & theEmailList & " --url " & theCheckPath
on error errmsg
tell application "System Events" to display dialog errmsg
end try


theEmailList


Re: Advice required with cURL, please!

2551phil
 


On 23 Oct 2017, at 10:44, Brian Christmas <ozsanta@...> wrote:

<head><title> 404 Not Found


This tells you that the url string you’re sending is wrong.

Start with a simple one-liner like this:

do shell script "curl " & “https:…/../.html”

until it works. Then build up from that.

Also, you’re getting the error message because you’re illegally trying to use ‘set end of’ on a string instead of on a list.

And why are you calling display dialog from system events?



Best


Phil
@sqwarq






Re: Advice required with cURL, please!

Brian Christmas
 

Steve, thanks for trying, but your code, and my slightly amended code, both return…

Can’t set end of "<!DOCTYPE html>
<html style=\"height:100%\">
<head><title> 404 Not Found
</title></head>
<body style=\"color: #444; margin:0;font: normal 14px/20px Arial, Helvetica, sans-serif; height:100%; background-color: #fff;\">
<div style=\"height:auto; min-height:100%; \">     <div style=\"text-align: center; width:800px; margin-left: -400px; position:absolute; top: 30%; left:50%;\">
        <h1 style=\"margin:0; font-size:150px; line-height:150px; font-weight:bold;\">404</h1>
<h2 style=\"margin-top:20px;font-size: 30px;\">Not Found
</h2>
<p>The resource requested could not be found on this server!</p>
</div></div></body></html>" to {{"ozsanta@..."}, {"meSelfSoftWare.com"}}.

What I want is the CONTENT of the file, not its properties, please?

AND, is my saving line correct?

I’m completely guessing, and Shane’s told me ‘DON’T GUESS!’, BUT I CAN’T WORK THE TERMINOLOGY OUT!.

What I THINK I’m doing wrong is addressing the .txt file in the wrong way. <p>The resource requested could not be found on this server!</p> I have no idea what I’m supposed to do, and have read the cURL help and examples over and over. I just cannot wrap my mind around what I’m doing wrong!

Regards

Santa

property EmailAddress : "ozsanta@..."
property businessName : "meSelfSoftWare.com"
property theEmailList : {}


set theCheckPath to "http://meselfsoftware.com/xxxxx%20list/xxxx%20Email.txt/“ # Modified for posting

set (my theEmailList) to {}
try
say 0
set (my theEmailList) to do shell script "curl file_get_contents " & theCheckPath
set (my theEmailList) to do shell script "curl  " & theCheckPath # Steve’s script
# do shell script "curl  file_get_contents " & theCheckPath & " echo " & (my theEmailList)
on error
say 0.1
set (my theEmailList) to {}
end try
if (count of (my theEmailList)) = 0 then set (my theEmailList) to {}
say 1
try
set end of theEmailList to {{EmailAddress}, {businessName}}
on error errmsg
set end of theEmailList to {{EmailAddress}, {businessName}}
tell application "System Events" to display dialog errmsg
end try
say 2
try
do shell script "curl -T -d " & (my theEmailList) & " --url " & theCheckPath
on error errmsg
tell application "System Events" to display dialog errmsg
end try


theEmailList

I’m deriving the path from this… which is in the same site folder

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>URL</key>
</dict>
</plist>

The Site Inspector say their folder is /home/meselfso






On 23 Oct 2017, at 1:50 pm, Steve Mills <sjmills@...> wrote:

On Oct 22, 2017, at 20:53:06, Brian Christmas <ozsanta@...> wrote:

G’day scripters

I want to read a remote .txt file using cURL, and save the result to a variable, NOT a file.

set x to do shell script "curl " & theURL

--
Steve Mills
Drummer, Mac geek

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (applescript-users@...)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/applescript-users/ozsanta%40gmail.com
Archives: http://lists.apple.com/archives/applescript-users

This email sent to ozsanta@...


Advice required with cURL, please!

Brian Christmas
 

G’day scripters

I want to read a remote .txt file using cURL, and save the result to a variable, NOT a file.

If necessary, I want to add to that variable, and write it back to the remote file.

Just can’t get it right. Plenty of advice online on saving or transferring a FILE, but things get awkward when limited to a variable. Simply can’t find info!

The following doesn’t error, but also doesn’t save.

Can someone tell me how to go about the right cURL method, please?

Regards

Santa

property EmailAddress : "ozsanta@..."
property businessName : “xxxxxxxxxxxxxxxxx.com"

  

 

try
say 0
do shell script " curl  file_get_contents " & theCheckPath & " echo " & theEmailList
on error
say 0.1
set theEmailList to {}
end try
if (count of theEmailList) = 0 then set theEmailList to {}
say 1
set end of theEmailList to {{EmailAddress}, {businessName}}
say 2
do shell script "curl -T -d " & theEmailList & " --url " & theCheckPath


theEmailList


Re: What is "system events" ?

Jean-Christophe Helary <jean.christophe.helary@...>
 



On Oct 22, 2017, at 9:49, Jean-Christophe Helary <jean.christophe.helary@...> wrote:

On Fri, Oct 20, 2017 at 02:09 am, Bill Cheeseman wrote:
There are links and a lot of commentary on my website: http://pfiddlesoft.com. Look at the UI Browser section first, then maybe the frameworks page.
Bill, thanks for the reference, but I was unable to find any references to "System Events" on either of those sections.  I did a browser search for "system", and it didn't find anything.  Did I miss them?

The tidbits article written by Matt Neuburg is in my opinion the most important as far as understanding what System Events is.

The tidbits article was super well hidden in the pages:

http://pfiddlesoft.com → [UI Browser] → (above the screenshot) [Reading] → [PreFab UI Browser 2.0 Better Than Ever]

Et voilà !

Bill, maybe you should make it a way that the [Reading] section is easier to see.

Jean-Christophe 


Re: What is "system events" ?

Jean-Christophe Helary <jean.christophe.helary@...>
 

Thank you.
I mentioned the article because it was available online form your site.

Jean-Christophe 

On Oct 22, 2017, at 16:37, Bill Cheeseman <wjcheeseman@...> wrote:

As far as I know, the most thorough writeup of GUI Scripting specifically is chapter 28 of the book I co-wrote with Sal Soghoian, "AppleScript 1-2-3", part of the Apple Training Series, published by Peachpit Press in 2009.

On Oct 21, 2017, at 8:49 PM, Jean-Christophe Helary <jean.christophe.helary@...> wrote:

The tidbits article written by Matt Neuburg is in my opinion the most important as far as understanding what System Events is.

-- 

Bill Cheeseman - wjcheeseman@...



Re: What is "system events" ?

Bill Cheeseman
 

As far as I know, the most thorough writeup of GUI Scripting specifically is chapter 28 of the book I co-wrote with Sal Soghoian, "AppleScript 1-2-3", part of the Apple Training Series, published by Peachpit Press in 2009.

On Oct 21, 2017, at 8:49 PM, Jean-Christophe Helary <jean.christophe.helary@...> wrote:

The tidbits article written by Matt Neuburg is in my opinion the most important as far as understanding what System Events is.

-- 

Bill Cheeseman - wjcheeseman@...

161 - 180 of 275