## Recommended Posts

Hello:

I want to automate my software testing tasks.  After a software is installed I need to click on "Start" button and then check if the short cut to the application is present, and, if so, click on the shortcut.  How can I automate this task?

So, basically, Start->Click on Application Folder->Click on Application

Regards,

Nazir

##### Share on other sites

Applications in the start menu are basically shortcuts to executables in the program files directory. Therefore, you could try something like this:

$file=("C:\Program Files\path\to\exe") If FileExists($file) Then
RunWait($file,"") EndIf #### Share this post ##### Link to post ##### Share on other sites Try FileGetShortcut. The Helpfile example should put you on the right path (see below, modified slightly from help file): Local$aDetails = FileGetShortcut("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\7-Zip\7-Zip File Manager.lnk")
If Not @error Then
MsgBox(0, "FileGetShortcut", "Path: " & $aDetails[0] & @CRLF & _ "Working directory: " &$aDetails[1] & @CRLF & _
"Arguments: " & $aDetails[2] & @CRLF & _ "Description: " &$aDetails[3] & @CRLF & _
"Icon filename: " & $aDetails[4] & @CRLF & _ "Icon index: " &$aDetails[5] & @CRLF & _
"Shortcut state: " & $aDetails[6] & @CRLF) EndIf √-1 2^3 ∑ π, and it was delicious! #### Share this post ##### Link to post ##### Share on other sites Does autoit ignore windows security settings or have a way around them? Under normal circumstances the start menu has a deny rule for read/listing of data. (Not saying the above doesn't work, just curious) Edited by allSystemsGo #### Share this post ##### Link to post ##### Share on other sites It doesn't ignore, but if you mean UAC then there are ways to account for it. The above runs for me on WIN7 without a UAC prompt, though. √-1 2^3 ∑ π, and it was delicious! #### Share this post ##### Link to post ##### Share on other sites Yeah, it did for me too. If you were to manually follow the path you would be presented with a deny permission, and unless you edit or remove it you can't access the Start Menu directory. Interesting.... #### Share this post ##### Link to post ##### Share on other sites Hi JLogan3o13 Hi JLogan3013: I tried your code. My version is listed below: Interestingly, the Path I got in my command window is C:Program Files (x86)7-Zip7zFM.exe, but it should be actually C:Program Files7-Zip7zFM.exe Any thoughts? Also, since I am testing the installation of my application my users will prefer to actually see the same steps being executed manually. So they would like the automated script to click on start, then next click on the desired shortcut in the shortcut menu and then see the application starting. Would this be possible? Regards Nazir Local$aDetails = FileGetShortcut("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\7-Zip\7-Zip File Manager.lnk")
If Not @error Then
MsgBox(0, "FileGetShortcut", "Path: " & $aDetails[0] & @CRLF & _ "Working directory: " &$aDetails[1] & @CRLF & _
"Arguments: " & $aDetails[2] & @CRLF & _ "Description: " &$aDetails[3] & @CRLF & _
"Icon filename: " & $aDetails[4] & @CRLF & _ "Icon index: " &$aDetails[5] & @CRLF & _
"Shortcut state: " & $aDetails[6] & @CRLF) EndIf Run("C:\Windows\system32\cmd.exe") WinWaitActive("C:\Windows\system32\cmd.exe","") Send($aDetails[0])
Send("{ENTER}")

##### Share on other sites

I solved the problem. I found that AutoIt did not work as expected in Windows 7 64 bit. But, when I installed the same in Windows 2008 Server 64 bit it worked well. Perhaps I will start another thread asking why it does not work on Windows 7 64 bit. When I built the exe in 2008 Server 64 bit and ran it on Windows 7 64 bit, the exe ran OK. But exeution of the program from the AutoIt editor in Windows 7 64 bit behaves erratically.

#include <GuiTreeView.au3>
Send("^{ESC}")
sleep(1000)
sleep(1000)
$hTree = ControlGetHandle("Start menu", "", "[CLASS:SysTreeView32; INSTANCE:1]")$hTree1 = _GUICtrlTreeView_FindItem($hTree,"Accessories")$hTree2 = _GUICtrlTreeView_FindItem($hTree,"Paint") _GUICtrlTreeView_ClickItem($hTree, $hTree1) sleep(1000) WinWaitActive("Start menu","") _GUICtrlTreeView_ClickItem($hTree, \$hTree2)

## Create an account

Register a new account