Sign in to follow this  
Followers 0
Cormin

If clipboard hex value is greater than "FF" then do.

7 posts in this topic

#1 ·  Posted (edited)

How can I make my script do extra steps if my hex value in the clipboard is higher than "FF"?  The things that are commented out are what I re-enable if the serial number (in my clipboard) is above "FF" in hex.

Sleep(200) 
MouseClick("left",512,150,1) ;system data tab
Sleep(100)

;MouseClick("left",295,262,1)                   ;Serial # Over 256-------------------------------------------------------------------------------------------------
;Sleep(100)                                     ;Serial # Over 256-------------------------------------------------------------------------------------------------
;Send("{BACKSPACE}01{ENTER}")                   ;Serial # Over 256-------------------------------------------------------------------------------------------------
;Sleep(100)                                     ;Serial # Over 256-------------------------------------------------------------------------------------------------

Sleep(100) 
MouseClick("left",312,286,1) ;4
Sleep(100) 
Send("{CTRLDOWN}v{CTRLUP}")
Sleep(50)

;Send("{LEFT}")                                 ;Serials over 256 ----------------------------------------------------------------------------------------------------------
;Sleep(50)                                      ;Serials over 256 ----------------------------------------------------------------------------------------------------------
;Send("{LEFT}")                                 ;Serials over 256 ----------------------------------------------------------------------------------------------------------
;Sleep(50)                                      ;Serials over 256 ----------------------------------------------------------------------------------------------------------
;Send("{BACKSPACE}")                            ;Serials over 256 ----------------------------------------------------------------------------------------------------------
;Sleep(50)                                      ;Serials over 256 ----------------------------------------------------------------------------------------------------------
;Send("{BACKSPACE}")                            ;Serials over 256 ----------------------------------------------------------------------------------------------------------
;Sleep(100)                                     ;Serials over 256 ----------------------------------------------------------------------------------------------------------


Send("{ENTER}")

Here's the whole script if you're curious.

#region ---Au3Recorder generated code Start (v3.3.7.0)  ---

#region --- Internal functions Au3Recorder Start ---
Func Au3RecordSetup()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
EndFunc

Func WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
 EndFunc
 


AU3RecordSetup()
#endregion --- Internal functions Au3Recorder End ---




#include <MsgBoxConstants.au3>

; Press Esc to terminate script, Pause/Break to "pause"

Global $fPaused = False

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")



Func TogglePause()
    $fPaused = Not $fPaused
    While $fPaused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
   Beep(300, 500)
    Exit
EndFunc   ;==>Terminate





WinWaitActivate("Texas Instruments bq Gas Gauge Evaluation Software - bq27541V200 v2.00 - [EVSW Module]","Data Flash Constants")
Sleep(50) 
MouseClick("left",60,515,1)
WinWaitActivate("Texas Instruments bq Gas Gauge Evaluation Software - bq27541V200 v2.00 - [bqEasy]","Dataflash Image File")
Sleep(50) 
MouseClick("left",185,641,1) ;back button
Sleep(100) 
MouseClick("left",469,597,1) ;program dataflash image
Sleep ( 2000 )
WinWaitClose("Programming DFI","Progress Bar")
Sleep ( 100 )
MouseClick("left",64,285,1)  ;dataflash tab
WinWaitActivate("Texas Instruments bq Gas Gauge Evaluation Software - bq27541V200 v2.00 - [Data Flash Constants]","Data Flash Constants")
Sleep(100) 
MouseClick("left",203,145,1) ;config tab
Sleep(100) 
MouseClick("left",146,99,1) ;read all
Sleep ( 2000 )
MouseClick("left",632,478,1) ;click design cap
Sleep(200) 
Send("{BACKSPACE}{BACKSPACE}700{ENTER}") ;change design to 700
Sleep(200) 
MouseClick("left",626,412,1) ;click to change date
Sleep(100) 

;Send("{BACKSPACE}{BACKSPACE}24-Apr-14{ENTER}") ;change date ********************************************************************************************************************************
Send(@MON)
Sleep(10)
Send("-")
Sleep(10)
Send(@MDAY)
Sleep(10)
Send("-")
Sleep(10)
Send(@YEAR)
Sleep(10)
Send("{ENTER}")
Sleep(400) 

MouseClick("left",205,878,1) ;open excel
Sleep(250) 
MouseClick("left",122,240,1) ;click serial excel
Sleep(100) 
MouseClick("left",122,240,1) ;click serial excel
Sleep(100) 
MouseClick("left",122,240,1) ;click serial excel
Sleep(100) 
MouseClick("left",122,240,1) ;click serial excel
Sleep(100) 

Send("{CTRLDOWN}c{CTRLUP}")     ; Copy the highlighted content
Sleep(100)                      ; Let the system stablilise
$vValue = Dec(ClipGet())        ; Place the value in a variable and convert to decimal
Sleep(50) 
$vValue = $vValue + 1           ; Add 1 to the value
Sleep(50) 
Send(Hex($vValue, 2))           ; Send the amended value back to the app - change the numeric value 4 if you need more characters
Sleep(50) 
Send("{ENTER}")
Sleep(100) 
MouseClick("left",122,240,1) ;click serial excel
Sleep(100) 
MouseClick("left",122,240,1) ;click serial excel
Sleep(100) 
MouseClick("left",122,240,1) ;click serial excel
Sleep(100) 
MouseClick("left",122,240,1) ;click serial excel
Sleep(100) 
Send("{CTRLDOWN}c{CTRLUP}")     ; Copy the highlighted content
Sleep(100) 
Send("{ENTER}")
Sleep(50) 
MouseClick("left",337,886,1) ;open bq
WinWaitActivate("Texas Instruments bq Gas Gauge Evaluation Software - bq27541V200 v2.00 - [Data Flash Constants]","Data Flash Constants")
Sleep(100)
MouseClick("left",623,427,1) ;click serial bq
Send("{CTRLDOWN}v{CTRLUP}")
Sleep(100)
Send("{ENTER}")

Sleep(200) 
MouseClick("left",512,150,1) ;system data tab
Sleep(100)

;MouseClick("left",295,262,1)                   ;Serial # Over 256-------------------------------------------------------------------------------------------------
;Sleep(100)                                     ;Serial # Over 256-------------------------------------------------------------------------------------------------
;Send("{BACKSPACE}01{ENTER}")                   ;Serial # Over 256-------------------------------------------------------------------------------------------------
;Sleep(100)                                     ;Serial # Over 256-------------------------------------------------------------------------------------------------

Sleep(100) 
MouseClick("left",312,286,1) ;4
Sleep(100) 
Send("{CTRLDOWN}v{CTRLUP}")
Sleep(50)

;Send("{LEFT}")                                 ;Serials over 256 ----------------------------------------------------------------------------------------------------------
;Sleep(50)                                      ;Serials over 256 ----------------------------------------------------------------------------------------------------------
;Send("{LEFT}")                                 ;Serials over 256 ----------------------------------------------------------------------------------------------------------
;Sleep(50)                                      ;Serials over 256 ----------------------------------------------------------------------------------------------------------
;Send("{BACKSPACE}")                            ;Serials over 256 ----------------------------------------------------------------------------------------------------------
;Sleep(50)                                      ;Serials over 256 ----------------------------------------------------------------------------------------------------------
;Send("{BACKSPACE}")                            ;Serials over 256 ----------------------------------------------------------------------------------------------------------
;Sleep(100)                                     ;Serials over 256 ----------------------------------------------------------------------------------------------------------


Send("{ENTER}")


Sleep(200) 
MouseClick("left",318,334,1) ;7
Sleep(100) 
Send("{BACKSPACE}{BACKSPACE}14{ENTER}");7*******************  Year************* *This still does need to be updated yearly.
Sleep(200) 

MouseClick("left",314,374,1) ;9
Sleep(100) 
Send(@MON)
Sleep(10)
Send("{ENTER}")
;Send("{BACKSPACE}{BACKSPACE}04{ENTER}") ;9***************  Month*************** *No longer need to edit this Monthly
Sleep(200) 

Beep(700, 500)
Sleep(600) 

MouseClick("left",311,411,1) ;11
Sleep(300) 
Send(@MDAY)
Sleep(10)
Send("{ENTER}")
;Send("{BACKSPACE}{BACKSPACE}24{ENTER}");11********************* Day************** *No longer need to edit this daily
Sleep(550) 
MouseClick("left",51,433,1);calibrate tab
Sleep ( 50 )
WinWaitActivate("Texas Instruments bq Gas Gauge Evaluation Software - bq27541V200 v2.00 - [bq27xxx Calibration]","&Calibrate Part as i")
Sleep ( 50 )
MouseClick("left",359,531,1);set -421
Sleep ( 50 )
MouseClick("left",359,531,1);set -421
Sleep ( 50 )
Send("{BACKSPACE}{BACKSPACE}{BACKSPACE}-421{ENTER}");set -421
Sleep(300) 
MouseClick("left",156,210,1);calibrate start
Sleep ( 50 )
MouseMove(1233,201)
Sleep ( 50 )
Sleep ( 5000 )
MouseMove(251,212)
Sleep ( 20 )
Beep(600, 500)
Sleep ( 5000 )
MouseClick("left",60,358,1) ;i2c
WinWaitActivate("Texas Instruments bq Gas Gauge Evaluation Software - bq27541V200 v2.00 - [Pro screen: I2C over I2C lines]","Pro screen: I2C over")
Sleep(50) 
MouseMove(397,326);write i2c
Sleep(10) 
MouseDown("left");write i2c
Sleep ( 10 )
MouseUp("left");write i2c
;MouseClick("left",397,326,1);write i2c
Sleep ( 50 )
;MouseClick("left",59,263,1);data flash
;WinWaitActivate("Texas Instruments bq Gas Gauge Evaluation Software - bq27541V200 v2.00 - [Data Flash Constants]","Data Flash Constants")
;Sleep(10) 
;MouseMove(713,150)
;Sleep(10) 
;MouseDown("left")
;Sleep ( 10 )
;MouseUp("left");gas guaging
;Sleep(10) 
;MouseClick("left",141,98,1) ;read all
;Beep(500, 250)
;Sleep ( 1500 )
MouseClick("left",33,583,1);send hdq tab
WinWaitActivate("Texas Instruments bq Gas Gauge Evaluation Software - bq27541V200 v2.00 - [EVSW Module]","Data Flash Constants")
Sleep(10) 
MouseClick("left",269,211,1);change comm
Beep(700, 300)
Beep(700, 300)
Exit
#endregion --- Au3Recorder generated code End ---
Edited by Cormin

Share this post


Link to post
Share on other sites



If ClipGet() > 255 Then
    ; do something here
Else
    ; do something else here
EndIf


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

If ClipGet() > 255 Then
    ; do something here
Else
    ; do something else here
EndIf

Thanks! But that's dec.  I need it to be in hex.

Would it be this?

If ClipGet() > (Hex(FF)) Then
    ; do something here
Else
    ; do something else here
EndIf
Edited by Cormin

Share this post


Link to post
Share on other sites

Cormin

AutoIt does not differentiate - it converts the values internally. You can replace 255 by 0xFF if you wish. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Cormin

AutoIt does not differentiate - it converts the values internally. You can replace 255 by 0xFF if you wish. ;)

M23

 

How would it know that the "100" in my clipboard is 256 and not actually 100.  My clipboard has it formatted at exactly "100"

Edited by Cormin

Share this post


Link to post
Share on other sites

Cormin,

Because you can tell it so by using Dec to convert it to decimal: ;)

ClipPut("100")

$iClipContent = Dec(ClipGet())

MsgBox(0, "Return", ClipGet() & @CRLF & $iClipContent
M23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

Share this post


Link to post
Share on other sites

Thanks a lot!  Got it working!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0