Re: Dilemma
Re: Dilemma
- Subject: Re: Dilemma
- From: Andreas Kiel <email@hidden>
- Date: Tue, 18 Jul 2017 12:29:02 +0200
Create a list of list with a repeat loop -> {{true, "PDF"},{{true, "JPEG"},
...}
Fill a table with it.
Read out the data rows of the tableView -> {{true, "PDF"},{{false, "JPEG"},
...}
On Jul 18, 2017, at 11:38 AM, Takaaki Naganoya wrote:
> There is many ways to reduce the number of button or checkbox.
>
> (1)Saved Preset
>
> The number of pattern to indicate each option is very limited (if there is a
> lot of option).
> So, we prepare “Presets” and choose one.
>
> (2)Hierarchical menu
>
> (3)Other
>
> --
> Takaaki Naganoya
> email@hidden
> http://piyocast.com/as/
>
>> 2017/07/15 10:24、Takaaki Naganoya <email@hidden>のメール:
>>
>> Your program looks like following…
>>
>> https://static1.squarespace.com/static/51cdafc4e4b09eb676a64e68/t/57968696197aea844556ed01/1469482650889/?format=1000w
>>
>> https://www.pixar.com/lifted/#lifted-1
>>
>> --
>> Takaaki Naganoya
>> email@hidden
>> http://piyocast.com/as/
>>
>>> 2017/07/06 16:17、Brian Christmas <email@hidden>のメール:
>>>
>>> G’day scripters
>>>
>>> I want to be able to switch on the GraphicConverter printing of all of the
>>> 276 different formats it can print, selectively.
>>>
>>> Rather than create 276 properties, I’ve set up 276 check boxes, with the
>>> same action, and each with a Title matching each of the graphic formats, on
>>> one window, and a box. All unlinked to a property.
>>>
>>> In the action, I can get the Title OK, but can’t work out a way of getting,
>>> (and perhaps setting), the value (ticked or unticked).
>>>
>>> I’ve tried to just use the Title to address each box, but the code errors.
>>> Any suggestions on how I might avoid adding 276 properties (I’ll leave the
>>> feature out of my App before I resort to that).
>>>
>>> Here’s the code I’m trialling before adding it to my App. (And no, Shane
>>> won’t answer, I’m personna non-gratis to him since I criticised ‘Script
>>> Debugger’, with two major bugs that went unfixed for weeks after my
>>> reporting them, and are still unfixed many months later)
>>>
>>> Regards
>>>
>>> Santa
>>>
>>> --
>>> -- AppDelegate.applescript
>>> -- GC Name Extension lister
>>> --
>>> -- Created by Brian Christmas on 6/7/17.
>>> -- Copyright © 2017 MeSelf Software. All rights reserved.
>>> --
>>>
>>> script AppDelegate
>>> # property parent : class "NSObject"
>>> property parent : class "ObjectWithFords"
>>>
>>> -- IBOutlets
>>> property ListWindow : missing value
>>> property box1 : missing value
>>> property listValues : {}
>>> property firstCheckBox : missing value
>>> property ListWindowSetUp : false
>>> property ExtValueDict : {}
>>> property mailManagerDesktopFolderPath : ((path to desktop as text) &
>>> "Mail Manager Folder:")
>>> property setUpExtension : false
>>> property extensionsToIgnore : {".D", "8BIM", "AAI", "Acorn Sprite",
>>> "AFP", "ALIAS", "AMBER ARR", "AMC", "Analyze", "ANI", "ANI", "ANPA", "Apple
>>> File Icon", "Apple Preferred", "ART", "ARW", "ASCII", "Atari Portfolio",
>>> "B3D", "Bio", "BioRad", "BLD", "BMP", "BSB", ¬
>>> "BSP", "BUF", "BUM", "Byte-Array Hea- der File (.H)", "CALS",
>>> "c4", "CAM", "CALS", "CEL", "CGM", "Chyron", "cicn", "CINEON",
>>> "CISCOIpPhoneI mages", "CLP", "cri", "CRW", "CR2", "csource", "CT", "CUR",
>>> "CVG", "CWK", "DCS", "DCR", "DCX", "DDS", "DeltaVision", ¬
>>> "DESR VFF", "DICoM", "Direct icns", "Diskus YUV", "DJ1000",
>>> "DL", "dm2/dm3", "DNG", "Doodle", "DPX", "Dr. Halo", "DrawIT", "ECW",
>>> "ElectronicImage", "EPSF", "ESM", "Facesaver", "Favicon ICO", "FAX",
>>> "FaxSTF", "fep", "fig", "First Publisher art", "FireViewer PDB", ¬
>>> "FITS", "FLH/FLI/FLC", "FPX", "Freehand 10", "FUJI", "GATAN",
>>> "GEM", "GFX", "GIF", "GrayPaint", "GRP", "HAM", "HD Photo (wdp)", "HDR",
>>> "HP-GL/2", "HGT", "HMR", "HTC splashscreens", "IBL", "IBM PIC", "IC ?
>>> Imagic", "lcd5", "ICo/ICN", "IFF/LBM", "IM", "Image ->Finder", ¬
>>> "ImageLab/PrintTechnic", "IMG/XIMG", "IMQ", "IPLab", "ithmb",
>>> "IRIS", "ISS", "j6i", "JBI", "JEDMICS C4", "JIF", "JNG", "JPEG/JFIF", "JPEG
>>> 2000", "JPF", "JPX", "KDC", "Keynote PICT", "KISS CEL", "Koala", "Kodak
>>> DCS", "KoNTRoN", "LDF", "Liberty IM", "LIFF", "LOGO", ¬
>>> "Lotus-PIC", "LuraDocument", "LWF (LuraWave)", "MacDraw I",
>>> "MacPaint", "MAG", "MAYA-IFF", "MBM (Psion 5)", "Meteosat 5", "MDC",
>>> "Meteosat 5", "MHT", "MonkeyLogo", "MonkeyCard", "Mov", "MPO", "MP2",
>>> "MRC", "MrSID", "MRW", "MSP", "MSX MSX2, MSX+ - MSX2+", "NAA/IPTC", ¬
>>> "NASA Raster Metafile", "NEF", "NEO", "NGG/NCG", "NIF", "NIST
>>> PCT", "Nokia .pict", "NoL", "NV12", "ODF", "oNCoR", "ORF", "OTA", "P ? ?
>>> Degas", "Palette", "Palm image stream", "PAM", "PAC STAD", "PaperPort
>>> (MAX)", "PBM/PGM/PPM", "PCD", "PCX", "PIC (32K)", "PIC", ¬
>>> "PIC", "PIC", "PICS", "PICT", "PICT resource", "PDB", "PDF",
>>> "PDS3", "PEF", "PFM", "PGC/PGF", "Photo PDB", "Photostudio", "PGPF",
>>> "PGC/PGF", "Photo Raw", "PIX", "PM", "PNG", "PoRST", "PowerPoint", "Ppat",
>>> "PSD", "PSP", "PTG", "PWP", "Pxx - Degas", "QDV", "QNT", "QTIF", ¬
>>> "QTL", "RAF", "RAW", "RDC", "RIFF", "RLA", "RLE", "RSB", "RTF",
>>> "RW2", "SCR", "SCR", "Scrap", "ScreenShot Hack PDB", "SCX", "SFF", "SFW",
>>> "SGI", "SHP", "SHS", "SIGMA SD10 raw", "Sinclair QL", "SIXEL", "SKETCH",
>>> "SMV", "SNX", "SoFTIMAGE", "SPC", "SRF", "ST X SBIG", "StartupScreen
>>> s", ¬
>>> "STV", "SUN", "Super-Hi-Res 3200", "SVG", "SWF", "System 7
>>> clip", "TBC", "TCL", "TealPaint PDB", "TEX", "TGA", "TIFF", "TIM PSX",
>>> "Tiny Viewer PDB", "TN ?", "TRS-80", "VBM", "VFF", "VGS-8", "VITRoNIC",
>>> "VoXEL", "VPB", "VPM", "WBIN", "WBMP", "wbz", "wdb", "Webp", "Winfax
>>> (FXM)", "Winmail.dat", ¬
>>> "WMF", "WPG", "X11", "X3F", "XBM", "XCF", "XFIG", "X-Face",
>>> "XPM", "XWD", "YUV"} -- "asc" is signature
>>>
>>> on applicationWillFinishLaunching:aNotification
>>> -- Insert code here to initialize your application before any
>>> files are opened
>>> tell me to activate
>>> my displayExtensionsWindow()
>>> end applicationWillFinishLaunching:
>>>
>>> on displayExtensionsWindow()
>>> set (my setUpExtension) to true
>>> tell application "Finder"
>>> if not (exists file ((my mailManagerDesktopFolderPath
>>> as text) & "Extension Data.plist")) then
>>> say 1
>>> set listValuesTemp to ""
>>> repeat with eachExtension in (my
>>> extensionsToIgnore)
>>> set listValuesTemp to listValuesTemp &
>>> true & "," as text
>>> end repeat
>>> set listValuesTemp to characters 1 through -2
>>> of listValuesTemp as text
>>> tell application "System Events" to display
>>> dialog listValuesTemp
>>> set (my listValues) to listValuesTemp
>>> set (my ExtValueDict) to current application's
>>> NSDictionary's dictionaryWithObjects:{(my extensionsToIgnore)}
>>> forKeys:{listValuesTemp}
>>> my SaveExtensionData()
>>> else
>>> set (my setUpExtension) to false
>>> end if
>>> end tell
>>> try
>>> tell ListWindow to display()
>>> end try
>>> my fordEvent()
>>> try
>>> tell me to activate
>>> end try
>>> ListWindow's makeKeyAndOrderFront:me
>>> if not (my setUpExtension) then my clickBoxesToSetUp()
>>> end displayExtensionsWindow
>>>
>>>
>>> on setUpTitleValue:sender
>>> set tempSender to sender
>>> try
>>> set p to 1
>>> set tempTitle to tempSender's title() as text
>>> say tempTitle -- < Works OK!
>>> set p to 2
>>> if (my setUpExtension) then
>>> set p to 2.1
>>> tell application "System Events" to tell
>>> process "GC Name Extension lister"
>>> set p to 2.2
>>> tell window "Extensions active setter"
>>> set p to 2.3
>>> set tempV to value of checkbox
>>> tempTitle of group 1 as boolean
>>> end tell
>>> end tell
>>> say tempV as text
>>> set temp of (my ExtValueDict) to tempV
>>> my SaveExtensionData()
>>> else
>>> set p to 3
>>> tell application "System Events"
>>> set value of sender to temp of (my
>>> ExtValueDict)
>>> end tell
>>> end if
>>> on error errmsg number errnum
>>> tell application "System Events" to display dialog
>>> ("AppDelegate's setUpTitleValue " & " p = " & p & " " & errmsg as text)
>>> end try
>>> end setUpTitleValue:
>>>
>>> on SaveExtensionData()
>>> try
>>> set thePPath to POSIX path of ((my
>>> mailManagerDesktopFolderPath as text) & "Extension Data.plist") as text
>>> end try
>>> try
>>> tell application id "com.apple.systemevents"
>>> (my ExtValueDict)'s writeToFile:thePPath
>>> atomically:true
>>> end tell
>>> on error errmsg number errnum
>>> tell application "System Events" to display dialog
>>> ("AppDelegate's SaveExtensionData " & errmsg as text)
>>> end try
>>> end SaveExtensionData
>>>
>>> on clickBoxesToSetUp()
>>> set thePPath to POSIX path of (((my
>>> mailManagerDesktopFolderPath) & "Extension Data.plist") as text)
>>> set theflag to true
>>> tell application "Finder"
>>> if (not (exists file (my mailManagerDesktopFolderPath &
>>> "Extension Data.plist" as text))) then set theflag to false
>>> end tell
>>> if theflag then
>>> try
>>> set (my ExtValueDict) to current application's
>>> NSDictionary's dictionaryWithContentsOfFile:(thePPath) # POsIX path
>>> end try
>>> end if
>>> tell ListWindow
>>> tell application "System Events" to tell process "GC
>>> Name Extension lister"
>>> repeat with eachBox in (get every checkbox)
>>> click eachBox
>>> end repeat
>>> end tell
>>> end tell
>>> set (my setUpExtension) to true
>>> end clickBoxesToSetUp
>>>
>>> on applicationShouldTerminate:sender
>>> -- Insert code here to do any housekeeping before your
>>> application quits
>>> return current application's NSTerminateNow
>>> end applicationShouldTerminate:
>>>
>>> end script
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> applescriptobjc-dev mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> applescriptobjc-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> applescriptobjc-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
Andreas Kiel
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >Re: Dilemma (From: Takaaki Naganoya <email@hidden>) |
| >Re: Dilemma (From: Takaaki Naganoya <email@hidden>) |