Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/24/2011 in all areas

  1. I hope you like it! #include <WinAPI.au3> Global $hGui = GUICreate('_GuiCtrlSetPath by funkey', 600, 200) Global $nPath1 = GUICtrlCreateLabel('', 10, 10, 300, 50) GUICtrlSetBkColor(-1, 0xCCCCCC) GUICtrlSetFont(-1, 30) _GuiCtrlSetPath($nPath1, "C:path1path2sample.txt") Global $nPath2 = GUICtrlCreateLabel('', 10, 80, 580, 60) GUICtrlSetBkColor(-1, 0xCCCCCC) GUICtrlSetFont(-1, 40) _GuiCtrlSetPath($nPath2, "C:path1path2sample.txt") GUICtrlCreateInput("", 10, 150, 200, 20) _GuiCtrlSetPath(-1, "C:path1path2path3path4path5path6sample.txt", 4) GUISetState() Do Until GUIGetMsg() = -3 Func _GuiCtrlSetPath($nID, $sPath, $iFit = 0) ;coded by funkey ;2011, Nov 24th Local $hCtrl = GUICtrlGetHandle($nID) Local $hDC = _WinAPI_GetDC($hCtrl) Local $tPath = DllStructCreate("char[260]") Local $pPath = DllStructGetPtr($tPath) DllStructSetData($tPath, 1, $sPath) Local $hFont = _SendMessage($hCtrl, 49, 0, 0, 0, "wparam", "lparam", "hwnd") ;WM_GETFONT Local $hFont_old = _WinAPI_SelectObject($hDC, $hFont) Local $aPos = ControlGetPos($hCtrl, "", "") DllCall("Shlwapi.dll", "BOOL", "PathCompactPath", "handle", $hDC, "ptr", $pPath, "int", $aPos[2] - $iFit) _WinAPI_SelectObject($hDC, $hFont_old) _WinAPI_DeleteDC($hDC) GUICtrlSetData($nID, DllStructGetData($tPath, 1)) Return DllStructGetData($tPath, 1) EndFunc ;==>_GuiCtrlSetPath
    1 point
  2. 4 lines of code shouldn't be a challenge to understand it but here we go: With SplashImageOn() you display the image on the screen as long as SplashOff() will be called or script ends. With MsgBox() you display the message box which waits for the button to get pushed. Afterwards the splash screen and messagebox will be closed. Check the help file for the parameters for SplashImageOn(). Br, UEZ
    1 point
  3. $destination = "C:Picture.Jpg" ;Address to image file SplashImageOn("Splash Screen", $destination, 250,50,-1, @DesktopHeight / 2 - 200) ;"Splash Screen" = Splash Title ;$destination = Address to iamge file that you decleared in first line ;250, 50 = Width and Height of Splash ;~ -1 = x pos = Center of desktop ;~ @DesktopHeight / 2 - 200 = For example in 800x600 res it means : ((600 / 2) - 200) = 100 MsgBox(0,"Title","Text") ;Show a Message Box SplashOff() ;Hide Spalsh
    1 point
  4. Try this: $destination = "C:Picture.Jpg" ;This only are Example SplashImageOn("Splash Screen", $destination,250,50,-1, @DesktopHeight / 2 - 200) MsgBox(0,"Title","Text") ;~ Sleep(3000) SplashOff() Br, UEZ
    1 point
  5. I wrote you a quick script (Not complete) I think it should be well more than enough to get you started If you have any questions/need further help then PM me as I probably will forget to check this often ^^; Code: #include <Array.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Global $ProductListBox, $Gui1, $Gui2 $Products = IniReadSection("Products.ini", "Product") If @error Then MsgBox(48, "Error", "An error has occured!" & @CR & "There was no INI file to load." & @CR & "Please speak with <Name> to fix this problem!") Exit Else _CreateGUI() EndIf Func _CreateGUI() $Gui1 = GuiCreate("Supply Order Form", 600,500) GUISetOnEvent($GUI_EVENT_CLOSE, "_Close") $ProductListBox = GuiCtrlCreateList("",200,80,200,300) For $i = 1 To $Products[0][0] GuiCtrlSetData($ProductListBox, $Products[$i][0]) Next GuiCtrlCreateLabel("Please select a product to order", 160,400,350,30) GuiCtrlSetFont(-1,17) $NextButton1 = GuiCtrlCreateButton("Next", 400,470,80,25) GUICtrlSetOnEvent($NextButton1, "_Gui2") $CancelButton = GuiCtrlCreateButton("Cancel", 490,470,80,25) GUICtrlSetOnEvent($CancelButton, "_Close") GuiSetState() EndFunc Func _Gui2() $ProductSelection = GuiCtrlRead($ProductListBox) If $ProductSelection = "" Then MsgBox(48, "Error", "Please select a product before proceeding!") Else GuiDelete($Gui1) $Gui2 = GuiCreate("Product Details",600,500) GUISetOnEvent($GUI_EVENT_CLOSE, "_Close") $ProductDetailsListBox = GuiCtrlCreateList("",200,80,200,300) $ProductDetails = IniReadSection("Products.ini", "Product") For $i = 1 To $ProductDetails[0][0] If $ProductDetails[$i][0] = $ProductSelection Then $NewProductDetails = IniRead("Products.ini", "Product", $ProductSelection, "Error") $NewString = StringSplit($NewProductDetails, ",") Else Sleep(10) EndIf Next For $i = 1 To $NewString[0] GuiCtrlSetData($ProductDetailsListBox, $NewString[$i]) Next $NextButton1 = GuiCtrlCreateButton("Next", 400,470,80,25) GUICtrlSetOnEvent($NextButton1, "_EmployeeID") $CancelButton = GuiCtrlCreateButton("Cancel", 490,470,80,25) GUICtrlSetOnEvent($CancelButton, "_Close") GuiSetState() EndIf EndFunc Func _EmployeeID() $ID = InputBox("Employee ID", "Please enter your employee ID") $IDList = IniReadSection("EmployeeID.ini", "IDS") For $i = 1 To $IDList[0][0] MsgBox(0, "Test", $IDList[$i][0] & @CR & @CR & $ID) If $IDList[$i][0] = $ID Then MsgBox(0, "Test", "Welcome!") ExitLoop Else Sleep(10) EndIf If $i = $IDList[0][0] Then MsgBox(0, "Test", "Not Welcome!") ExitLoop EndIf Next EndFunc Func _Close() Exit EndFunc While 1 Sleep(10) WEnd You WILL have to write your own INI's in order for this to work. I thought this would be best since only your company would know the values. For testing purposes create the following INI/INI entries. INI Name: Products.ini INI Contents [Product] Toner=1,2,3,4 Paper=1,2,3,4 INI Name: EmployeeID.ini INI Contents: [iDS] Jon=1 Ted=1 Bob=1 I think this ID setup would be useful in more than one way. If say, your employee ID does not grant you access to sending a request form (Say only managers can do it) then you can set the value to either 1 or 0. And then run a If statement and if they do not have a 1 exit the script so they cannot send the invoice. Once again, hope this helps and let me know what you think/need!
    1 point
  6. Not to raise a dead topic, but I wanted to come back and say a big "thank you!" to Dan and Rigest here for getting me pointed in the right direction on automating PCOMM sessions. My usage isn't for AS400, but a regular IBM mainframe environment. We still use the IBM Personal Communications software as the emulator for it however. I wanted to add some of my findings to this thread for future reference. You are perfectly able to create only the Presentation Space object on it's own (see $oPS below), it does not need to be accessed from the root "autECLSession" object. Same for the Operator Information Area object (see $oOIA below). And for most cases I can think of, using only the $oPS object allows you to accomplish pretty near anything as far as interacting with the session. Two main issues I ran into when setting up automation of some tasks: First, the $oPS.WaitForString() method seems like practically an answer to prayer for a method to wait for a specific screen to be displayed. However in actual usage, I found it to be incredibly slow, often taking upwards of 2 or 3 seconds after the session had returned to a "ready" state before returning the string position information to my script. I ended up replacing every usage of it with a combination of $oOIA.WaitForInputReady() and $oPS.SearchText(). After that change, the script is able to navigate the mainframe interface faster than the eye can follow, but without ever getting ahead of the mainframe when it hits a slowdown. The second issue was with $oPS.SearchText(), specifically when trying to actually find the position of a string. According to the documentation, the SearchText() method can take an optional 3rd and 4th parameters of row and column variables, which upon return would be set to the row and column of the start of the string that was found. I believe I had read in the help (or somewhere) that AutoIt does not support this type of interaction with a COM object at this time. At any rate, when I tried it out for the heck of it, the variables were not altered when the string was found. So this method ends up being great to check that you're on the right track by telling you if the string is on the screen, but you'll have to write your own function to parse the output from $oPS.GetText() to find the row and column of a string if you need it. After going through this I wonder if a PCOMM UDF would be useful. Though with only this single topic on the subject, there probably isn't a practical demand for it. Code use example for some of the most used methods in the PCOMM objects: $oPS = ObjCreate("PCOMM.autECLPS") $oPS.SetConnectionByName("A") $oOIA = ObjCreate("PCOMM.autECLOIA") $oOIA.SetconnectionByName("A") ;; Intermediate code here... $oPS.SetCursorPos($iRow, $iCol) $oPS.SendKeys("s[enter][newline]s[enter]") $oOIA.WaitForInputReady() If Not $oPS.SearchText("*********** Top of Data *************") Then MsgBox(0,"error", "Error - Mainframe has stopped responding as expected.") Return 1 EndIf $sText = $oPS.GetText() $oPS.SendKeys("[PF3][PF3]")
    1 point
×
×
  • Create New...