Re: Why does 1440 not equal 1440?
Re: Why does 1440 not equal 1440?
- Subject: Re: Why does 1440 not equal 1440?
- From: Robert Poland <email@hidden>
- Date: Thu, 04 Aug 2011 11:47:40 -0600
Thanks Mark,
That fixed it.
Tried to do that at the text editor level.
On Aug 4, 2011, at 11:31 AM, Mark J. Reed wrote:
> Because numbers aren't strings.
>
> 1440 = "1440" => false
>
> Try:
>
> if (temp - 0) = newB then . . .
>
>
> end
>
>
> On Thu, Aug 4, 2011 at 1:21 PM, Robert Poland <email@hidden> wrote:
>> Hi,
>> This script does not work.
>> The file "setBounds_Monitors" contains the line '2560 1440 iMac_27"', three
>> items separated by tabs.
>> I have tried creating this file with several text editors.
>> The display dialog shows the correct text but fails to equal.
>> What subtlety am I missing here?
>>
>> property theDataFile : POSIX file "Library/Scripts/Universal
>> Scripts/setBounds_Monitors" -- data file
>> global newR, newB
>> -- get screen size for monitor
>> tell application "Finder" to set {newL, newT, newR, newB} to bounds of
>> window of desktop
>> my monitorData()
>> display dialog newR & " X " & newB as text
>> on monitorData() -- screen parameters
>> set originalDelimiters to AppleScript's text item delimiters
>> set fileData to read file theDataFile
>> set AppleScript's text item delimiters to {return}
>> -- get line of data
>> repeat with i from 1 to (count text items of fileData)
>> set currentLineItem to (text item i of fileData)
>> set AppleScript's text item delimiters to {tab}
>> # parse out application name for comparison
>> set temp to text item 2 of currentLineItem
>> display dialog temp & return & "-" & newB & "-" as text
>> if temp = newB then
>> beep
>> exit repeat
>> end if
>> set AppleScript's text item delimiters to {return}
>> end repeat
>>
>> -- parse out data
>> set AppleScript's text item delimiters to {tab}
>> set newB to text item 2 of currentLineItem
>> set newR to text item 1 of currentLineItem
>> set AppleScript's text item delimiters to originalDelimiters -- reset
>> end monitorData
>>
>> TIA,
>>
>> Robert Poland - Fort Collins, CO
>>
>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> AppleScript-Users mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> Archives: http://lists.apple.com/archives/applescript-users
>>
>> This email sent to email@hidden
>>
>>
>
>
>
> --
> Mark J. Reed <email@hidden>
Robert Poland - Fort Collins, CO
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden