Jump to content

copy help


Recommended Posts

i need help to copy from the ListView or send the listview items in excel sheet so i need the copy button work

Global $W
Global $dL
Global $L
Global $Eef
Global $E
Global $h
Global $F
Global $Le
$result=0
$counter=1
IsFloat($E)
IsFloat($h)
IsFloat($F)
IsFloat($W)
IsFloat($dL)
IsFloat($L)
IsFloat($Eef)
IsFloat($Le)
;************************************************************** set the gui
#NoTrayIcon
#include <GUIConstants.au3>
#Include <Misc.au3>
#include <GuiListView.au3>
#include <ClipBoard.au3>
$font="Comic Sans MS"
$main=GUICreate("MICROSTRIP ANTENNA",350,150)
GUICtrlCreateLabel("EPr=",5,12)         ;epslon
$Ei=GUICtrlCreateInput("",30,10,60)     ;epslon input
GUICtrlCreateLabel("h=",120,12)         ;hight
$hi=GUICtrlCreateInput("",135,10,60)    ;hight input
GUICtrlCreateLabel("milm",200,12)       ;the h unit
GUICtrlCreateLabel("F=",230,12)         ;fre
$Fi=GUICtrlCreateInput("",245,10,60)    ;freq input
GUICtrlCreateLabel("GHz",310,12)        ;freq units
$C=GUICtrlCreateButton("Calculate",145,50,60)
$Si=GUICtrlCreateCheckbox("Save the result data",10,50)
$resbi=GUICtrlCreateCheckbox("Disable Result Box",10,70)
$copyresult=GUICtrlCreateButton("copy the result",220,50,90)
$CRIDET=GUICtrlCreateLabel("MADE BY ALAA MAHMOUD NO:320047079",10,100,300,50)
GUICtrlSetFont(-1,14, 400,2,$font)
GUISetState()
;*************************************************************** gui thengis ends and start calculation by pressing calculate
While 1
    $main_Pos = WinGetPos($main, "")
    $msg = GUIGetMsg(1)
    $r=0
    Select
    Case $msg[0] =$C
        $E=GUICtrlRead($Ei)
        $h=GUICtrlRead($hi)
        $F=GUICtrlRead($Fi)
        $S=GUICtrlRead($Si)
        $resb=GUICtrlRead($resbi)
        If $resb=1 Then
            $S=1
        EndIf
        _W()
        _Eef()
        _dL()
        _L()
        _Le()
        If $L<0 Or $dL<0 Or $Le<0 Or $W<0 Or $h<0 Or $E<1 Or $E=1 Or $F=0 Or $F<0 Or $h<0 Then
            MsgBox(0,"Error","Check your Input Data"&@LF&"Click ok to show the bad result")
            $r=1
        EndIf
        If $resb=4 Then
        MsgBox(0,"THE RESULT","W   =" & $W &"  milm"&@LF&@LF&"Eef ="&$Eef&@LF&@LF&"dL   ="&$dL&"  milm"&@LF&@LF&"L   ="&$L&"  milm"&@LF&@LF&"Le ="&$Le&"  milm")
        EndIf
        If $S=1 Then 
            If $r=0 Then
                If WinExists("The Result Data") Then 
                    GUICtrlCreateListViewItem($counter&"|"&$E&"|"&$h&"|"&$F&"|"&$W&"|"&$Eef&"|"&$dL&"|"&$L&"|"&$Le,$listview)
                    $counter=$counter+1
                Else
            $result=GUICreate("The Result Data",500,500,$main_Pos[0] + 100, $main_Pos[1] + 100,$WS_SIZEBOX, -1, $main)
            $listview = GUICtrlCreateListView ("Result No   |E=|h=in milm|F=in GHz|W=in milm|Eef=|dL=in milm|L=in milm|Le=in milm",5,10,485,460,"",$LVS_EX_FLATSB+$WS_EX_CLIENTEDGE)
            GUICtrlSendMsg($listview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
            GUICtrlCreateListViewItem($counter&"|"&$E&"|"&$h&"|"&$F&"|"&$W&"|"&$Eef&"|"&$dL&"|"&$L&"|"&$Le,$listview)
            $counter=$counter+1
            EndIf
            GUISetState()
            EndIf
        EndIf
    Case $msg[0] = $GUI_EVENT_CLOSE
        If $msg[1] = $result Then
            GUISwitch($result)
            GUIDelete()
            $counter=1
        ElseIf $msg[1] = $main Then
            GUISwitch($main)
            GUIDelete()
            Exit
        EndIf
    Case $msg[0]=$copyresult
    
     EndSelect
WEnd
;************************************************************** the functions
Func _W()
    $W=((3*10^11)/(2*$F*10^9))*(2/($E+1))^0.5
    Return $W
EndFunc
Func _Eef()
    $Eef=(($E+1)/2)+(($E-1)/2)*(1+(12*($h/$W)))^(-0.5)
    Return $Eef
EndFunc
Func _dL()
    $dL=(0.412*$h)*((($Eef+0.3)*(($W/$h)+0.264))/(($Eef-0.258)*(($W/$h)+0.8)))
    Return $dL
EndFunc
Func _L()
    $L=((3*10^11)/((2*$F*10^9)*($Eef^0.5)))-(2*$dL)
    Return $L
EndFunc
Func _Le()
    $Le=$L+(2*$dL)
    Return $Le
EndFunc
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...