English Amiga Board


Go Back   English Amiga Board > Support > support.Apps

 
 
Thread Tools
Old 06 September 2019, 09:16   #1
Foebane
Registered User
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 47
Posts: 1,823
How can I make a .bat script runnable from the desktop?

I have a lot of scripts, basically batch files, that I usually run with double-clicking on the file, and then, in the "Execute a File" dialog, I have to add the prefix "execute " to the name of the file in order to run it.

I know that icons are the solution, but I'm not sure at all how to achieve it. I try IconEdit and set the type of icon to Project, but I can't save anything as the name is invalid. And when I try Tool, it doesn't work. I do know that "C:IconX" is needed to make the script executable.

So what's the simplest way to achieve this, please?
Foebane is offline  
Old 06 September 2019, 09:31   #2
Hewitson
Registered User
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 37
Posts: 3,376
Forget about icons. The easiest way to do this is "protect <filename> +s".

Edit: Amiga scripts certainly shouldn't have the extension ".bat". Usually, they'd have no extension at all.

Last edited by Hewitson; 06 September 2019 at 09:45.
Hewitson is offline  
Old 06 September 2019, 10:10   #3
Foebane
Registered User
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 47
Posts: 1,823
Quote:
Originally Posted by Hewitson View Post
Forget about icons. The easiest way to do this is "protect <filename> +s".

Edit: Amiga scripts certainly shouldn't have the extension ".bat". Usually, they'd have no extension at all.
I forgot to mention it before, but I already tried setting the S attribute on the scripts, but I get the attached result. What is it looking for?

But when I prefix "execute " it runs as usual.
Attached Thumbnails
Click image for larger version

Name:	001.png
Views:	95
Size:	32.2 KB
ID:	64335  
Foebane is offline  
Old 06 September 2019, 10:21   #4
Hewitson
Registered User
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 37
Posts: 3,376
I'm sorry, I didn't realise being able to run the script from an icon was a necessity. If you'd like to be able to do that, you'll need to use IconX as you mentioned earlier.

http://www.jaruzel.com/amiga/amiga-o...elp/iconx.html

Apologies for not reading your first post thoroughly.
Hewitson is offline  
Old 06 September 2019, 10:21   #5
malko
Ex nihilo nihil

malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 2,264
Be sure that your script file & icon file have the same name (.info excepted).
Then, if your "Project" icon has "c:IconX" as "Default tool", it should work.
If it is still not working try to rename your script. Based on your screenshot seems you are using unusual characters in the filename.
malko is offline  
Old 06 September 2019, 11:23   #6
Foebane
Registered User
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 47
Posts: 1,823
Quote:
Originally Posted by Hewitson View Post
I'm sorry, I didn't realise being able to run the script from an icon was a necessity. If you'd like to be able to do that, you'll need to use IconX as you mentioned earlier.
It's not a necessity for me, but I thought icons were necessary. If I can avoid icons, I'd like to. Sorry if I wasn't clear about that.

So why isn't my script working?
Foebane is offline  
Old 06 September 2019, 12:53   #7
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 46
Posts: 3,595
It appears the system doesn't like the spaces in your file name.
Then the WB will add double quotes around it, which is usually fine.
But for some reason execute doesn't like these and fails miserably.

So either you use an icon, or you remove the spaces in the name (or you find a patch for what is obviously an OS bug).
meynaf is offline  
Old 06 September 2019, 19:35   #8
Foebane
Registered User
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 47
Posts: 1,823
Quote:
Originally Posted by meynaf View Post
It appears the system doesn't like the spaces in your file name.
Then the WB will add double quotes around it, which is usually fine.
But for some reason execute doesn't like these and fails miserably.

So either you use an icon, or you remove the spaces in the name (or you find a patch for what is obviously an OS bug).
Confirmed.

I just removed the spaces from one filename but it looks ugly, but I think I've found a way to execute the script with just the number after the @ sign as a filename in full. It would solve all the problems I've been having, and would be much easier to do.

I'm going to reorganise my files to do things this way during the weekend.

I had a niggling feeling at the back of my mind what was wrong, but I guess I forgot about how most Amiga filenames don't have spaces (then again, some do, so I thought it was permissable). But if spaces break things like this, then it's really not worth bothering with them.

Thanks, everyone!
Foebane is offline  
Old 07 September 2019, 07:06   #9
Hewitson
Registered User
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 37
Posts: 3,376
Why are all these scripts necessary? What are they actually doing?
Hewitson is offline  
Old 07 September 2019, 08:49   #10
AMIGASYSTEM
Registered User
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Posts: 5,190
Quote:
Originally Posted by meynaf View Post
It appears the system doesn't like the spaces in your file name.
It could be a problem with the "Execute" command, some time ago i reported this problem that was then fixed by Thomas Richter, you can read here:

http://eab.abime.net/showpost.php?p=...&postcount=430
AMIGASYSTEM is offline  
Old 07 September 2019, 10:23   #11
Foebane
Registered User
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 47
Posts: 1,823
Quote:
Originally Posted by Hewitson View Post
Why are all these scripts necessary? What are they actually doing?
They're just scripts that run demos from LHA files that I drag to the desktop, so I don't have to open up the archives and go digging for the right file. It works better this way, especially as some demos require preparation of sorts to run (assigns and so on).
Foebane is offline  
Old 07 September 2019, 12:05   #12
Retro1234
Boo

Retro1234's Avatar
 
Join Date: Jun 2006
Location: 5150
Posts: 4,366
Cant you just do

Execute "My File Has Spaces"
Retro1234 is offline  
Old 07 September 2019, 12:28   #13
Foebane
Registered User
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 47
Posts: 1,823
Quote:
Originally Posted by Retro1234 View Post
Cant you just do

Execute "My File Has Spaces"
I used to, but I was fed up of having to click the mouse on the text box after double-clicking the script name, left arrow key my way to the start and type in "execute " each time. Now I've followed the helpful advice by people here (about the S attributes and the removal of spaces in filenames) I don't need to.
Foebane is offline  
Old 08 September 2019, 16:08   #14
Foebane
Registered User
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 47
Posts: 1,823
Another question:

Is the period/full stop/dot "." permitted in Amiga filenames? I've just gone and replaced all the spaces in the previous filenames with periods, so hopefully the whole issue of spaces will be wiped out for good.
Foebane is offline  
Old 08 September 2019, 18:27   #15
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 2,378
You can use "." like other allowed chars. I use "_" as space replacement but "." should be ok. See Amiga DOS or Workbench book for filename convention.
daxb is offline  
Old 08 September 2019, 19:15   #16
Foebane
Registered User
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 47
Posts: 1,823
Quote:
Originally Posted by daxb View Post
You can use "." like other allowed chars. I use "_" as space replacement but "." should be ok. See Amiga DOS or Workbench book for filename convention.
Thank god for that! I thought I'd replace the spaces with something that is fairly unobtrusive, and I think underscores are ugly as heck. But that's my opinion.
Foebane is offline  
Old 08 September 2019, 23:26   #17
Hewitson
Registered User
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 37
Posts: 3,376
Quote:
Originally Posted by Foebane View Post
They're just scripts that run demos from LHA files that I drag to the desktop, so I don't have to open up the archives and go digging for the right file. It works better this way, especially as some demos require preparation of sorts to run (assigns and so on).
Sounds like a complicated solution for a problem that doesn't exist.
Hewitson is offline  
Old 09 September 2019, 00:01   #18
Foebane
Registered User
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 47
Posts: 1,823
Quote:
Originally Posted by Hewitson View Post
Sounds like a complicated solution for a problem that doesn't exist.
So if you wanted to run a demo that required programs to be run beforehand, or assigns to be set, then you would go through all that? Not me. In any case, the scripts would come in useful for other people, they'd just have to rename them (if they wanted to).
Foebane is offline  
Old 15 September 2019, 15:01   #19
paul1981
Registered User

paul1981's Avatar
 
Join Date: Oct 2013
Location: England
Posts: 178
Quote:
Originally Posted by Foebane View Post
So if you wanted to run a demo that required programs to be run beforehand, or assigns to be set, then you would go through all that? Not me. In any case, the scripts would come in useful for other people, they'd just have to rename them (if they wanted to).
If I'm downloading something new and it wants an 'assign' then I'd never set it by hand, you should have a requester come up asking you where to point the assign to. Check this out:

http://aminet.net/package/util/wb/AssignWedge

I use the one built into MultiCX personally, and the AssignWedge for me is just one of those 'can't live without' features.
paul1981 is offline  
Old 16 September 2019, 14:29   #20
Photon
Moderator

Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 4,771
Skimmed, sorry if I misread sth. But filenames with spaces always require "", regardless of prepending Execute or not, and this is not a bug or sth unusual. If it shows the s attribute when you type List, the script should start just by typing its name. You can verify this by putting an echo "Running" as first line. If that shows and then it stops the error is thrown by some line in the script.

If the s attribute isn't showing, this could be from FAT formatted file system or sth?
Photon is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
$100+ bounty, make script to compile Amiga source Anachronist request.Other 0 18 November 2018 07:14
How to make an Workbench Icon running a CLI Script ? Marskilla support.Other 9 27 April 2016 00:11
How do I make my own shortcuts on the desktop? Gordon support.Other 4 29 March 2009 19:51
Italian version of BAT ? dungeon.master request.Old Rare Games 0 23 April 2006 01:12

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:33.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.09299 seconds with 14 queries