Jump to content

array


myspacee
 Share

Recommended Posts

For your info, I have progressed with a NON-CLICKING GUI

... it uses the pic from before

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

Global Const $WM_LBUTTONDOWN = 0x0201
Global $B[10], $Time, $Wait, $Voice = 0, $action = " Numbers", $Hover = 0, $Pause = 200
Global $Info_Read = "Dave 555-1255|Cindy 447-4145|Ray 332-1988|Hotty 978-LOVE"
; read in data from a file?
Global $Trans = 100, $Tmin = 20, $level = _SoundGetWaveVolume(), $aHold, $cHold
Global $Key[10], $Symbol[10] = ["", "", "@", "%", "?", "!", ".", "+", "-", "="]
$Key[2] = "A,B,C,a,b,c"
$Key[3] = "D,E,F,d,e,f"
$Key[4] = "G,H,I,g,h,i"
$Key[5] = "J,K,L,j,k,l"
$Key[6] = "M,N,O,m,n,o"
$Key[7] = "P,Q,R,S,p,q,r,s"
$Key[8] = "T,U,V,t,u,v"
$Key[9] = "W,X,Y,Z,w,x,y,z"

$My_pic = @TempDir & "\Bckgrnd.jpg"
FileInstall(@ScriptDir & "\ipod.jpg", $My_pic)

$Main = GUICreate("T-90", 320, 480, -1, -1, $WS_POPUP)
$back = GUICtrlCreatePic($My_pic, 0, 0, 320, 480)
GUICtrlSetState(-1, $GUI_DISABLE)
$exit = GUICtrlCreateLabel("", 295, 4, 20, 10)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$sound = GUICtrlCreateLabel("     OFF", 39, 3, 35, 12)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$AutoClick = GUICtrlCreateLabel(" AUTO_CLICK", 99, 3, 70, 14)
GUICtrlSetBkColor(-1, 0x4876FF) ;FF0000) ; red
$AutoMove = GUICtrlCreateLabel(" AUTO_MOVE", 199, 3, 70, 14, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetBkColor(-1, 0x4876FF) ;FF0000) ; red
$save = GUICtrlCreateLabel("", 267, 29, 47, 25)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$cancel = GUICtrlCreateLabel("", 8, 29, 55, 25)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Edit1 = GUICtrlCreateInput("~Phone #", 18, 110, 285, 53)
GUICtrlSetFont(-1, 30)
$Edit2 = GUICtrlCreateList("A Phone List", 18, 175, 285, 72)
GUICtrlSetFont(-1, 24)
GUICtrlSetData(-1, $Info_Read, 1)
$Slider1 = GUICtrlCreateSlider(0, 245, 159, 20)
GUICtrlSetBkColor(-1, 0xDCDDE1)
GUICtrlSetLimit(-1, 100, 0)
GUICtrlSetData(-1, $level)
$Slider2 = GUICtrlCreateSlider(160, 245, 159, 20)
GUICtrlSetBkColor(-1, 0xDCDDE1)
GUICtrlSetLimit(-1, 100, 0)
GUICtrlSetData($Slider2, $Trans * 2.55)
$Slider3 = GUICtrlCreateSlider(0, 225, 159, 20)
GUICtrlSetBkColor(-1, 0xDCDDE1)
GUICtrlSetLimit(-1, 300, 0)
GUICtrlSetData($Slider3, $Pause)
$B[1] = GUICtrlCreateLabel(" Clear", 0, 265, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[2] = GUICtrlCreateLabel(" @", 107, 265, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[3] = GUICtrlCreateLabel(" %", 214, 265, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[4] = GUICtrlCreateLabel(" ?", 0, 319, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[5] = GUICtrlCreateLabel(" !", 107, 319, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[6] = GUICtrlCreateLabel(" .", 214, 319, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[7] = GUICtrlCreateLabel(" +", 0, 373, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[8] = GUICtrlCreateLabel(" -", 107, 373, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[9] = GUICtrlCreateLabel(" =", 214, 373, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$star = GUICtrlCreateLabel(" Numbers", 0, 427, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$B[0] = GUICtrlCreateLabel(" Space", 107, 427, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$del = GUICtrlCreateLabel("", 214, 427, 105, 52)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$back = GUICtrlCreatePic($My_pic, 0, 0, 320, 480, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState()
_GuiRoundCorners($Main, 1, 1, 10, 10)
GUIRegisterMsg($WM_LBUTTONDOWN, "_WinMove")

While 1
 
 
 If $Hover Then
  Sleep($Pause * 10)
  ToolTip("")
  $inf = GUIGetCursorInfo($Main)
  $msg = $inf[4]
 Else
  $msg = GUIGetMsg()
  $inf = GUIGetCursorInfo($Main)
  If $inf[4] = $AutoClick Then $msg = $inf[4]
 EndIf
 
 Switch $msg
  Case $exit, -3
   Exit
  Case $save, $cancel
   MsgBox(0X0, "Sorry", "This action is not currently available.... 8)    ", 3)
  Case $Edit1, $Edit2
   $aHold = ""
   If $Hover Then MouseClick("")
  Case $star
   If GUICtrlRead($star) = " Numbers" Then
    $action = " Letters"
    GUICtrlSetData($star, $action)
    If $Voice Then Speak_Now("Letters")
   ElseIf GUICtrlRead($star) = " Letters" Then
    $action = " Symbols"
    GUICtrlSetData($star, $action)
    If $Voice Then Speak_Now("Symbols")
   Else
    $action = " Numbers"
    GUICtrlSetData($star, $action)
    If $Voice Then Speak_Now("Numbers")
   EndIf
  Case $del
   GUICtrlSetData($Edit1, StringTrimRight(GUICtrlRead($Edit1), 1))
   If $Voice Then Speak_Now("BackSpace")
  Case $sound
   If StringInStr(GUICtrlRead($sound), "ON") Then
    $Voice = 0
    GUICtrlSetData($sound, "     OFF")
   Else
    $Voice = 1
    GUICtrlSetData($sound, "     ON")
    If $Voice Then Speak_Now("Voice, On")
   EndIf
  Case $AutoClick
   If $Hover = 0 Then
    $Hover = 1
    GUICtrlSetBkColor($AutoClick, 0x00ff00) ; Green
    If $Voice Then Speak_Now("Auto, Click, On")
   Else
    $Hover = 0
    GUICtrlSetBkColor($AutoClick, 0x4876FF) ;FF0000) ; red
    If $Voice Then Speak_Now("Auto, Click, Off")
    Sleep(1000)
    ContinueLoop
   EndIf
  Case $AutoMove
   Opt("GUIOnEventMode", 1)
   GUICtrlSetBkColor($AutoMove, 0x00ff00) ; Green
   $info = 'If MouseDown(""left"") And Sleep(' & $Pause * 20 & ') And MouseUp(""left"") = 1 Then Exit'
   RunWait(@AutoItExe & ' /AutoIt3ExecuteLine ' & '"' & $info & '"', @ScriptDir, @SW_HIDE)
   Opt("GUIOnEventMode", 0)
   GUICtrlSetBkColor($AutoMove, 0x4876FF) ;FF0000) ; red
   Sleep(1000)
  Case $Slider1
   If $Hover Then MouseClick("")
   ToolTip("")
  Case $Slider2
   If $Hover Then MouseClick("")
   ToolTip("")
   If $Trans <= 20 Then
    $Trans = $Tmin
    WinSetTrans($Main, "", $Trans * 2.55)
    GUICtrlSetData($Slider2, $Trans)
   EndIf
  Case $Slider3
   If $Hover Then MouseClick("")
   ToolTip("")
  Case Else
   For $x = 0 To 9
    If $msg = $B[$x] Then
     Set_Text($x)
    EndIf
   Next
 EndSwitch
 If $level <> GUICtrlRead($Slider1) Then
  $level = GUICtrlRead($Slider1)
  ToolTip("Volume = " & $level)
  SoundSetWaveVolume($level)
 EndIf
 If $Trans <> GUICtrlRead($Slider2) Then
  $Trans = GUICtrlRead($Slider2)
  ToolTip("Transparency = " & $Trans)
  WinSetTrans($Main, "", $Trans * 2.55)
 EndIf
 If $Pause <> GUICtrlRead($Slider3) Then
  $Pause = GUICtrlRead($Slider3)
  ToolTip("AutoClick Pause = " & $Pause)
 EndIf
WEnd

; -------- Functions -----------------------


Func Set_Text($in)
 $info = GUICtrlRead($Edit1)
 If StringInStr($info, "~") Then $info = ""
 If $action = " Numbers" Then
  If $Voice Then Speak_Now($in)
  Return GUICtrlSetData($Edit1, $info & $in)
 EndIf
 If $in = "1" Then
  If $Voice Then Speak_Now("Clear")
  Return GUICtrlSetData($Edit1, "")
 EndIf
 If $in = "0" Then
  If $Voice Then Speak_Now("Space")
  Return GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & " ")
 EndIf
 If $action = " Symbols" Then
  If $Voice Then Speak_Now("Symbol")
  Return GUICtrlSetData($Edit1, $info & $Symbol[$in])
 EndIf
 $Split = StringSplit($Key[$in], ",")
 $cnt = 1
 If $aHold = $Key[$in] And $cHold >= 1 Then $cnt = $cHold + 1
 If $cnt >= 2 Then $info = StringTrimRight($info, 1)
 If $cnt > $Split[0] Then $cnt = 1
 $aHold = $Key[$in]
 $cHold = $cnt
 GUICtrlSetData($Edit1, $info & $Split[$cnt])
 If $Voice Then Speak_Now($Split[$cnt])
 Return
EndFunc   ;==>Set_Text


Func Speak_Now($Now_text)
 Local $oi_speech = ObjCreate("SAPI.SpVoice")
 If IsObj($oi_speech) Then $oi_speech.Speak($Now_text)
 $oi_speech = ""
EndFunc   ;==>Speak_Now

Func _WinMove($HWnd, $Command, $wParam, $lParam)
 If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG
 DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0)
EndFunc   ;==>_WinMove

Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3) ; thanks gafrost
 Dim $XS_pos, $XS_ret, $XS_ret2
 $XS_pos = WinGetPos($h_win)
 $XS_ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $XS_pos[2], "long", $XS_pos[3], "long", $i_x3, "long", $i_y3)
 If $XS_ret[0] Then
  $XS_ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $XS_ret[0], "int", 1)
 EndIf
EndFunc   ;==>_GuiRoundCorners

Func _SoundGetWaveVolume()
 Local $WaveVol = -1, $p, $ret
 Const $MMSYSERR_NOERROR = 0
 $p = DllStructCreate("dword")
 If @error Then
  SetError(2)
  Return -2
 EndIf
 $ret = DllCall("winmm.dll", "long", "waveOutGetVolume", "long", -1, "long", DllStructGetPtr($p))
 If ($ret[0] == $MMSYSERR_NOERROR) Then
  $WaveVol = Round(Dec(StringRight(Hex(DllStructGetData($p, 1), 8), 4)) / 0xFFFF * 100)
 Else
  SetError(1)
 EndIf
 $Struct = 0
 Return $WaveVol
EndFunc   ;==>_SoundGetWaveVolume

8)

NEWHeader1.png

Link to comment
Share on other sites

Valuater,

i don't miss any of your script.

Follow my road to build T9 script, but need years to reach script

made by JamesBrooks and you.

now i want to learn array stuff, so thak you all for help.

now i'm readind _ArraySearch help, if anybody can post some tested script

to delete empty array element i appreciate a lot.

good night all,

m.

Link to comment
Share on other sites

There's more than 1 way to skin-a-cat

#include <file.au3>
#include <array.au3>

Dim $aRecords, $My_Array[11]
Dim $Read_File = @ScriptDir & "\Estate_Info.txt"

If Not _FileReadToArray($Read_File, $aRecords) Then
 MsgBox(4096, "Error", " Error reading log to Array     error:" & @error)
 Exit
EndIf

For $x = 1 To 10
 $My_Array[$x] = $aRecords[$x]
Next

_ArrayDisplay($My_Array, "My Array")

8)

NEWHeader1.png

Link to comment
Share on other sites

Valuater,

thank you for help, but need another method.

my array start with 2000 values, after second user entry it return 100 elements,

and at 3th user entry usually i've 10-20 elements.... can't base process on text file.

Is not possible to delete empty values in an array ?

(for...next ?)

m.

Link to comment
Share on other sites

Valuater,

thank you for help, but need another method.

my array start with 2000 values, after second user entry it return 100 elements,

and at 3th user entry usually i've 10-20 elements.... can't base process on text file.

Is not possible to delete empty values in an array ?

(for...next ?)

m.

_ArrayDelete... it was in that list I told you about

_Arraypop(), _ArrayPush, etc, etc

8)

NEWHeader1.png

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...