Zoroxeus Posted November 9, 2006 Share Posted November 9, 2006 (edited) Hello, I have been trying to incorporate my VBS script in AutoIt, Can't I just copy/paste ? because it does not seem to work... Thanks My code is below ! 'Create a WshShell Object Set WshShell = Wscript.CreateObject("Wscript.Shell") 'Create a WshShortcut Object Set oShellLink = WshShell.CreateShortcut("ImpAct.lnk") 'Set the Target Path for the shortcut oShellLink.TargetPath = "http://trakwebtest/qireg/createiap.asp?user=&project=6400" 'oShellLink.SetIconLocation "C:\Windows\System32\SHELL32.dll", 46 oShellLink.IconLocation = "C:\WINDOWS\system32\tourstart.exe, 0" 'oShellLink.IconLocation = "C:\WINDOWS\system32\SHELL32.dll, 88" 'oShellLink.IconLocation = "C:\WINDOWS\system32\user32.dll, 1" 'Save the shortcut oShellLink.Save 'Clean up the WshShortcut Object Set oShellLink = Nothing SelfDestruct Sub SelfDestruct() Set objFso = CreateObject("Scripting.FileSystemObject") objFso.DeleteFile WScript.ScriptFullName Set objFso = Nothing End Sub Edited November 9, 2006 by Zoroxeus Link to comment Share on other sites More sharing options...
DaleHohm Posted November 9, 2006 Share Posted November 9, 2006 >I have been trying to incorporate my VBS script in AutoIt, >Can't I just copy/paste ? Um, no >because it does not seem to work... Why would you expect it to? Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
DaleHohm Posted November 9, 2006 Share Posted November 9, 2006 Now that you have posted some code, I'll tell you that you need to convert it to AutoIt syntax. It is similar in some ways (at least more similar than curly-brace languages like C), but it is still quite different. In your case you should particularly look at the helpfile section on Obj/COM and look for examples in the forum. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Zoroxeus Posted November 9, 2006 Author Share Posted November 9, 2006 Now that you have posted some code, I'll tell you that you need to convert it to AutoIt syntax. It is similar in some ways (at least more similar than curly-brace languages like C), but it is still quite different.In your case you should particularly look at the helpfile section on Obj/COM and look for examples in the forum.DaleThanks, I did look at the Obj/Com section but I learn better from the real code rather than the syntax most of the time... The obj/com section is quite limited and does not have examples for my case.. I did use $ to set variables and work with them... but it is not really working... Link to comment Share on other sites More sharing options...
Developers Jos Posted November 9, 2006 Developers Share Posted November 9, 2006 Thanks, I did look at the Obj/Com section but I learn better from the real code rather than the syntax most of the time... The obj/com section is quite limited and does not have examples for my case.. I did use $ to set variables and work with them... but it is not really working...Show what you have ... you might get help ... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Zoroxeus Posted November 9, 2006 Author Share Posted November 9, 2006 Show what you have ... you might get help ...This is what I have... but obviously it is not working,.... $WshShell = CreateObject("Wscript.Shell")$WshShell.Wscript()$oShellLink = WshShell.CreateShortcut("ImpAct.lnk")$oShellLink.TargetPath = "http://trakwebtest/qireg/createiap.asp?user=&project=6400"$oShellLink.IconLocation = "C:\WINDOWS\system32\tourstart.exe, 0"$oShellLink.Save$oShellLink = NothingCall ("SelfDestruct")Func SelfDestruct()$objFso = CreateObject("Scripting.FileSystemObject")objFso.DeleteFile WScript.ScriptFullName$objFso = NothingEndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted November 9, 2006 Developers Share Posted November 9, 2006 $WshShell = ObjCreate("Wscript.Shell") $oShellLink = $WshShell.CreateShortcut ("ImpAct.lnk") $oShellLink.TargetPath = "http://trakwebtest/qireg/createiap.asp?user=&project=6400" $oShellLink.IconLocation = "C:\WINDOWS\system32\tourstart.exe, 0" $oShellLink.Save $oShellLink = "" But whats wrong with FileCreateShortCut() ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Zoroxeus Posted November 9, 2006 Author Share Posted November 9, 2006 $WshShell = ObjCreate("Wscript.Shell") $oShellLink = $WshShell.CreateShortcut ("ImpAct.lnk") $oShellLink.TargetPath = "http://trakwebtest/qireg/createiap.asp?user=&project=6400" $oShellLink.IconLocation = "C:\WINDOWS\system32\tourstart.exe, 0" $oShellLink.Save $oShellLink = "" But whats wrong with FileCreateShortCut() ? Nothing, but I did not manage to create a link ... because I have to link the shortcut to a file... and I did not know wich one... ? I would be curious to know however if you have a better way ? (I know it's shorter) Also I am looking to delete the exe autoamticly, any idea ? Thanks man you rule ! (i was not that far) Link to comment Share on other sites More sharing options...
Developers Jos Posted November 9, 2006 Developers Share Posted November 9, 2006 Nothing, but I did not manage to create a link ... because I have to link the shortcut to a file... and I did not know wich one... ? I would be curious to know however if you have a better way ? (I know it's shorter) Also I am looking to delete the exe autoamticly, any idea ? Thanks man you rule ! (i was not that far)Sure posted many times in the forum: ; Your code _SelfDelete() Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '" > nul' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 9, 2006 Developers Share Posted November 9, 2006 Nothing, but I did not manage to create a link ... because I have to link the shortcut to a file... and I did not know wich one... ? I would be curious to know however if you have a better way ? (I know it's shorter) FileCreateShortcut("http://trakwebtest/qireg/createiap.asp?user=&project=6400","ImpAct2.lnk",Default,Default, "", "C:\WINDOWS\system32\tourstart.exe, 0") SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Zoroxeus Posted November 9, 2006 Author Share Posted November 9, 2006 FileCreateShortcut("http://trakwebtest/qireg/createiap.asp?user=&project=6400","ImpAct2.lnk",Default,Default, "", "C:\WINDOWS\system32\tourstart.exe, 0") Thanks ! I could have never guessed for the "Default" trick... neither for the self destruct ! (I searched 'destrcut' and did not find anything on the forum). Going to go through it to try to understand it as it seems a bit complicated.... I have also this code below in VBS that I did: Set myOlApp = CreateObject("Outlook.Application") Set myNameSpace = myOlApp.GetNameSpace("MAPI") Set myFolder = myNamespace.GetDefaultFolder(6) Set myNewFolder = myFolder.Folders.Add("ImpActs") Set myNewBisFolder = myNewFolder.Folders.Add("ImpActs2") tried to move it to autoit this way: $myOlApp = ObjCreate("Outtlook.Application") $myNameSpace = $myOlApp.GetNameSpace("MAPI") $myFolder = $myNameSpace.GetDefaultFolder(6) $myNewFolder = $myFolder.Folders.Add("ImpActs") $myNewBisFolder = $myNewFolder.Folders.Add("ImpAct2") Gives me an error "Variable must be of type object" .... is not myOldApp of type object ? since I used "ObjCreate" ?? Thanks Link to comment Share on other sites More sharing options...
Developers Jos Posted November 9, 2006 Developers Share Posted November 9, 2006 $myOlApp = ObjCreate("Outtlook.Application")T to many ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Zoroxeus Posted November 9, 2006 Author Share Posted November 9, 2006 T to many ?Fantastic !!!!! Thanks a lot ! I thought for some moment I had not understood the concepts Any idea where i should start if I want to import rules in outlook ? Link to comment Share on other sites More sharing options...
Blue_Drache Posted November 9, 2006 Share Posted November 9, 2006 Fantastic !!!!! Thanks a lot ! I thought for some moment I had not understood the concepts Any idea where i should start if I want to import rules in outlook ?MSDN Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Zoroxeus Posted November 9, 2006 Author Share Posted November 9, 2006 MSDNThanks I looked there... I could not find anything about importing rules though... ? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now