Sign in to follow this  
Followers 0
Hyflex

Why is this script not working?

22 posts in this topic

The following script is not working right, can anyone help or give me any suggustions.

Also, is it possible for at the start a GUI to apear with 4 text input boxes with buttons "Cancel" and "Save" whith the GUI automatically reading the INI File and allowing for changes if they press PAUSE

HotKeySet("{1}", "FAutoSendOne") 
HotKeySet("{2}", "FAutoSendTwo") 
HotKeySet("{3}", "FAutoSendThree") 
HotKeySet("{4}", "FAutoSendFour") 

$SReadOne = IniRead ( @ScriptDir & "\Settings.ini", "FInputOne", "AutoText", "" )
$SReadTwo = IniRead ( @ScriptDir & "\Settings.ini", "FInputFour", "AutoText", "" )
$SReadThree = IniRead ( @ScriptDir & "\Settings.ini", "FInputThree", "AutoText", "" )
$SReadFour = IniRead ( @ScriptDir & "\Settings.ini", "FInputFive", "AutoText", "" )


While 1
    Sleep(100)
WEnd

Func FAutoSendOne()
    ClipPut($SReadOne)
    $SReadOneClipGet = ClipGet()
    Send("{BACKSPACE}")
    Send($SReadOneClipGet)
EndFunc

Func FAutoSendTwo()
    ClipPut($SReadTwo)
    $SReadTwoClipGet = ClipGet()
    Send("{BACKSPACE}")
    Send($SReadTwoClipGet)
EndFunc

Func FAutoSendThree()
    ClipPut($SReadThree)
    $SReadThreeClipGet = ClipGet()
    Send("{BACKSPACE}")
    Send($SReadThreeClipGet)
EndFunc

Func FAutoSendFour()
    ClipPut($SReadFour)
    $SReadFourClipGet = ClipGet()
    Send("{BACKSPACE}")
    Send($SReadFourClipGet)
EndFunc

Share this post


Link to post
Share on other sites



The following script is not working right, can anyone help or give me any suggustions.

Also, is it possible for at the start a GUI to apear with 4 text input boxes with buttons "Cancel" and "Save" whith the GUI automatically reading the INI File and allowing for changes if they press PAUSE

HotKeySet("{1}", "FAutoSendOne") 
HotKeySet("{2}", "FAutoSendTwo") 
HotKeySet("{3}", "FAutoSendThree") 
HotKeySet("{4}", "FAutoSendFour") 

$SReadOne = IniRead ( @ScriptDir & "\Settings.ini", "FInputOne", "AutoText", "" )
$SReadTwo = IniRead ( @ScriptDir & "\Settings.ini", "FInputFour", "AutoText", "" )
$SReadThree = IniRead ( @ScriptDir & "\Settings.ini", "FInputThree", "AutoText", "" )
$SReadFour = IniRead ( @ScriptDir & "\Settings.ini", "FInputFive", "AutoText", "" )


While 1
    Sleep(100)
WEnd

Func FAutoSendOne()
    ClipPut($SReadOne)
    $SReadOneClipGet = ClipGet()
    Send("{BACKSPACE}")
    Send($SReadOneClipGet)
EndFunc

Func FAutoSendTwo()
    ClipPut($SReadTwo)
    $SReadTwoClipGet = ClipGet()
    Send("{BACKSPACE}")
    Send($SReadTwoClipGet)
EndFunc

Func FAutoSendThree()
    ClipPut($SReadThree)
    $SReadThreeClipGet = ClipGet()
    Send("{BACKSPACE}")
    Send($SReadThreeClipGet)
EndFunc

Func FAutoSendFour()
    ClipPut($SReadFour)
    $SReadFourClipGet = ClipGet()
    Send("{BACKSPACE}")
    Send($SReadFourClipGet)
EndFunc

Whats "not working right"? Other than the fact there may not actually be a value entered in the Ini keys.

Test your code with Message boxes like so and it should show you the problem.

Func FAutoSendOne()
        MsgBox(4096, "Result", $SReadOne)
    ClipPut($SReadOne)
    $SReadOneClipGet = ClipGet()
    Send("{BACKSPACE}")
    Send($SReadOneClipGet)
EndFunc

The GUI part is easy. All it takes is a bit of effort on your part to learn about GUIs.

Also you haven't mentioned what you are trying to Send() any of this to so please be a bit more helpful here.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Oh weird, its working now... maybe its because I had a problem with Copy and Paste manually...

The program.. is what is at work and can't really explain.

As for the gui part, i know how to make the gui with save settings but dont know how to make it read the ini and if edited manually for it to refresh.

EDIT:

Trying to add a pause feature, so if i press a button it pauses even those hotkeys from working but not sure on how that works.

I have just been looking at the pause in: http://www.autoitscript.com/autoit3/docs/functions/HotKeySet.htm but that doesnt work how im trying to do it

Pause is the most important thing I need to complete, i need it for tomorrow.

Edited by XxXGoD

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

This should give you the idea

Global $bPaused = False
HotKeySet("{Pause}", "_Pause")
HotKeySet("{Esc}", "_Exit")
_SetKeys()

$SReadOne = IniRead ( @ScriptDir & "\Settings.ini", "FInputOne", "AutoText", "" )
$SReadTwo = IniRead ( @ScriptDir & "\Settings.ini", "FInputFour", "AutoText", "" )
$SReadThree = IniRead ( @ScriptDir & "\Settings.ini", "FInputThree", "AutoText", "" )
$SReadFour = IniRead ( @ScriptDir & "\Settings.ini", "FInputFive", "AutoText", "" )


While 1
    Sleep(100)
WEnd

Func FAutoSendOne()
    ClipPut($SReadOne)
    $SReadOneClipGet = ClipGet()
    Send("{BACKSPACE}")
    Send($SReadOneClipGet)
EndFunc

Func FAutoSendTwo()
    ClipPut($SReadTwo)
    $SReadTwoClipGet = ClipGet()
    Send("{BACKSPACE}")
    Send($SReadTwoClipGet)
EndFunc

Func FAutoSendThree()
    ClipPut($SReadThree)
    $SReadThreeClipGet = ClipGet()
    Send("{BACKSPACE}")
    Send($SReadThreeClipGet)
EndFunc

Func FAutoSendFour()
    ClipPut($SReadFour)
    $SReadFourClipGet = ClipGet()
    Send("{BACKSPACE}")
    Send($SReadFourClipGet)
EndFunc

Func _Pause()
    $bPaused = Not $bPaused
    If $bPaused Then
        HotKeySet("{1}")
        HotKeySet("{2}")
        HotKeySet("{3}")
        HotKeySet("{4}")
        While $bPaused
            Sleep(50)
        WEnd
        _SetKeys()
    EndIf
EndFunc   ;==>_Pause

Func _Exit()
    Exit
EndFunc   ;==>_Exit

Func _SetKeys()
    HotKeySet("{1}", "FAutoSendOne") 
    HotKeySet("{2}", "FAutoSendTwo") 
    HotKeySet("{3}", "FAutoSendThree") 
    HotKeySet("{4}", "FAutoSendFour") 
EndFunc   ;==>_SetKeys

Edit: Added the _SetKeys() Function to shorten the code.

Edit 2: Changed the _Pause() Function a bit to prevent unexpected behaviour.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

ClipPut( $SRead )
$SReadClipGet = ClipGet(  )
Send( "{BACKSPACE}" )
Send( $SReadClipGet )

Would the following code do the same thing as the above code?

Send( "{BACKSPACE}" )
Send( $SRead )

Is there a specific purpose for putting something to the clipboard, taking it from the clipboard, and then sending it to a control? Why not skip the middleman?

Share this post


Link to post
Share on other sites

ClipPut( $SRead )
$SReadClipGet = ClipGet(  )
Send( "{BACKSPACE}" )
Send( $SReadClipGet )

Would the following code do the same thing as the above code?

Send( "{BACKSPACE}" )
Send( $SRead )

Is there a specific purpose for putting something to the clipboard, taking it from the clipboard, and then sending it to a control? Why not skip the middleman?

Not only will it work, it's better.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Ok, It worked good for today but have made some changes.

Please can someone help with a problem I have come up again't.

I have no idea how to get the data from those edit boxes to the hotkeys...

How can i make the GUI find centre of screen?( If your not sure or is complicated dont worry.)

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

Global $bPaused = False
HotKeySet("{Pause}", "_Pause")
HotKeySet("{END}", "Terminate")
_SetKeys()

$First = IniRead ( @ScriptDir & "\Settings.ini", "General", "First", "" )
$Second = IniRead ( @ScriptDir & "\Settings.ini", "General", "Second", "" )

$Last1 = IniRead ( @ScriptDir & "\Settings.ini", "General", "Last1", "" )
$Last2 = IniRead ( @ScriptDir & "\Settings.ini", "General", "Last2", "" )
$Last3 = IniRead ( @ScriptDir & "\Settings.ini", "General", "Last3", "" )
$Last4 = IniRead ( @ScriptDir & "\Settings.ini", "General", "Last4", "" )

$BatchNo = IniRead ( @ScriptDir & "\Settings.ini", "General", "BatchNo", "" )
$ExpDate = IniRead ( @ScriptDir & "\Settings.ini", "General", "ExpDate", "" )

$TT = IniRead ( @ScriptDir & "\Settings.ini", "Settings", "Enable ToolTip", "Yes")

$XPos = IniRead ( @ScriptDir & "\Settings.ini", "Settings", "X Position", "1")
$YPos = IniRead ( @ScriptDir & "\Settings.ini", "Settings", "Y Position", "1")

PD()
Func PD()
    Local $msg
$Form1 = GUICreate("AAffb", 620, 240, 200, 120)

$BatchNos = GUICtrlCreateInput("" & $BatchNo, 8, 8, 73, 21)
$ExpDates = GUICtrlCreateInput("" & $ExpDate, 88, 8, 81, 21)

$HK1Output = GUICtrlCreateEdit("", 88, 40, 521, 41)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
$HK1Label = GUICtrlCreateLabel("Press 1 for:", 8, 48, 65, 17)

$HK2Output = GUICtrlCreateEdit("", 88, 88, 521, 41)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
$HK2Label = GUICtrlCreateLabel("Press 2 for:", 8, 96, 65, 17)

$HK3Output = GUICtrlCreateEdit("", 88, 136, 521, 41)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
$HK3Label = GUICtrlCreateLabel("Press 3 for:", 8, 144, 65, 17)

$HK4Output = GUICtrlCreateEdit("", 88, 184, 521, 41)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
$HK4Label = GUICtrlCreateLabel("Press 4 for:", 8, 192, 65, 17)



GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
                ToolTip("Press 'Pause' to Pause this Script" & @CRLF & "Press 'End' to Terminate this Script", $XPos, $YPos, "AAffb", 1)
                GUICtrlSetData($HK1Output,$First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
                GUICtrlSetData($HK2Output,$First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last2)
                GUICtrlSetData($HK3Output,$First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last3)
                GUICtrlSetData($HK4Output,$First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last4)
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        sleep(100)
        
    WEnd
    GUIDelete()
EndFunc


Func _Pause()
    $bPaused = Not $bPaused
    If $bPaused Then
        HotKeySet("{1}")
        HotKeySet("{2}")
        HotKeySet("{3}")
        HotKeySet("{4}")
        While $bPaused
            Sleep(50)
        WEnd
        _SetKeys()
    EndIf
EndFunc


Func FAutoSendOne()
    ClipPut($First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
    $SReadOneClipGet = ClipGet()
    Send("^v")
EndFunc

Func FAutoSendTwo()
    ClipPut("" & $HK2Output)
    $SReadTwoClipGet = ClipGet()
    Send("^v")
EndFunc

Func FAutoSendThree()
    ClipPut("" & $HK3Output)
    $SReadThreeClipGet = ClipGet()
    Send("^v")
EndFunc

Func FAutoSendFour()
    ClipPut("" & $HK4Output)
    $SReadFourClipGet = ClipGet()
    Send("^v")
EndFunc


Func _SetKeys()
    HotKeySet("{1}", "FAutoSendOne") 
    HotKeySet("{2}", "FAutoSendTwo") 
    HotKeySet("{3}", "FAutoSendThree") 
    HotKeySet("{4}", "FAutoSendFour") 
EndFunc


Func Terminate()
    Exit 0
EndFunc

Share this post


Link to post
Share on other sites

Screen Center is easy

Local $xCoord = @DeskTopWidth/2
Local $yCoord = @DeskTopHeight/2

What are you really trying to do with this script? It appears that you may be taking the scenic tour getting to your destination.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Screen Center is easy

Local $xCoord = @DeskTopWidth/2
Local $yCoord = @DeskTopHeight/2

What are you really trying to do with this script? It appears that you may be taking the scenic tour getting to your destination.

Its complicated but its still a work in progress, how can i make the HK1Output, HK2Output...etc all the data from them go into the hotkeys?

After that I wont bug you :D hehe

Does anyone see the problem and how to fix?

Edited by XxXGoD

Share this post


Link to post
Share on other sites

Declare your contrls with Global scope and then something along these lines

Func FAutoSendOne()
    Send($First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
EndFunc

However there is still a lot wrong with your code. For instance using GUICtrlSetData() in a loop that runs approximatly every 250 milliseconds. You would be better off to put that in your Functions or use a check to see if the data has changed like this

$sStr = "Something"
If GUICtrlRead($myCtrl) <> $sStr Then GUICtrlSetData($myCtrl, $sStr)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I have no idea how to do that...

Basically I want a gui like:

$ACS = GUICreate("AAffb)", 575, 145, 1, 60)

$BatchNos = GUICtrlCreateInput("" & $BatchNo, 60, 10, 73, 21)
$ExpDates = GUICtrlCreateInput("" & $ExpDate, 200, 10, 81, 21)

$BatchNoLabel = GUICtrlCreateLabel("Batch No", 10, 13, 50, 20)
$ExpDateLabel = GUICtrlCreateLabel("Exp Date", 150, 13, 50, 20)

$HK1Output = GUICtrlCreateInput("1", 65, 40, 500, 20)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
$HK1Label = GUICtrlCreateLabel("Press 1 for:", 8, 43, 65, 20)

$HK2Output = GUICtrlCreateInput("", 65, 65, 500, 20)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last2)
$HK2Label = GUICtrlCreateLabel("Press 2 for:", 8, 68, 65, 20)

$HK3Output = GUICtrlCreateInput("", 65, 90, 500, 20)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last3)
$HK3Label = GUICtrlCreateLabel("Press 3 for:", 8, 93, 65, 20)

$HK4Output = GUICtrlCreateInput("", 65, 115, 500, 20)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last4)
$HK4Label = GUICtrlCreateLabel("Press 4 for:", 8, 118, 65, 20)

and for the 4 larger input boxes to read $First from an ini file, then BatchNos is a custom number/word and then $second is a setting from the ini file and then ExpDate is a date which is custom.

I need to able to see what the outcome is and need to be able to edit BatchNo and Expdate.

When pressing Number 1 it would send message with with the batchno all the same as the others and the exp date the same (but remember its custom from the GUI) and then Last1 (which is a message from the ini file.

Pressing 2 gives the same but with the end message different.

Understand?

I did give it my best shot, but still am quite slow at learning autoit, care to show me my mistakes and explain so I can understand as its pretty hard to get what you mean.

Edited by XxXGoD

Share this post


Link to post
Share on other sites

Right now I'm busy doing system repairs to 4 systems but I'll get back to this later.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Right now I'm busy doing system repairs to 4 systems but I'll get back to this later.

Please do, its 00:31 in the morning, I need for 7:30am :D

Thanks though man.

Share this post


Link to post
Share on other sites

Please do, its 00:31 in the morning, I need for 7:30am :D

Thanks though man.

You don't appear to have implemented anything GEOSoft already gave you, like making the values Global so they could be referenced in the hot key functions.

So, are you still working on this, or is the project over?

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

You don't appear to have implemented anything GEOSoft already gave you, like making the values Global so they could be referenced in the hot key functions.

So, are you still working on this, or is the project over?

:D

I said, I do not understand that bit..

I dont get how it can help or how to do it :D

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

I said, I do not understand that bit..

I dont get how it can help or how to do it :D

If you don't start helping us out by following directions you won't be able to meet the deadline if they give you a years extension on it. After all you have been around here for 3 years and still don't seem to have grasped the most basic skill set.

Lets start with the "Global" Instruction again. You created the GUI inside a function therefore those variables are declared as "Local" by default and as such are not available any other place in the script. Change that by adding the word "Global" in front of each control that is referenced outside of the function so it can be referenced.

Example.

Global $BatchNos = GUICtrlCreateInput("" & $BatchNo, 8, 8, 73, 21)

Tip: If you just remove the PD() function then they will be declared as Global by default so there is no need to declare the scope at all but it won't hurt anything to do so. To do that, just place a semi-colon in front of the Func PD() and corresponding EndFunc lines as well as the line that calls the function

;PD()
;Func PD()
    Local $msg
$Form1 = GUICreate("AAffb", 620, 240, 200, 120)

$BatchNos = GUICtrlCreateInput("" & $BatchNo, 8, 8, 73, 21)
$ExpDates = GUICtrlCreateInput("" & $ExpDate, 88, 8, 81, 21)

$HK1Output = GUICtrlCreateEdit("", 88, 40, 521, 41)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
$HK1Label = GUICtrlCreateLabel("Press 1 for:", 8, 48, 65, 17)

$HK2Output = GUICtrlCreateEdit("", 88, 88, 521, 41)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
$HK2Label = GUICtrlCreateLabel("Press 2 for:", 8, 96, 65, 17)

$HK3Output = GUICtrlCreateEdit("", 88, 136, 521, 41)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
$HK3Label = GUICtrlCreateLabel("Press 3 for:", 8, 144, 65, 17)

$HK4Output = GUICtrlCreateEdit("", 88, 184, 521, 41)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
$HK4Label = GUICtrlCreateLabel("Press 4 for:", 8, 192, 65, 17)



GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
                ToolTip("Press 'Pause' to Pause this Script" & @CRLF & "Press 'End' to Terminate this Script", $XPos, $YPos, "AAffb", 1)
                GUICtrlSetData($HK1Output,$First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
                GUICtrlSetData($HK2Output,$First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last2)
                GUICtrlSetData($HK3Output,$First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last3)
                GUICtrlSetData($HK4Output,$First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last4)
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        sleep(100)
        
    WEnd
    GUIDelete()
;EndFunc

OR

PD()
Func PD()
    Local $msg
$Form1 = GUICreate("AAffb", 620, 240, 200, 120)

Global $BatchNos = GUICtrlCreateInput("" & $BatchNo, 8, 8, 73, 21)
Global $ExpDates = GUICtrlCreateInput("" & $ExpDate, 88, 8, 81, 21)

Global $HK1Output = GUICtrlCreateEdit("", 88, 40, 521, 41)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
$HK1Label = GUICtrlCreateLabel("Press 1 for:", 8, 48, 65, 17)

Global $HK2Output = GUICtrlCreateEdit("", 88, 88, 521, 41)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
$HK2Label = GUICtrlCreateLabel("Press 2 for:", 8, 96, 65, 17)

Global $HK3Output = GUICtrlCreateEdit("", 88, 136, 521, 41)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
$HK3Label = GUICtrlCreateLabel("Press 3 for:", 8, 144, 65, 17)

Global $HK4Output = GUICtrlCreateEdit("", 88, 184, 521, 41)
GUICtrlSetData(-1, "" & $First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
$HK4Label = GUICtrlCreateLabel("Press 4 for:", 8, 192, 65, 17)



GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
                ToolTip("Press 'Pause' to Pause this Script" & @CRLF & "Press 'End' to Terminate this Script", $XPos, $YPos, "AAffb", 1)
                GUICtrlSetData($HK1Output,$First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last1)
                GUICtrlSetData($HK2Output,$First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last2)
                GUICtrlSetData($HK3Output,$First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last3)
                GUICtrlSetData($HK4Output,$First & GUICtrlRead($BatchNos) & $Second & GUICtrlRead($ExpDates) & $Last4)
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        sleep(100)
        
    WEnd
    GUIDelete()
EndFunc

Step 2:

Try using the example code I already gave you for reading the values.

Do that and see what you get. If you are working with Scite and you get errors then post the errors and we will take it from there.

If you don't understand this reply then you are beyond help. It appears that in 3 years you have not been able to find time to study the Help file so without some effort on your part I won't be able to find any more time to help you with the problems that could have easily been solved by reading said documentation.

Please don't force me to change the tag line by my name again.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Thanks I was unable to get the following working, but...

$sStr = "Something"
If GUICtrlRead($myCtrl) <> $sStr Then GUICtrlSetData($myCtrl, $sStr)

As It doesn't matter for me i shouldn't need to worry at all, I added in the same area as all the ctrlsetdata's a bunch of iniwrites for Example 1, 2, 3, 4 and also for the BatchNo and ExpDate

I am now making a pretty GUI in Koda

Share this post


Link to post
Share on other sites

Thanks I was unable to get the following working, but...

$sStr = "Something"
If GUICtrlRead($myCtrl) <> $sStr Then GUICtrlSetData($myCtrl, $sStr)

As It doesn't matter for me i shouldn't need to worry at all, I added in the same area as all the ctrlsetdata's a bunch of iniwrites for Example 1, 2, 3, 4 and also for the BatchNo and ExpDate

I am now making a pretty GUI in Koda

Good to hear. That code was just an example of how to check if a control needed updating before actually updating it. It helps avoid flicker in the GUI.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Good to hear. That code was just an example of how to check if a control needed updating before actually updating it. It helps avoid flicker in the GUI.

This makes part of my job 100x easier with another script what is similar.

Instead of taking me 2hours to complete it, it takes me 30mins, there will be 6 of us who will be using this for 8 hours for about two to three weeks, thats this year this will mean next year we can do more and earn more money in those 8 hours a day as it simplifies part of what we have to do.

Problem:

Func OpenSettings()
    FileOpen( @ScriptDir & "\Settings.ini", 1)
EndFunc

Doesn't work... doesn't open doesnt bring an error doesnt say anything

Edited by XxXGoD

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

This makes part of my job 100x easier with another script what is similar.

Instead of taking me 2hours to complete it, it takes me 30mins, there will be 6 of us who will be using this for 8 hours for about two to three weeks, thats this year this will mean next year we can do more and earn more money in those 8 hours a day as it simplifies part of what we have to do.

Problem:

Func OpenSettings()
    FileOpen( @ScriptDir & "\Settings.ini", 1)
EndFunc

Doesn't work... doesn't open doesnt bring an error doesnt say anything

FileOpen() doesn't read the file, it simply opens it in the mode you want. What do you expect to happen at that point?. If it's to open and read the file in the default editor then

ShellExecute(@ScriptDir & "\Settings.ini", "", "", "edit")

To place the file contents on the clipboard it's just

ClipPut(FileRead(@ScriptDir & "\Settings.ini"))

Please, no more PMs for help. If you have a question, ask it in the forums and then someone else can jump in if I don't reply for any reason, and right now I can think of a few reasons why I might not.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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