[update at 18:34] I have the code working! I will post my changes later, as I have spotted another quirk.
When I tried to post a real tweet to the active account, which has been disabled it posted tweets from what seems to be a cache, as these were from code that had been replaced!
Hello Yvan,
I have spotted some anomalies with Twitter Scripter, as I tested it independently to your script.
1 - The image size must not be too large - this is known to be a problem with twitter, so not surprised
2 - You can’t post the same tweet twice! I.e. Tweet24 will only post once. If you change to Tweet24a it will post the tweet.
I ran your code and the log output for howMany 1 is:
The log output for howMany 3 is:
Using the code below, to test if the system was even working, I do get Tweets and Tweets with images. I have to change the text or image for it to post every time I run it though. Something you fixed in a previous script, as we did get the tweets cycling through the available list, and then restarting at the beginning.
tell application "Twitter Scripter"
-----------------------------------------
-- Account commands
-----------------------------------------
-- returns a list of usernames for the OS defined Twitter accounts
set availableAccounts to available accounts
-- Test to check we've got at least one account
if ((count of availableAccounts) is 0) then
tell application "Finder"
activate
display dialog "Please set up at least one Twitter account in your System Preferences, and allow it to be accessed by \"Twitter Scripter\"" buttons {"OK"} default button "OK" with icon 2 with title "No Available Twitter Accounts"
end tell
return
end if
set twitterAccount to item 3 of availableAccounts -- choose the right account!
# 1 Should = Prescience
# 2 Shoud = MainAccount
# 3 Should = TestingAccount
# tweet "I'm trying out #TwitterScripter from @mousedownsoft again." using account twitterAccount
-- Works but does not post the same tweet twice! If you adjust by a character it does. Could twitter handler be caching tweets?
set imagePath to "Macintosh HD:Users:??????:Pictures:test2.jpg" -- replace with your own path
tweet "#TwitterScripter #image size matters! By @mousedownsoft with an image defined in the above settings." using account twitterAccount with image imagePath
end tell
return twitterAccount
-- Displays in the result window the account set under 'item' from available accounts
-- Result window displays: TestingAccount
It would seem from the log that the outputs is exactly as desired, it would appear to be something with Twitter Scripter when it comes to posting the tweets. T
What are you dropping onto the script ?
You are supposed to drop a group of files. If you drop a folder the script will be unable to work because droppedFiles will be { theDroppedFolder as alias}.
The loop supposed to issue the tweets will try to create a tweet with the folder where it’s supposed to pass a file.
I edited the script in message #33 so that it creates the log file when you use it.
May you run it ?
As is, the new version has two entry points so, when it’s saved as an application, we may call it by a double click or by drag & drop.
We may also run it from the script editor so we may see the events log during the execution process.
Yvan KOENIG running Sierra 10.12.5 in French (VALLAURIS, France) mercredi 12 juillet 2017 12:17:18
on saveExcelAsPDF(documentPath, PDFPath) -- params = two HFS paths
set tFile to (POSIX path of documentPath) as POSIX file -- get a posix file object to avoid grant access issue with 'Microsoft Office 2016', not the same as (file documentPath) when using the 'open ...' command
tell application "Microsoft Excel"
set isRun to running
set wkbk1 to open workbook workbook file name tFile
alias PDFPath -- This is necessary to any script for 'Microsoft Office 2016', this avoid errors with any "save ... " command
save workbook as wkbk1 filename PDFPath file format PDF file format with overwrite
close wkbk1 saving no
if not isRun then quit
end tell
end saveExcelAsPDF
The code may be modified to fit your needs.
Yvan KOENIG running Sierra 10.12.5 in French (VALLAURIS, France) vendredi 14 juillet 2017 10:20:27